[jboss-cvs] JBoss Messaging SVN: r4503 - in trunk: src/main/org/jboss/messaging/core/deployers and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 17 10:44:53 EDT 2008


Author: ataylor
Date: 2008-06-17 10:44:52 -0400 (Tue, 17 Jun 2008)
New Revision: 4503

Modified:
   trunk/src/config/jbm-beans.xml
   trunk/src/config/jbm-standalone-beans.xml
   trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java
   trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
   trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
   trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
   trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientExitTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/PacketFilterTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/ssl/CoreClientOverSSLTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueSettingsDeployerTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityDeployerTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityManagerDeployerTest.java
Log:
decoupled the deployers from the messaging server. The DeploymentManager and all deployers are now created by the Micro Container

Modified: trunk/src/config/jbm-beans.xml
===================================================================
--- trunk/src/config/jbm-beans.xml	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/config/jbm-beans.xml	2008-06-17 14:44:52 UTC (rev 4503)
@@ -4,6 +4,8 @@
 
    <bean name="Configuration" class="org.jboss.messaging.core.config.impl.FileConfiguration"/>
 
+   <bean name="DeploymentManager" class="org.jboss.messaging.core.deployers.impl.FileDeploymentManager"/>
+   
    <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JAASSecurityManager"/>
 
    <!-- <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
@@ -68,12 +70,36 @@
    </bean>
 
    <bean name="JMSServerDeployer" class="org.jboss.messaging.jms.server.impl.JMSServerDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+      </constructor>
       <property name="jmsServerManager">
          <inject bean="JMSServerManager"/>
       </property>
-      <property name="messagingServer">
-         <inject bean="MessagingServer"/>
-      </property>
    </bean>
 
+   <bean name="QueueSettingsDeployer" class="org.jboss.messaging.core.deployers.impl.QueueSettingsDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+         <parameter>
+            <inject bean="MessagingServer" property="queueSettingsRepository" state="Configured"/>
+         </parameter>
+      </constructor>
+   </bean>
+
+   <bean name="SecurityDeployer" class="org.jboss.messaging.core.deployers.impl.SecurityDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+         <parameter>
+            <inject bean="MessagingServer" property="securityRepository"/>
+         </parameter>
+      </constructor>
+   </bean>
+
 </deployment>
\ No newline at end of file

Modified: trunk/src/config/jbm-standalone-beans.xml
===================================================================
--- trunk/src/config/jbm-standalone-beans.xml	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/config/jbm-standalone-beans.xml	2008-06-17 14:44:52 UTC (rev 4503)
@@ -18,6 +18,8 @@
       </property>
    </bean>
 
+   <bean name="DeploymentManager" class="org.jboss.messaging.core.deployers.impl.FileDeploymentManager"/>
+
    <bean name="Configuration" class="org.jboss.messaging.core.config.impl.FileConfiguration"/>
 
    <!--<bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JAASSecurityManager"/>-->
@@ -29,12 +31,14 @@
    </bean>
 
    <bean name="SecurityManagerDeployer" class="org.jboss.messaging.core.deployers.impl.SecurityManagerDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+      </constructor>
       <property name="jbmSecurityManager">
          <inject bean="JBMSecurityManager"/>
       </property>
-      <property name="messagingServer">
-         <inject bean="MessagingServer"/>
-      </property>
    </bean>
 
    <bean name="MessagingServerManagement"
@@ -46,6 +50,7 @@
    </bean>
 
    <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+      <depends>QueueSettingsDeployer</depends>
       <property name="storageManager">
          <inject bean="StorageManager"/>
       </property>
@@ -84,12 +89,36 @@
    </bean>
 
    <bean name="JMSServerDeployer" class="org.jboss.messaging.jms.server.impl.JMSServerDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+      </constructor>
       <property name="jmsServerManager">
          <inject bean="JMSServerManager"/>
       </property>
-      <property name="messagingServer">
-         <inject bean="MessagingServer"/>
-      </property>
    </bean>
 
+   <bean name="QueueSettingsDeployer" class="org.jboss.messaging.core.deployers.impl.QueueSettingsDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+         <parameter>
+            <inject bean="MessagingServer" property="queueSettingsRepository" state="Configured"/>
+         </parameter>
+      </constructor>
+   </bean>
+
+   <bean name="SecurityDeployer" class="org.jboss.messaging.core.deployers.impl.SecurityDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+         <parameter>
+            <inject bean="MessagingServer" property="securityRepository"/>
+         </parameter>
+      </constructor>
+   </bean>
+
 </deployment>
\ No newline at end of file

Modified: trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -44,8 +44,4 @@
     * @throws Exception .
     */
    void unregisterDeployer(Deployer deployer);
-
-   void start(int order) throws Exception;
-
-   void stop();
 }

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,24 +21,18 @@
    */
 package org.jboss.messaging.core.deployers.impl;
 
+import org.jboss.messaging.core.deployers.Deployer;
+import org.jboss.messaging.core.deployers.DeploymentManager;
+import org.jboss.messaging.core.logging.Logger;
+
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
-import org.jboss.messaging.core.deployers.Deployer;
-import org.jboss.messaging.core.deployers.DeploymentManager;
-import org.jboss.messaging.core.logging.Logger;
-
 /**
  * @author <a href="ataylor at redhat.com">Andy Taylor</a>
  */
@@ -55,18 +49,12 @@
    private static List<URL> toUndeploy = new ArrayList<URL>();
    //the list of URL's to redeploy if changed
    private static List<URL> toRedeploy = new ArrayList<URL>();
-   
+
    private static ScheduledExecutorService scheduler;
 
-   private int currentOrder = 0;
-
-   public synchronized void start(final int order) throws Exception
+   public synchronized void start() throws Exception
    {
-      if (order <= currentOrder)
-      {
-         throw new IllegalArgumentException("Already started with weight " + currentOrder);
-      }
-      Collection<ConfigurationURL> configurations = getUnstartedConfigurations(order);
+      Collection<ConfigurationURL> configurations = getConfigurations();
       for (ConfigurationURL configuration : configurations)
       {
          Iterator<URL> urls = configuration.getUrls();
@@ -77,7 +65,6 @@
             deployed.put(url, new File(url.getFile()).lastModified());
          }
       }
-      currentOrder = order;
       // Get the scheduler
       scheduler = Executors.newSingleThreadScheduledExecutor();
 
@@ -103,28 +90,25 @@
    public synchronized void registerDeployer(final Deployer Deployer) throws Exception
    {
       deployers.add(Deployer);
-      if (Deployer.getOrder() <= currentOrder)
+      Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(Deployer.getConfigFileName());
+      while (urls.hasMoreElements())
       {
-         Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(Deployer.getConfigFileName());
-         while (urls.hasMoreElements())
+         URL url = urls.nextElement();
+         if (!deployed.keySet().contains(url))
          {
-            URL url = urls.nextElement();
-            if (!deployed.keySet().contains(url))
-            {
-               deployed.put(url, new File(url.getFile()).lastModified());
-            }
-            try
-            {
-               log.info(new StringBuilder("Deploying ").append(Deployer).append(" with url").append(url));
-               Deployer.deploy(url);
+            deployed.put(url, new File(url.getFile()).lastModified());
+         }
+         try
+         {
+            log.info(new StringBuilder("Deploying ").append(Deployer).append(" with url").append(url));
+            Deployer.deploy(url);
 
-            }
-            catch (Exception e)
-            {
-               log.error(new StringBuilder("Error deploying ").append(url), e);
-            }
          }
-      }      
+         catch (Exception e)
+         {
+            log.error(new StringBuilder("Error deploying ").append(url), e);
+         }
+      }
    }
 
    public synchronized void unregisterDeployer(final Deployer Deployer)
@@ -152,7 +136,7 @@
       catch (Exception e)
       {
          log.warn("error scanning for URL's " + e);
-      }      
+      }
    }
 
    /**
@@ -161,47 +145,21 @@
     * @return a set of configurationUrls
     * @throws java.io.IOException .
     */
-   private Collection<ConfigurationURL> getUnstartedConfigurations(final int weight) throws IOException
+   private Collection<ConfigurationURL> getConfigurations() throws IOException
    {
       Map<String, ConfigurationURL> configurations = new HashMap<String, ConfigurationURL>();
       for (Deployer deployer : deployers)
       {
-         if (deployer.getOrder() <= weight && deployer.getOrder() > currentOrder)
-         {
-            Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(deployer.getConfigFileName());
+         Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(deployer.getConfigFileName());
 
-            if (!configurations.keySet().contains(deployer.getConfigFileName()))
-            {
-               ConfigurationURL conf = new ConfigurationURL(urls, deployer.getConfigFileName());
-               configurations.put(deployer.getConfigFileName(), conf);
-            }
-            else
-            {
-               configurations.get(deployer.getConfigFileName()).add(urls);
-            }
+         if (!configurations.keySet().contains(deployer.getConfigFileName()))
+         {
+            ConfigurationURL conf = new ConfigurationURL(urls, deployer.getConfigFileName());
+            configurations.put(deployer.getConfigFileName(), conf);
          }
-      }
-      return configurations.values();
-   }
-
-   private Collection<ConfigurationURL> getStartedConfigurations() throws IOException
-   {
-      Map<String, ConfigurationURL> configurations = new HashMap<String, ConfigurationURL>();
-      for (Deployer deployer : deployers)
-      {
-         if (deployer.getOrder() <= currentOrder)
+         else
          {
-            Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(deployer.getConfigFileName());
-
-            if (!configurations.keySet().contains(deployer.getConfigFileName()))
-            {
-               ConfigurationURL conf = new ConfigurationURL(urls, deployer.getConfigFileName());
-               configurations.put(deployer.getConfigFileName(), conf);
-            }
-            else
-            {
-               configurations.get(deployer.getConfigFileName()).add(urls);
-            }
+            configurations.get(deployer.getConfigFileName()).add(urls);
          }
       }
       return configurations.values();
@@ -215,7 +173,7 @@
     */
    private void scan() throws Exception
    {
-      Collection<ConfigurationURL> configurations = getStartedConfigurations();
+      Collection<ConfigurationURL> configurations = getConfigurations();
       for (ConfigurationURL configuration : configurations)
       {
          Iterator<URL> urls = configuration.getUrls();

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,6 +21,7 @@
    */
 package org.jboss.messaging.core.deployers.impl;
 
+import org.jboss.messaging.core.deployers.DeploymentManager;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.jboss.messaging.core.settings.impl.QueueSettings;
 import org.jboss.messaging.util.SimpleString;
@@ -49,9 +50,10 @@
 
    private final HierarchicalRepository<QueueSettings> queueSettingsRepository;
    
-   public QueueSettingsDeployer(final HierarchicalRepository<QueueSettings> queueSettingsRepository)
+   public QueueSettingsDeployer(final DeploymentManager deploymentManager, final HierarchicalRepository<QueueSettings> queueSettingsRepository)
    {
-   	this.queueSettingsRepository = queueSettingsRepository;
+   	super(deploymentManager);
+      this.queueSettingsRepository = queueSettingsRepository;
    }
    
    /**

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,15 +21,16 @@
    */
 package org.jboss.messaging.core.deployers.impl;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
+import org.jboss.messaging.core.deployers.DeploymentManager;
 import org.jboss.messaging.core.security.Role;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
 /**
  * Deploys the security settings into a security repository and adds them to the security store.
  *
@@ -54,8 +55,9 @@
     */
    private HierarchicalRepository<Set<Role>> securityRepository;
 
-   public SecurityDeployer(final HierarchicalRepository<Set<Role>> securityRepository)
+   public SecurityDeployer(final DeploymentManager deploymentManager, final HierarchicalRepository<Set<Role>> securityRepository)
    {
+      super(deploymentManager);
       this.securityRepository = securityRepository;
    }
 

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,12 +21,10 @@
    */
 package org.jboss.messaging.core.deployers.impl;
 
+import org.jboss.messaging.core.deployers.DeploymentManager;
+import org.jboss.messaging.core.security.JBMUpdateableSecurityManager;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-import org.jboss.messaging.core.security.JBMSecurityManager;
-import org.jboss.messaging.core.security.JBMUpdateableSecurityManager;
-import org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl;
-import org.jboss.messaging.core.server.MessagingServer;
 
 /**
  * deployer for adding security loaded from the file "jbm-security.xml"
@@ -35,11 +33,16 @@
 public class SecurityManagerDeployer extends XmlDeployer
 {
    private JBMUpdateableSecurityManager jbmSecurityManager;
-   private MessagingServer messagingServer;
+   private DeploymentManager deploymentManager;
    private static final String PASSWORD_ATTRIBUTE = "password";
    private static final String ROLES_NODE = "role";
    private static final String ROLE_ATTR_NAME = "name";
 
+   public SecurityManagerDeployer(final DeploymentManager deploymentManager)
+   {
+      super(deploymentManager);
+   }
+
    public String[] getElementTagName()
    {
       return new String[]{"user"};
@@ -84,22 +87,4 @@
    {
       this.jbmSecurityManager = jbmSecurityManager;
    }
-
-   public void setMessagingServer(MessagingServer messagingServer)
-   {
-      this.messagingServer = messagingServer;
-   }
-
-   //register with the deploymenmt manager
-   public void start() throws Exception
-   {
-      super.start();
-      messagingServer.getDeploymentManager().registerDeployer(this);
-   }
-   
-   public void stop() throws Exception
-   {
-      super.stop();
-      messagingServer.getDeploymentManager().unregisterDeployer(this);
-   }
 }

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,6 +21,15 @@
    */
 package org.jboss.messaging.core.deployers.impl;
 
+import org.jboss.messaging.core.deployers.Deployer;
+import org.jboss.messaging.core.deployers.DeploymentManager;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.server.MessagingComponent;
+import org.jboss.messaging.util.XMLUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.URL;
@@ -29,14 +38,6 @@
 import java.util.HashMap;
 import java.util.Set;
 
-import org.jboss.messaging.core.deployers.Deployer;
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingComponent;
-import org.jboss.messaging.util.XMLUtil;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
 /**
  * @author <a href="ataylor at redhat.com">Andy Taylor</a>
  */
@@ -47,6 +48,13 @@
 
    private HashMap<URL, HashMap<String, Node>> configuration = new HashMap<URL, HashMap<String, Node>>();
 
+
+   protected DeploymentManager deploymentManager;
+
+   public XmlDeployer(final DeploymentManager deploymentManager)
+   {
+      this.deploymentManager = deploymentManager;
+   }
    /**
     * adds a URL to the already configured set of url's this deployer is handling
     * @param url The URL to add
@@ -186,7 +194,7 @@
    //register with the deploymenmt manager
    public void start() throws Exception
    {
-
+      deploymentManager.registerDeployer(this);
    }
 
    //undeploy everything
@@ -207,6 +215,7 @@
             }
          }
       }
+      deploymentManager.unregisterDeployer(this);
    }
 
    /**

Modified: trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,10 +21,7 @@
  */
 package org.jboss.messaging.core.server;
 
-import java.util.Set;
-
 import org.jboss.messaging.core.config.Configuration;
-import org.jboss.messaging.core.deployers.DeploymentManager;
 import org.jboss.messaging.core.persistence.StorageManager;
 import org.jboss.messaging.core.postoffice.PostOffice;
 import org.jboss.messaging.core.remoting.PacketReturner;
@@ -39,6 +36,8 @@
 import org.jboss.messaging.core.version.Version;
 import org.jboss.messaging.util.ExecutorFactory;
 
+import java.util.Set;
+
 /**
  * This interface defines the internal interface of the Messaging Server exposed
  * to other components of the server.
@@ -85,8 +84,6 @@
 
    HierarchicalRepository<QueueSettings> getQueueSettingsRepository();
    
-   DeploymentManager getDeploymentManager();
-   
    ExecutorFactory getExecutorFactory();
    
    ResourceManager getResourceManager();

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,22 +21,9 @@
   */
 package org.jboss.messaging.core.server.impl;
 
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadFactory;
-
 import org.jboss.messaging.core.client.RemotingSessionListener;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.deployers.Deployer;
-import org.jboss.messaging.core.deployers.DeploymentManager;
-import org.jboss.messaging.core.deployers.impl.FileDeploymentManager;
-import org.jboss.messaging.core.deployers.impl.QueueSettingsDeployer;
-import org.jboss.messaging.core.deployers.impl.SecurityDeployer;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.memory.MemoryManager;
@@ -70,7 +57,11 @@
 import org.jboss.messaging.util.OrderedExecutorFactory;
 import org.jboss.messaging.util.VersionLoader;
 
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.*;
 
+
 /**
  * A Messaging Server
  *
@@ -104,9 +95,6 @@
    private RemotingSessionListener sessionListener;
    private MemoryManager memoryManager = new SimpleMemoryManager();
    private PostOffice postOffice;
-   private Deployer securityDeployer;
-   private Deployer queueSettingsDeployer;   
-   private DeploymentManager deploymentManager = new FileDeploymentManager();
    private ExecutorFactory executorFactory;
    private ExecutorService threadPool;
    private HierarchicalRepository<Set<Role>> securityRepository = new HierarchicalObjectRepository<Set<Role>>();
@@ -173,7 +161,6 @@
       securityRepository.setDefault(new HashSet<Role>());
       securityStore.setSecurityRepository(securityRepository);
       securityStore.setSecurityManager(securityManager);
-      securityDeployer = new SecurityDeployer(securityRepository);
       queueSettingsRepository.setDefault(new QueueSettings());
       scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(), new JBMThreadFactory("JBM-scheduled-threads"));
       queueFactory = new QueueFactoryImpl(scheduledExecutor, queueSettingsRepository);
@@ -182,7 +169,6 @@
       this.sessionListener = cm;
       memoryManager = new SimpleMemoryManager();
       postOffice = new PostOfficeImpl(storageManager, queueFactory, configuration.isRequireDestinations());
-      queueSettingsDeployer = new QueueSettingsDeployer(queueSettingsRepository);
       threadPool = Executors.newFixedThreadPool(configuration.getThreadPoolMaxSize(), new JBMThreadFactory("JBM-session-threads"));
       executorFactory = new OrderedExecutorFactory(threadPool);
 
@@ -191,14 +177,9 @@
          remotingService.start();
       }
       // Start the wired components
-      securityDeployer.start();
       remotingService.addRemotingSessionListener(sessionListener);
       memoryManager.start();
-      deploymentManager.start(1);
-      deploymentManager.registerDeployer(securityDeployer);
-      deploymentManager.registerDeployer(queueSettingsDeployer);
       postOffice.start();
-      deploymentManager.start(2);
       serverPacketHandler = new MessagingServerPacketHandler(this);
       getRemotingService().getDispatcher().register(serverPacketHandler);
       ClassLoader loader = Thread.currentThread().getContextClassLoader();
@@ -230,9 +211,6 @@
       started = false;
 
       // Stop the wired components
-      securityDeployer.stop();
-      queueSettingsDeployer.stop();
-      deploymentManager.stop();
       remotingService.removeRemotingSessionListener(sessionListener);
       connectionManager = null;
       memoryManager.stop();
@@ -283,11 +261,6 @@
       return remotingService;
    }
 
-   public DeploymentManager getDeploymentManager()
-   {
-      return deploymentManager;
-   }
-
    public ConnectionManager getConnectionManager()
    {
       return connectionManager;

Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,9 +21,9 @@
    */
 package org.jboss.messaging.jms.server.impl;
 
+import org.jboss.messaging.core.deployers.DeploymentManager;
 import org.jboss.messaging.core.deployers.impl.XmlDeployer;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.server.JMSServerManager;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -37,8 +37,6 @@
 
    private JMSServerManager jmsServerManager;
 
-   private MessagingServer messagingServer;
-
    private static final String CLIENTID_ELEMENT = "client-id";
    private static final String DUPS_OK_BATCH_SIZE_ELEMENT = "dups-ok-batch-size";
    private static final String CONSUMER_WINDOW_SIZE_ELEMENT = "consumer-window-size";
@@ -53,41 +51,17 @@
    private static final String QUEUE_NODE_NAME = "queue";
    private static final String TOPIC_NODE_NAME = "topic";
 
-   public void setJmsServerManager(JMSServerManager jmsServerManager)
+   public JMSServerDeployer(DeploymentManager deploymentManager)
    {
-      this.jmsServerManager = jmsServerManager;
+      super(deploymentManager);
    }
 
-   public void setMessagingServer(MessagingServer messagingServer)
+   public void setJmsServerManager(JMSServerManager jmsServerManager)
    {
-      this.messagingServer = messagingServer;
+      this.jmsServerManager = jmsServerManager;
    }
 
    /**
-    * lifecycle method
-    */
-   public void start() throws Exception
-   {
-      try
-      {
-         messagingServer.getDeploymentManager().registerDeployer(this);
-      }
-      catch (Exception e)
-      {
-         log.error(new StringBuilder("Unable to get Deployment Manager: ").append(e));
-      }
-   }
-
-   /**
-    * lifecycle method
-    */
-   public void stop() throws Exception
-   {
-      super.stop();
-      messagingServer.getDeploymentManager().unregisterDeployer(this);
-   }
-
-   /**
     * the names of the elements to deploy
     *
     * @return the names of the elements todeploy

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -157,6 +157,7 @@
       ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration("localhost", ConfigurationImpl.DEFAULT_PORT);
       config.getConnectionParams().setPingInterval(2000);
       config.getConnectionParams().setPingTimeout(1000);
+      config.setSecurityEnabled(false);
       server = new MessagingServerImpl(config);
       server.start();
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientExitTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientExitTest.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientExitTest.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,9 +21,7 @@
 */
 package org.jboss.messaging.tests.integration.core.remoting.impl;
 
-import static org.jboss.messaging.core.remoting.TransportType.TCP;
 import junit.framework.TestCase;
-
 import org.jboss.messaging.core.client.ClientConnection;
 import org.jboss.messaging.core.client.ClientConnectionFactory;
 import org.jboss.messaging.core.client.ClientConsumer;
@@ -33,6 +31,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.Message;
+import static org.jboss.messaging.core.remoting.TransportType.TCP;
 import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.impl.MessagingServerImpl;
 import org.jboss.messaging.tests.unit.core.remoting.impl.ConfigurationHelper;
@@ -102,6 +101,7 @@
    {
       ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration(
             "localhost", ConfigurationImpl.DEFAULT_PORT);
+      config.setSecurityEnabled(false);
       server = new MessagingServerImpl(config);
       server.start();
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/PacketFilterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/PacketFilterTest.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/PacketFilterTest.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -7,17 +7,8 @@
 
 package org.jboss.messaging.tests.integration.core.remoting.impl;
 
-import java.util.UUID;
-
 import junit.framework.TestCase;
-
-import org.jboss.messaging.core.client.ClientConnection;
-import org.jboss.messaging.core.client.ClientConnectionFactory;
-import org.jboss.messaging.core.client.ClientConsumer;
-import org.jboss.messaging.core.client.ClientMessage;
-import org.jboss.messaging.core.client.ClientProducer;
-import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.client.Location;
+import org.jboss.messaging.core.client.*;
 import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
 import org.jboss.messaging.core.client.impl.ClientMessageImpl;
 import org.jboss.messaging.core.client.impl.LocationImpl;
@@ -29,6 +20,8 @@
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.util.SimpleString;
 
+import java.util.UUID;
+
 public class PacketFilterTest  extends TestCase
 {
    Logger log = Logger.getLogger(PacketFilterTest.class);
@@ -47,7 +40,8 @@
    {
       ConfigurationImpl config = new ConfigurationImpl();
       config.setTransport(TransportType.TCP);
-      config.setHost("localhost");      
+      config.setHost("localhost");
+      config.setSecurityEnabled(false);
       server = new MessagingServerImpl(config);
       server.start();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/ssl/CoreClientOverSSLTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/ssl/CoreClientOverSSLTest.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/ssl/CoreClientOverSSLTest.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -21,9 +21,7 @@
  */
 package org.jboss.messaging.tests.integration.core.remoting.ssl;
 
-import static java.lang.Boolean.FALSE;
 import junit.framework.TestCase;
-
 import org.jboss.messaging.core.client.*;
 import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
 import org.jboss.messaging.core.client.impl.ConnectionParamsImpl;
@@ -36,6 +34,8 @@
 import org.jboss.messaging.tests.util.SpawnedVMSupport;
 import org.jboss.messaging.util.SimpleString;
 
+import static java.lang.Boolean.FALSE;
+
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  * 
@@ -118,6 +118,7 @@
    {
       ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration(
             "localhost", SSL_PORT);
+      config.setSecurityEnabled(false);
       config.setSSLEnabled(true);
       config.setKeyStorePath("messaging.keystore");
       config.setKeyStorePassword("secureexample");

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -23,8 +23,6 @@
 
 
 import junit.framework.TestCase;
-
-import org.jboss.messaging.core.deployers.Deployer;
 import org.jboss.messaging.core.deployers.impl.XmlDeployer;
 import org.jboss.messaging.util.XMLUtil;
 import org.w3c.dom.Element;
@@ -177,6 +175,11 @@
       ArrayList<String> contents = new ArrayList<String>();
       HashMap<String, Node> nodes = new HashMap<String, Node>();
 
+      public TestDeployer()
+      {
+         super(null);
+      }
+
       public HashMap<String, Node> getNodes()
       {
          return nodes;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueSettingsDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueSettingsDeployerTest.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueSettingsDeployerTest.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -22,17 +22,14 @@
 package org.jboss.messaging.tests.unit.core.deployers.impl;
 
 import junit.framework.TestCase;
-
 import org.easymock.EasyMock;
 import org.easymock.IArgumentMatcher;
+import org.jboss.messaging.core.deployers.DeploymentManager;
 import org.jboss.messaging.core.deployers.impl.QueueSettingsDeployer;
-import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.postoffice.impl.BindingImpl;
-import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.jboss.messaging.core.settings.impl.QueueSettings;
-import org.jboss.messaging.util.XMLUtil;
 import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.util.XMLUtil;
 
 /**
  * @author <a href="ataylor at redhat.com">Andy Taylor</a>
@@ -56,8 +53,8 @@
    protected void setUp() throws Exception
    {
       repository = EasyMock.createStrictMock(HierarchicalRepository.class);
-
-      queueSettingsDeployer = new QueueSettingsDeployer(repository);
+      DeploymentManager deploymentManager = EasyMock.createNiceMock(DeploymentManager.class);
+      queueSettingsDeployer = new QueueSettingsDeployer(deploymentManager, repository);
    }
 
    public void testDeploy() throws Exception

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityDeployerTest.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityDeployerTest.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -23,6 +23,7 @@
 
 import junit.framework.TestCase;
 import org.easymock.EasyMock;
+import org.jboss.messaging.core.deployers.DeploymentManager;
 import org.jboss.messaging.core.deployers.impl.SecurityDeployer;
 import org.jboss.messaging.core.security.Role;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
@@ -59,7 +60,8 @@
    protected void setUp() throws Exception
    {
       repository = EasyMock.createStrictMock(HierarchicalRepository.class);
-      deployer = new SecurityDeployer(EasyMock.createStrictMock(HierarchicalRepository.class));
+      DeploymentManager deploymentManager = EasyMock.createNiceMock(DeploymentManager.class);
+      deployer = new SecurityDeployer(deploymentManager, EasyMock.createStrictMock(HierarchicalRepository.class));
    }
 
    public void testSingle() throws Exception

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityManagerDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityManagerDeployerTest.java	2008-06-17 14:34:32 UTC (rev 4502)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/SecurityManagerDeployerTest.java	2008-06-17 14:44:52 UTC (rev 4503)
@@ -22,13 +22,13 @@
 package org.jboss.messaging.tests.unit.core.deployers.impl;
 
 import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.jboss.messaging.core.deployers.DeploymentManager;
 import org.jboss.messaging.core.deployers.impl.SecurityManagerDeployer;
-import org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl;
 import org.jboss.messaging.core.security.JBMUpdateableSecurityManager;
 import org.jboss.messaging.util.XMLUtil;
+import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-import org.w3c.dom.Node;
-import org.easymock.EasyMock;
 
 /**
  * tests SecurityManagerDeployer
@@ -60,7 +60,8 @@
 
    protected void setUp() throws Exception
    {
-      deployer = new SecurityManagerDeployer();
+      DeploymentManager deploymentManager = EasyMock.createNiceMock(DeploymentManager.class);
+      deployer = new SecurityManagerDeployer(deploymentManager);
    }
 
    protected void tearDown() throws Exception




More information about the jboss-cvs-commits mailing list