1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.extras.spring.events; |
12 | |
|
13 | |
import org.mule.umo.UMOEventContext; |
14 | |
import org.mule.umo.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 UMOEventContext context; |
36 | |
private final String endpoint; |
37 | |
private final ApplicationContext applicationContext; |
38 | 292 | private final Map properties = Collections.synchronizedMap(new HashMap()); |
39 | |
|
40 | |
public MuleApplicationEvent(Object message, String endpoint) |
41 | |
{ |
42 | 72 | super(message); |
43 | 72 | this.endpoint = endpoint; |
44 | 72 | this.applicationContext = null; |
45 | 72 | this.context = null; |
46 | 72 | } |
47 | |
|
48 | |
MuleApplicationEvent(Object message, UMOEventContext context, ApplicationContext appContext) |
49 | |
throws MalformedEndpointException |
50 | |
{ |
51 | 220 | super(message); |
52 | 220 | this.context = context; |
53 | 220 | this.endpoint = context.getEndpointURI().toString(); |
54 | 220 | this.applicationContext = appContext; |
55 | 220 | } |
56 | |
|
57 | |
public UMOEventContext getMuleEventContext() |
58 | |
{ |
59 | 676 | return context; |
60 | |
} |
61 | |
|
62 | |
public String getEndpoint() |
63 | |
{ |
64 | 970 | return endpoint; |
65 | |
} |
66 | |
|
67 | |
public ApplicationContext getApplicationContext() |
68 | |
{ |
69 | 60 | return applicationContext; |
70 | |
} |
71 | |
|
72 | |
public Map getProperties() |
73 | |
{ |
74 | 132 | return properties; |
75 | |
} |
76 | |
|
77 | |
public void setProperty(Object key, Object value) |
78 | |
{ |
79 | 0 | this.properties.put(key, value); |
80 | 0 | } |
81 | |
|
82 | |
public Object getProperty(Object key) |
83 | |
{ |
84 | 0 | return properties.get(key); |
85 | |
} |
86 | |
|
87 | |
} |