KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > impl > internal > notifications > AdminNotification


1 /*
2  * $Id: AdminNotification.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.impl.internal.notifications;
12
13 import org.mule.umo.UMOMessage;
14 import org.mule.umo.manager.UMOServerNotification;
15
16 import java.util.HashMap JavaDoc;
17 import java.util.Map JavaDoc;
18
19 /**
20  * <code>AdminNotification</code> is used to invoke actions on a remote mule server
21  *
22  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
23  * @version $Revision: 3798 $
24  */

25
26 public class AdminNotification extends UMOServerNotification
27 {
28     /**
29      * Serial version
30      */

31     private static final long serialVersionUID = -53091546441476249L;
32     public static final int ACTION_RECEIVE = ADMIN_EVENT_ACTION_START_RANGE + 1;
33     public static final int ACTION_DISPATCH = ADMIN_EVENT_ACTION_START_RANGE + 2;
34     public static final int ACTION_SEND = ADMIN_EVENT_ACTION_START_RANGE + 3;
35     public static final int ACTION_INVOKE = ADMIN_EVENT_ACTION_START_RANGE + 4;
36
37     private static final transient String JavaDoc[] ACTIONS = new String JavaDoc[]{"receive event", "dispatch event",
38         "send event", "invoke component"};
39
40     private Map JavaDoc properties = new HashMap JavaDoc();
41     private UMOMessage message;
42
43     public AdminNotification(UMOMessage message, int action, String JavaDoc resourceIdentifier)
44     {
45         super(message, action, resourceIdentifier);
46         this.message = message;
47     }
48
49     public UMOMessage getMessage()
50     {
51         return message;
52     }
53
54     public void setProperty(Object JavaDoc key, Object JavaDoc value)
55     {
56         properties.put(key, value);
57     }
58
59     public Object JavaDoc getProperty(Object JavaDoc key)
60     {
61         return properties.get(key);
62     }
63
64     public Map JavaDoc getProperties()
65     {
66         return properties;
67     }
68
69     protected String JavaDoc getActionName(int action)
70     {
71         int i = action - ADMIN_EVENT_ACTION_START_RANGE;
72         if (i - 1 > ACTIONS.length)
73         {
74             return String.valueOf(action);
75         }
76         return ACTIONS[i - 1];
77     }
78 }
79
Popular Tags