1
2
3
4
5
6
7 package org.mule.context.notification;
8
9 import org.mule.api.MuleMessage;
10 import org.mule.api.component.Component;
11 import org.mule.api.construct.FlowConstruct;
12 import org.mule.api.context.notification.ServerNotification;
13
14
15
16
17
18 public class ComponentMessageNotification extends ServerNotification
19 {
20
21 private static final long serialVersionUID = -6369685122731797646L;
22
23 public static final int COMPONENT_PRE_INVOKE = COMPONENT_EVENT_ACTION_START_RANGE + 1;
24 public static final int COMPONENT_POST_INVOKE = COMPONENT_EVENT_ACTION_START_RANGE + 2;
25
26 static
27 {
28 registerAction("component pre invoke", COMPONENT_PRE_INVOKE);
29 registerAction("component post invoke", COMPONENT_POST_INVOKE);
30 }
31
32
33
34
35
36 public ComponentMessageNotification(MuleMessage message, Component component, FlowConstruct flowConstruct, int action)
37 {
38 super(cloneMessage(message), action);
39 resourceIdentifier = flowConstruct.getName();
40
41 }
42
43 @Override
44 protected String getPayloadToString()
45 {
46 return ((MuleMessage) source).getPayloadForLogging();
47 }
48
49
50
51
52 public String getServiceName()
53 {
54 return resourceIdentifier;
55 }
56
57 @Override
58 public String toString()
59 {
60 return EVENT_NAME + "{action=" + getActionName(action) + ", message: " + source + ", resourceId="
61 + resourceIdentifier + ", timestamp=" + timestamp + ", serverId=" + serverId + ", component: "
62 + "}";
63 }
64
65 @Override
66 public String getType()
67 {
68 return "trace";
69 }
70
71 @Override
72 public MuleMessage getSource()
73 {
74 return (MuleMessage) super.getSource();
75 }
76 }