01: package org.mule.config.spring;
02:
03: import org.mule.api.MuleContext;
04: import org.mule.api.context.MuleContextAware;
05: import org.mule.context.notification.ServerNotificationManager;
06:
07: import java.util.Collection;
08: import java.util.Map;
09:
10: import org.springframework.beans.factory.SmartFactoryBean;
11:
12: public class ServerNotificationManagerConfigurator implements
13: MuleContextAware, SmartFactoryBean {
14:
15: private MuleContext muleContext;
16:
17: private Boolean dynamic;
18: private Map interfaceToEvents;
19: private Collection interfaces;
20: private Collection pairs;
21:
22: public void setMuleContext(MuleContext context) {
23: this .muleContext = context;
24: }
25:
26: public Object getObject() throws Exception {
27: ServerNotificationManager notificationManager = muleContext
28: .getNotificationManager();
29: if (dynamic != null) {
30: notificationManager.setNotificationDynamic(dynamic
31: .booleanValue());
32: }
33: if (interfaceToEvents != null) {
34: notificationManager.setInterfaceToTypes(interfaceToEvents);
35: }
36: if (interfaces != null) {
37: notificationManager.setDisabledInterfaces(interfaces);
38: }
39: if (pairs != null) {
40: notificationManager.setAllListenerSubscriptionPairs(pairs);
41: }
42: return notificationManager;
43: }
44:
45: public Class getObjectType() {
46: return ServerNotificationManager.class;
47: }
48:
49: public boolean isSingleton() {
50: return true;
51: }
52:
53: public void setNotificationDynamic(boolean dynamic) {
54: this .dynamic = new Boolean(dynamic);
55: }
56:
57: public void setInterfaceToTypes(Map interfaceToEvents)
58: throws ClassNotFoundException {
59: this .interfaceToEvents = interfaceToEvents;
60: }
61:
62: public void setAllListenerSubscriptionPairs(Collection pairs) {
63: this .pairs = pairs;
64: }
65:
66: public void setDisabledInterfaces(Collection interfaces)
67: throws ClassNotFoundException {
68: this .interfaces = interfaces;
69: }
70:
71: public boolean isEagerInit() {
72: return true;
73: }
74:
75: public boolean isPrototype() {
76: return false;
77: }
78:
79: }
|