KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: ManagerNotification.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.manager.UMOManager;
14 import org.mule.umo.manager.UMOServerNotification;
15
16 /**
17  * <code>ManagerNotification</code> is fired when an event such as the manager
18  * starting occurs. The payload of this event will always be a reference to the
19  * manager.
20  *
21  * @see org.mule.MuleManager
22  * @see org.mule.umo.manager.UMOManager
23  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
24  * @version $Revision: 3798 $
25  */

26 public class ManagerNotification extends UMOServerNotification implements BlockingServerEvent
27 {
28     /**
29      * Serial version
30      */

31     private static final long serialVersionUID = -3246036188011581121L;
32     public static final int MANAGER_INITIALISNG = MANAGER_EVENT_ACTION_START_RANGE + 1;
33     public static final int MANAGER_INITIALISED = MANAGER_EVENT_ACTION_START_RANGE + 2;
34     public static final int MANAGER_STARTING = MANAGER_EVENT_ACTION_START_RANGE + 3;
35     public static final int MANAGER_STARTED = MANAGER_EVENT_ACTION_START_RANGE + 4;
36     public static final int MANAGER_STOPPING = MANAGER_EVENT_ACTION_START_RANGE + 5;
37     public static final int MANAGER_STOPPED = MANAGER_EVENT_ACTION_START_RANGE + 6;
38     public static final int MANAGER_DISPOSING = MANAGER_EVENT_ACTION_START_RANGE + 7;
39     public static final int MANAGER_DISPOSED = MANAGER_EVENT_ACTION_START_RANGE + 8;
40     public static final int MANAGER_DISPOSING_CONNECTORS = MANAGER_EVENT_ACTION_START_RANGE + 9;
41     public static final int MANAGER_DISPOSED_CONNECTORS = MANAGER_EVENT_ACTION_START_RANGE + 10;
42
43     private static final transient String JavaDoc[] ACTIONS = new String JavaDoc[]{"initialising", "initialised", "starting",
44         "started", "stopping", "stopped", "disposing", "disposed", "disposing connectors",
45         "disposed connectors"};
46
47     public ManagerNotification(UMOManager message, int action)
48     {
49         super(message, action);
50         resourceIdentifier = message.getId();
51     }
52
53     protected String JavaDoc getPayloadToString()
54     {
55         return ((UMOManager)source).getId();
56     }
57
58     protected String JavaDoc getActionName(int action)
59     {
60         int i = action - MANAGER_EVENT_ACTION_START_RANGE;
61         if (i - 1 > ACTIONS.length)
62         {
63             return String.valueOf(action);
64         }
65         return ACTIONS[i - 1];
66     }
67
68     public String JavaDoc toString()
69     {
70         return EVENT_NAME + "{" + "action=" + getActionName(action) + ", resourceId=" + resourceIdentifier
71                + ", timestamp=" + timestamp + "}";
72     }
73 }
74
Popular Tags