KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > extras > spring > events > MuleApplicationEvent


1 /*
2  * $Id: MuleApplicationEvent.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.extras.spring.events;
12
13 import java.util.Collections JavaDoc;
14 import java.util.HashMap JavaDoc;
15 import java.util.Map JavaDoc;
16
17 import org.mule.umo.UMOEventContext;
18 import org.mule.umo.endpoint.MalformedEndpointException;
19 import org.springframework.context.ApplicationContext;
20 import org.springframework.context.ApplicationEvent;
21
22 /**
23  * <code>MuleApplicationEvent</code> is an Spring ApplicationEvent used to wrap a
24  * MuleEvent
25  */

26
27 public class MuleApplicationEvent extends ApplicationEvent
28 {
29     /**
30      * Serial version
31      */

32     private static final long serialVersionUID = 5297176859050194632L;
33
34     private final UMOEventContext context;
35     private final String JavaDoc endpoint;
36     private final ApplicationContext applicationContext;
37     private final Map JavaDoc properties = Collections.synchronizedMap(new HashMap JavaDoc());
38
39     public MuleApplicationEvent(Object JavaDoc message, String JavaDoc endpoint)
40     {
41         super(message);
42         this.endpoint = endpoint;
43         this.applicationContext = null;
44         this.context = null;
45     }
46
47     MuleApplicationEvent(Object JavaDoc message, UMOEventContext context, ApplicationContext appContext)
48         throws MalformedEndpointException
49     {
50         super(message);
51         this.context = context;
52         this.endpoint = context.getEndpointURI().toString();
53         this.applicationContext = appContext;
54     }
55
56     public UMOEventContext getMuleEventContext()
57     {
58         return context;
59     }
60
61     public String JavaDoc getEndpoint()
62     {
63         return endpoint;
64     }
65
66     public ApplicationContext getApplicationContext()
67     {
68         return applicationContext;
69     }
70
71     public Map JavaDoc getProperties()
72     {
73         return properties;
74     }
75
76     public void setProperty(Object JavaDoc key, Object JavaDoc value)
77     {
78         this.properties.put(key, value);
79     }
80
81     public Object JavaDoc getProperty(Object JavaDoc key)
82     {
83         return properties.get(key);
84     }
85
86 }
87
Popular Tags