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 | 0 | { |
22 | 0 | this.type = type; |
23 | 0 | } |
24 | |
|
25 | |
public ServerNotification getPostNotification() |
26 | |
{ |
27 | 0 | return postNotification; |
28 | |
} |
29 | |
|
30 | |
public void setPostNotification(ServerNotification postNotification) |
31 | |
{ |
32 | 0 | this.postNotification = postNotification; |
33 | 0 | } |
34 | |
|
35 | |
public ServerNotification getPreNotification() |
36 | |
{ |
37 | 0 | return preNotification; |
38 | |
} |
39 | |
|
40 | |
public void setPreNotification(ServerNotification preNotification) |
41 | |
{ |
42 | 0 | this.preNotification = preNotification; |
43 | 0 | } |
44 | |
|
45 | |
public Class getType() |
46 | |
{ |
47 | 0 | return type; |
48 | |
} |
49 | |
|
50 | |
public void setType(Class type) |
51 | |
{ |
52 | 0 | this.type = type; |
53 | 0 | } |
54 | |
|
55 | |
public void firePreNotification(MuleContext context) |
56 | |
{ |
57 | 0 | if(preNotification!=null) |
58 | |
{ |
59 | 0 | context.fireNotification(preNotification); |
60 | |
} |
61 | 0 | } |
62 | |
|
63 | |
public void firePostNotification(MuleContext context) |
64 | |
{ |
65 | 0 | if(postNotification!=null) |
66 | |
{ |
67 | 0 | context.fireNotification(postNotification); |
68 | |
} |
69 | 0 | } |
70 | |
|
71 | |
@Override |
72 | |
public String toString() |
73 | |
{ |
74 | 0 | return super.toString() + " (" + ClassUtils.getSimpleName(type) + ")"; |
75 | |
} |
76 | |
|
77 | |
} |