1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.spring.events;
12
13 import org.mule.api.MuleEventContext;
14 import org.mule.api.endpoint.MalformedEndpointException;
15
16 import java.util.Collections;
17 import java.util.HashMap;
18 import java.util.Map;
19
20 import org.springframework.context.ApplicationContext;
21 import org.springframework.context.ApplicationEvent;
22
23
24
25
26
27
28 public class MuleApplicationEvent extends ApplicationEvent
29 {
30
31
32
33 private static final long serialVersionUID = 5297176859050194632L;
34
35 private final MuleEventContext context;
36 private final String endpoint;
37 private final ApplicationContext applicationContext;
38 private final Map properties = Collections.synchronizedMap(new HashMap());
39
40 public MuleApplicationEvent(Object message, String endpoint)
41 {
42 super(message);
43 this.endpoint = endpoint;
44 this.applicationContext = null;
45 this.context = null;
46 }
47
48 MuleApplicationEvent(Object message, MuleEventContext context, ApplicationContext appContext)
49 throws MalformedEndpointException
50 {
51 super(message);
52 this.context = context;
53 this.endpoint = context.getEndpointURI().toString();
54 this.applicationContext = appContext;
55 }
56
57 public MuleEventContext getMuleEventContext()
58 {
59 return context;
60 }
61
62 public String getEndpoint()
63 {
64 return endpoint;
65 }
66
67 public ApplicationContext getApplicationContext()
68 {
69 return applicationContext;
70 }
71
72 public Map getProperties()
73 {
74 return properties;
75 }
76
77 public void setProperty(Object key, Object value)
78 {
79 this.properties.put(key, value);
80 }
81
82 public Object getProperty(Object key)
83 {
84 return properties.get(key);
85 }
86
87 }