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