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 private final Map properties = Collections.synchronizedMap(new HashMap());
35
36 public MuleApplicationEvent(Object message, String endpoint)
37 {
38 super(message);
39 this.endpoint = endpoint;
40 this.applicationContext = null;
41 this.context = null;
42 }
43
44 MuleApplicationEvent(Object message, MuleEventContext context, ApplicationContext appContext)
45 throws MalformedEndpointException
46 {
47 super(message);
48 this.context = context;
49 this.endpoint = context.getEndpointURI().toString();
50 this.applicationContext = appContext;
51 }
52
53 public MuleEventContext getMuleEventContext()
54 {
55 return context;
56 }
57
58 public String getEndpoint()
59 {
60 return endpoint;
61 }
62
63 public ApplicationContext getApplicationContext()
64 {
65 return applicationContext;
66 }
67
68 public Map getProperties()
69 {
70 return properties;
71 }
72
73 public void setProperty(Object key, Object value)
74 {
75 this.properties.put(key, value);
76 }
77
78 public Object getProperty(Object key)
79 {
80 return properties.get(key);
81 }
82
83 }