1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
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 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
public class ModelNotification extends UMOServerNotification implements BlockingServerEvent |
23 | |
{ |
24 | |
|
25 | |
|
26 | |
|
27 | |
private static final long serialVersionUID = -1954880336427554435L; |
28 | |
|
29 | |
public static final int MODEL_INITIALISING = MODEL_EVENT_ACTION_START_RANGE + 1; |
30 | |
public static final int MODEL_INITIALISED = MODEL_EVENT_ACTION_START_RANGE + 2; |
31 | |
public static final int MODEL_INITIALISING_LISTENERS = MODEL_EVENT_ACTION_START_RANGE + 3; |
32 | |
public static final int MODEL_INITIALISED_LISTENERS = MODEL_EVENT_ACTION_START_RANGE + 4; |
33 | |
public static final int MODEL_STARTING = MODEL_EVENT_ACTION_START_RANGE + 5; |
34 | |
public static final int MODEL_STARTED = MODEL_EVENT_ACTION_START_RANGE + 6; |
35 | |
public static final int MODEL_STOPPING = MODEL_EVENT_ACTION_START_RANGE + 7; |
36 | |
public static final int MODEL_STOPPED = MODEL_EVENT_ACTION_START_RANGE + 8; |
37 | |
public static final int MODEL_DISPOSING = MODEL_EVENT_ACTION_START_RANGE + 9; |
38 | |
public static final int MODEL_DISPOSED = MODEL_EVENT_ACTION_START_RANGE + 10; |
39 | |
|
40 | 2 | private static final transient String[] ACTIONS = new String[]{"initialising", "initialised", |
41 | |
"initialising listeners", "initialised listeners", "starting", "started", "stopping", "stopped", |
42 | |
"disposing", "disposed"}; |
43 | |
|
44 | |
public ModelNotification(UMOModel model, int action) |
45 | |
{ |
46 | 1566 | super(model, action); |
47 | 1566 | resourceIdentifier = model.getName(); |
48 | 1566 | } |
49 | |
|
50 | |
protected String getPayloadToString() |
51 | |
{ |
52 | 0 | return ((UMOModel) source).getName(); |
53 | |
} |
54 | |
|
55 | |
protected String getActionName(int action) |
56 | |
{ |
57 | 0 | int i = action - MODEL_EVENT_ACTION_START_RANGE; |
58 | 0 | if (i - 1 > ACTIONS.length) |
59 | |
{ |
60 | 0 | return String.valueOf(action); |
61 | |
} |
62 | 0 | return ACTIONS[i - 1]; |
63 | |
} |
64 | |
} |