1
2
3
4
5
6
7
8
9
10
11 package org.mule.impl.internal.notifications;
12
13 import org.mule.impl.MuleDescriptor;
14 import org.mule.umo.UMODescriptor;
15 import org.mule.umo.manager.UMOServerNotification;
16
17
18
19
20
21
22
23
24
25 public class ComponentNotification extends UMOServerNotification
26 {
27
28
29
30 private static final long serialVersionUID = -8575741816897936674L;
31 public static final int COMPONENT_INITIALISED = COMPONENT_EVENT_ACTION_START_RANGE + 1;
32 public static final int COMPONENT_STARTED = COMPONENT_EVENT_ACTION_START_RANGE + 2;
33 public static final int COMPONENT_STOPPED = COMPONENT_EVENT_ACTION_START_RANGE + 3;
34 public static final int COMPONENT_PAUSED = COMPONENT_EVENT_ACTION_START_RANGE + 4;
35 public static final int COMPONENT_RESUMED = COMPONENT_EVENT_ACTION_START_RANGE + 5;
36 public static final int COMPONENT_DISPOSED = COMPONENT_EVENT_ACTION_START_RANGE + 6;
37 public static final int COMPONENT_STOPPING = COMPONENT_EVENT_ACTION_START_RANGE + 7;
38
39 private static final transient String[] ACTIONS = new String[]{"initialised", "started", "stopped",
40 "paused", "resumed", "disposed", "stopping"};
41
42 public ComponentNotification(UMODescriptor message, int action)
43 {
44 super(message, action);
45 resourceIdentifier = message.getName();
46 }
47
48 protected String getPayloadToString()
49 {
50 return ((MuleDescriptor) source).getName();
51 }
52
53 protected String getActionName(int action)
54 {
55 int i = action - COMPONENT_EVENT_ACTION_START_RANGE;
56 if (i - 1 > ACTIONS.length)
57 {
58 return String.valueOf(action);
59 }
60 return ACTIONS[i - 1];
61 }
62 }