1
2
3
4
5
6
7 package org.mule.lifecycle;
8
9 import org.mule.api.MuleContext;
10 import org.mule.api.context.notification.ServerNotification;
11 import org.mule.util.ClassUtils;
12
13 public class LifecycleObject
14 {
15
16 private Class type;
17 private ServerNotification preNotification;
18 private ServerNotification postNotification;
19
20 public LifecycleObject(Class type)
21 {
22 this.type = type;
23 }
24
25 public ServerNotification getPostNotification()
26 {
27 return postNotification;
28 }
29
30 public void setPostNotification(ServerNotification postNotification)
31 {
32 this.postNotification = postNotification;
33 }
34
35 public ServerNotification getPreNotification()
36 {
37 return preNotification;
38 }
39
40 public void setPreNotification(ServerNotification preNotification)
41 {
42 this.preNotification = preNotification;
43 }
44
45 public Class getType()
46 {
47 return type;
48 }
49
50 public void setType(Class type)
51 {
52 this.type = type;
53 }
54
55 public void firePreNotification(MuleContext context)
56 {
57 if(preNotification!=null)
58 {
59 context.fireNotification(preNotification);
60 }
61 }
62
63 public void firePostNotification(MuleContext context)
64 {
65 if(postNotification!=null)
66 {
67 context.fireNotification(postNotification);
68 }
69 }
70
71 @Override
72 public String toString()
73 {
74 return super.toString() + " (" + ClassUtils.getSimpleName(type) + ")";
75 }
76
77 }