View Javadoc

1   /*
2    * $Id: ServerNotificationManagerConfigurator.java 11549 2008-04-09 05:12:30Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
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  }