1
2
3
4
5
6
7
8
9
10
11 package org.mule.config.spring;
12
13 import org.mule.api.MuleContext;
14 import org.mule.api.context.MuleContextAware;
15 import org.mule.context.notification.ServerNotificationManager;
16
17 import java.util.Collection;
18 import java.util.Map;
19
20 import org.springframework.beans.factory.SmartFactoryBean;
21
22 public class ServerNotificationManagerConfigurator implements MuleContextAware, SmartFactoryBean
23 {
24
25 private MuleContext muleContext;
26
27 private Boolean dynamic;
28 private Map interfaceToEvents;
29 private Collection interfaces;
30 private Collection pairs;
31
32 public void setMuleContext(MuleContext context)
33 {
34 this.muleContext = context;
35 }
36
37 public Object getObject() throws Exception
38 {
39 ServerNotificationManager notificationManager = muleContext.getNotificationManager();
40 if (dynamic != null)
41 {
42 notificationManager.setNotificationDynamic(dynamic.booleanValue());
43 }
44 if (interfaceToEvents != null)
45 {
46 notificationManager.setInterfaceToTypes(interfaceToEvents);
47 }
48 if (interfaces != null)
49 {
50 notificationManager.setDisabledInterfaces(interfaces);
51 }
52 if (pairs != null)
53 {
54 notificationManager.setAllListenerSubscriptionPairs(pairs);
55 }
56 return notificationManager;
57 }
58
59 public Class getObjectType()
60 {
61 return ServerNotificationManager.class;
62 }
63
64 public boolean isSingleton()
65 {
66 return true;
67 }
68
69 public void setNotificationDynamic(boolean dynamic)
70 {
71 this.dynamic = new Boolean(dynamic);
72 }
73
74 public void setInterfaceToTypes(Map interfaceToEvents) throws ClassNotFoundException
75 {
76 this.interfaceToEvents = interfaceToEvents;
77 }
78
79 public void setAllListenerSubscriptionPairs(Collection pairs)
80 {
81 this.pairs = pairs;
82 }
83
84 public void setDisabledInterfaces(Collection interfaces) throws ClassNotFoundException
85 {
86 this.interfaces = interfaces;
87 }
88
89 public boolean isEagerInit()
90 {
91 return true;
92 }
93
94 public boolean isPrototype()
95 {
96 return false;
97 }
98
99 }