KickJava   Java API By Example, From Geeks To Geeks.

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


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

24 public class ModelNotification extends UMOServerNotification implements BlockingServerEvent
25 {
26     /**
27      * Serial version
28      */

29     private static final long serialVersionUID = -1954880336427554435L;
30
31     public static final int MODEL_INITIALISING = MODEL_EVENT_ACTION_START_RANGE + 1;
32     public static final int MODEL_INITIALISED = MODEL_EVENT_ACTION_START_RANGE + 2;
33     public static final int MODEL_INITIALISING_LISTENERS = MODEL_EVENT_ACTION_START_RANGE + 3;
34     public static final int MODEL_INITIALISED_LISTENERS = MODEL_EVENT_ACTION_START_RANGE + 4;
35     public static final int MODEL_STARTING = MODEL_EVENT_ACTION_START_RANGE + 5;
36     public static final int MODEL_STARTED = MODEL_EVENT_ACTION_START_RANGE + 6;
37     public static final int MODEL_STOPPING = MODEL_EVENT_ACTION_START_RANGE + 7;
38     public static final int MODEL_STOPPED = MODEL_EVENT_ACTION_START_RANGE + 8;
39     public static final int MODEL_DISPOSING = MODEL_EVENT_ACTION_START_RANGE + 9;
40     public static final int MODEL_DISPOSED = MODEL_EVENT_ACTION_START_RANGE + 10;
41
42     private static final transient String JavaDoc[] ACTIONS = new String JavaDoc[]{"initialising", "initialised",
43         "initialising listeners", "initialised listeners", "starting", "started", "stopping", "stopped",
44         "disposing", "disposed"};
45
46     public ModelNotification(UMOModel message, int action)
47     {
48         super(message, action);
49         resourceIdentifier = message.getName();
50     }
51
52     protected String JavaDoc getPayloadToString()
53     {
54         return ((UMOModel)source).getName();
55     }
56
57     protected String JavaDoc getActionName(int action)
58     {
59         int i = action - MODEL_EVENT_ACTION_START_RANGE;
60         if (i - 1 > ACTIONS.length)
61         {
62             return String.valueOf(action);
63         }
64         return ACTIONS[i - 1];
65     }
66 }
67
Popular Tags