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