[jboss-cvs] JBoss Messaging SVN: r3651 - in trunk: src/etc/server/default/deploy and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 31 04:47:03 EST 2008


Author: ataylor
Date: 2008-01-31 04:47:03 -0500 (Thu, 31 Jan 2008)
New Revision: 3651

Added:
   trunk/src/main/org/jboss/jms/server/plugin/NullUserManager.java
   trunk/src/main/org/jboss/messaging/core/FileConfiguration.java
   trunk/src/main/org/jboss/messaging/core/NullPersistenceManager.java
Modified:
   trunk/docs/examples/embedded/src/org/jboss/example/embedded/MessagingServerFactory.java
   trunk/src/etc/server/default/deploy/jbm-beans.xml
   trunk/src/main/org/jboss/messaging/core/Configuration.java
   trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java
   trunk/tests/src/org/jboss/jms/server/test/unit/ConfigurationTest.java
Log:
added nullusermanager and nullpersistence manager. also extended configuration with fileconfiguration.

Modified: trunk/docs/examples/embedded/src/org/jboss/example/embedded/MessagingServerFactory.java
===================================================================
--- trunk/docs/examples/embedded/src/org/jboss/example/embedded/MessagingServerFactory.java	2008-01-30 22:51:49 UTC (rev 3650)
+++ trunk/docs/examples/embedded/src/org/jboss/example/embedded/MessagingServerFactory.java	2008-01-31 09:47:03 UTC (rev 3651)
@@ -36,49 +36,15 @@
  * @author <a href="ataylor at redhat.com">Andy Taylor</a>
  */
 public class MessagingServerFactory
-{
-   private static final String HOME_DIR = System.getProperty("user.home");
-   
+{   
    public static MessagingServer createMessagingServer(RemotingConfiguration remotingConf) throws Exception
    {
       MinaService minaService = new MinaService(remotingConf);
       minaService.start();
       MessagingServerImpl messagingServer = new MessagingServerImpl();
-      
       messagingServer.setRemotingService(minaService);
-      Configuration configuration = new Configuration();
-      configuration.setMessagingServerID(0);
-      messagingServer.setConfiguration(configuration);
-      messagingServer.setJmsUserManager(new JMSUserManager()
-      {
-         public String getPreConfiguredClientID(String username) throws Exception
-         {
-            return "0";
-         }
 
-         public void start() throws Exception
-         {
-            //To change body of implemented methods use File | Settings | File Templates.
-         }
-
-         public void stop() throws Exception
-         {
-            //To change body of implemented methods use File | Settings | File Templates.
-         }
-      });
-      BDBJEPersistenceManager persistenceManager = new BDBJEPersistenceManager();
-      persistenceManager.setLargeMessageRepository( HOME_DIR + "/bdbje/large");
-      persistenceManager.setMinLargeMessageSize(1000000);
-      BDBJEEnvironment bdbjeEnvironment = new RealBDBJEEnvironment();
-      bdbjeEnvironment.setEnvironmentPath(HOME_DIR + "/bdbje/env");
-      bdbjeEnvironment.setCreateEnvironment(true);
-      bdbjeEnvironment.setSyncVM(true);
-      bdbjeEnvironment.setSyncOS(false);
-      bdbjeEnvironment.setMemoryCacheSize(-1);
-      persistenceManager.setEnvironment(bdbjeEnvironment);
-      bdbjeEnvironment.start();
-      persistenceManager.start();
-      messagingServer.setPersistenceManager(persistenceManager);
+   
       return messagingServer;
    }
    

Modified: trunk/src/etc/server/default/deploy/jbm-beans.xml
===================================================================
--- trunk/src/etc/server/default/deploy/jbm-beans.xml	2008-01-30 22:51:49 UTC (rev 3650)
+++ trunk/src/etc/server/default/deploy/jbm-beans.xml	2008-01-31 09:47:03 UTC (rev 3651)
@@ -2,7 +2,7 @@
 
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
-   <bean name="Configuration" class="org.jboss.messaging.core.Configuration"/>
+   <bean name="Configuration" class="org.jboss.messaging.core.FileConfiguration"/>
 
    <bean name="ServiceLocator" class="org.jboss.messaging.microcontainer.ServiceLocator">
       <demand>jboss.jca:name=DefaultDS,service=DataSourceBinding</demand>

Added: trunk/src/main/org/jboss/jms/server/plugin/NullUserManager.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/plugin/NullUserManager.java	                        (rev 0)
+++ trunk/src/main/org/jboss/jms/server/plugin/NullUserManager.java	2008-01-31 09:47:03 UTC (rev 3651)
@@ -0,0 +1,45 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005, JBoss Inc., and individual contributors as indicated
+   * by the @authors tag. See the copyright.txt in the distribution for a
+   * full listing of individual contributors.
+   *
+   * This is free software; you can redistribute it and/or modify it
+   * under the terms of the GNU Lesser General Public License as
+   * published by the Free Software Foundation; either version 2.1 of
+   * the License, or (at your option) any later version.
+   *
+   * This software is distributed in the hope that it will be useful,
+   * but WITHOUT ANY WARRANTY; without even the implied warranty of
+   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   * Lesser General Public License for more details.
+   *
+   * You should have received a copy of the GNU Lesser General Public
+   * License along with this software; if not, write to the Free
+   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+   */
+package org.jboss.jms.server.plugin;
+
+import org.jboss.jms.server.plugin.contract.JMSUserManager;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class NullUserManager implements JMSUserManager
+{
+   public String getPreConfiguredClientID(String username) throws Exception
+   {
+      return null;
+   }
+
+   public void start() throws Exception
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public void stop() throws Exception
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+}

Modified: trunk/src/main/org/jboss/messaging/core/Configuration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/Configuration.java	2008-01-30 22:51:49 UTC (rev 3650)
+++ trunk/src/main/org/jboss/messaging/core/Configuration.java	2008-01-31 09:47:03 UTC (rev 3651)
@@ -55,175 +55,52 @@
 public class Configuration implements Serializable
 {
    private static final long serialVersionUID = -95502236335483837L;
-   
-   private static final String READ_ATTR = "read";
-   private static final String WRITE_ATTR = "write";
-   private static final String CREATE_ATTR = "create";
-   private static final String NAME_ATTR = "name";
 
+
    private PropertyChangeSupport propertyChangeSupport;
-   private Integer messagingServerID = -1;
-   private String _defaultQueueJNDIContext = "";
-   private String _defaultTopicJNDIContext = "";
-   private String _securityDomain;
-   private HashSet<Role> _securityConfig;
-   private List<String> defaultInterceptors;
-   private String _defaultDLQ;
+   protected Integer messagingServerID = -1;
+   protected String _defaultQueueJNDIContext = "";
+   protected String _defaultTopicJNDIContext = "";
+   protected String _securityDomain;
+   protected HashSet<Role> _securityConfig;
+   protected List<String> defaultInterceptors;
+   protected String _defaultDLQ;
    // The default maximum number of delivery attempts before sending to DLQ - can be overridden on
    // the destination
-   private Integer _defaultMaxDeliveryAttempts = 10;
+   protected Integer _defaultMaxDeliveryAttempts = 10;
    protected String _defaultExpiryQueue;
 
-   private Long _defaultRedeliveryDelay = (long) 0;
+   protected Long _defaultRedeliveryDelay = (long) 0;
 
-   private Long _messageCounterSamplePeriod = (long) 10000;// Default is 1 minute
+   protected Long _messageCounterSamplePeriod = (long) 10000;// Default is 1 minute
 
-   private Integer _defaultMessageCounterHistoryDayLimit = 1;
+   protected Integer _defaultMessageCounterHistoryDayLimit = 1;
 
    //Global override for strict behaviour
-   private Boolean _strictTck = false;
+   protected Boolean _strictTck = false;
 
-   //From a system property - this overrides
-   private Boolean _strictTckProperty = false;
+   protected String _postOfficeName;
 
-   private String _postOfficeName;
+   protected Boolean _clustered = false;
 
-   private Boolean _clustered = false;
+   protected Long _stateTimeout = (long) 5000;
 
-   private Long _stateTimeout = (long) 5000;
+   protected Long _castTimeout = (long) 5000;
 
-   private Long _castTimeout = (long) 5000;
+   protected String _groupName;
 
-   private String _groupName;
+   protected String _controlChannelName;
 
-   private String _controlChannelName;
+   protected String _dataChannelName;
 
-   private String _dataChannelName;
+   protected String _channelPartitionName;
 
-   private String _channelPartitionName;
+   protected TransportType _remotingTransport = TCP;
 
-   private TransportType _remotingTransport = TCP;
-
-   private Integer _remotingBindAddress;
+   protected Integer _remotingBindAddress;
    
-   private Integer _remotingTimeout;
+   protected Integer _remotingTimeout;
 
-   //default confog file location
-   private String configurationUrl = "jbm-configuration.xml";
-
-   public void start() throws Exception
-   {
-      propertyChangeSupport = new PropertyChangeSupport(this);
-
-      _strictTckProperty = "true".equalsIgnoreCase(System.getProperty("jboss.messaging.stricttck"));
-
-      URL url = getClass().getClassLoader().getResource(configurationUrl);
-      Element e = XMLUtil.urlToElement(url);
-      messagingServerID = getInteger(e, "server-peer-id", messagingServerID);
-      _defaultQueueJNDIContext = getString(e, "default-queue-jndi-context", _defaultQueueJNDIContext);
-      _defaultTopicJNDIContext = getString(e, "default-topic-jndi-context", _defaultTopicJNDIContext);
-      _securityDomain = getString(e, "security-domain", _securityDomain);
-      _defaultDLQ = getString(e, "default-dlq", _defaultDLQ);
-      _defaultMaxDeliveryAttempts = getInteger(e, "default-max-delivery-attempts", _defaultMaxDeliveryAttempts);
-      _defaultExpiryQueue = getString(e, "default-expiry-queue", _defaultExpiryQueue);
-      _defaultRedeliveryDelay = getLong(e, "default-redelivery-delay", _defaultRedeliveryDelay);
-      _messageCounterSamplePeriod = getLong(e, "message-counter-sample-period", _messageCounterSamplePeriod);
-      _defaultMessageCounterHistoryDayLimit = getInteger(e, "default-message-counter-history-day-limit", _defaultMessageCounterHistoryDayLimit);
-      _strictTck = getBoolean(e, "strict-tck", _strictTck);
-      _postOfficeName = getString(e, "post-office-name", _postOfficeName);
-      _clustered = getBoolean(e, "clustered", _clustered);
-      _stateTimeout = getLong(e, "state-timeout", _stateTimeout);
-      _castTimeout = getLong(e, "cast-timeout", _castTimeout);
-      _groupName = getString(e, "group-name", _groupName);
-      _controlChannelName = getString(e, "control-channel-name", _controlChannelName);
-      _dataChannelName = getString(e, "data-channel-name", _dataChannelName);
-      _channelPartitionName = getString(e, "channel-partition-name", _channelPartitionName);
-      _remotingTransport = TransportType.valueOf(getString(e, "remoting-transport", _remotingTransport.name()));
-      _remotingBindAddress = getInteger(e, "remoting-bind-address", _remotingBindAddress);
-      _remotingTimeout = getInteger(e, "remoting-timeout", _remotingTimeout);
-      NodeList security = e.getElementsByTagName("default-security-config");
-      if (security.getLength() > 0)
-      {
-         HashSet<Role> securityConfig;
-         securityConfig = new HashSet<Role>();
-         NodeList roles = security.item(0).getChildNodes();
-         for (int k = 0; k < roles.getLength(); k++)
-         {
-            if ("role".equalsIgnoreCase(roles.item(k).getNodeName()))
-            {
-               Boolean read = roles.item(k).getAttributes().getNamedItem(READ_ATTR) != null && Boolean.valueOf(roles.item(k).getAttributes().getNamedItem(READ_ATTR).getNodeValue());
-               Boolean write = roles.item(k).getAttributes().getNamedItem(WRITE_ATTR) != null && Boolean.valueOf(roles.item(k).getAttributes().getNamedItem(WRITE_ATTR).getNodeValue());
-               Boolean create = roles.item(k).getAttributes().getNamedItem(CREATE_ATTR) != null && Boolean.valueOf(roles.item(k).getAttributes().getNamedItem(CREATE_ATTR).getNodeValue());
-               Role role = new Role(roles.item(k).getAttributes().getNamedItem(NAME_ATTR).getNodeValue(),
-                     read,
-                     write,
-                     create);
-               securityConfig.add(role);
-            }
-         }
-         _securityConfig = securityConfig;
-      }
-      
-      NodeList defaultInterceptors = e.getElementsByTagName("default-interceptors-config");
-
-      ArrayList<String> interceptorList = new ArrayList<String>();
-      if (defaultInterceptors.getLength() > 0)
-      {
-         
-         NodeList interceptors = defaultInterceptors.item(0).getChildNodes();
-         for (int k = 0; k < interceptors.getLength(); k++)
-         {
-            if ("interceptor".equalsIgnoreCase(interceptors.item(k).getNodeName()))
-            {
-               String clazz = interceptors.item(k).getAttributes().getNamedItem("class").getNodeValue();
-               interceptorList.add(clazz);
-            }
-         }
-      }
-      this.defaultInterceptors = interceptorList;
-      
-   }
-
-   private  Boolean getBoolean(Element e, String name, Boolean def)
-   {
-      NodeList nl = e.getElementsByTagName(name);
-      if (nl.getLength() > 0)
-      {
-         return Boolean.valueOf(nl.item(0).getTextContent().trim());
-      }
-      return def;
-   }
-
-   private  Integer getInteger(Element e, String name, Integer def)
-   {
-      NodeList nl = e.getElementsByTagName(name);
-      if (nl.getLength() > 0)
-      {
-         return Integer.valueOf(nl.item(0).getTextContent().trim());
-      }
-      return def;
-   }
-
-   private  Long getLong(Element e, String name, Long def)
-   {
-      NodeList nl = e.getElementsByTagName(name);
-      if (nl.getLength() > 0)
-      {
-         return Long.valueOf(nl.item(0).getTextContent().trim());
-      }
-      return def;
-   }
-
-   private  String getString(Element e, String name, String def)
-   {
-      NodeList nl = e.getElementsByTagName(name);
-      if (nl.getLength() > 0)
-      {
-         return nl.item(0).getTextContent().trim();
-      }
-      return def;
-   }
-
    public  void addPropertyChangeListener(
          PropertyChangeListener listener)
    {
@@ -361,12 +238,12 @@
 
    public  Boolean isStrictTck()
    {
-      return _strictTck || _strictTckProperty;
+      return _strictTck || "true".equalsIgnoreCase(System.getProperty("jboss.messaging.stricttck"));
    }
 
    public  void setStrictTck(Boolean strictTck)
    {
-      _strictTck = strictTck || _strictTckProperty;
+      _strictTck = strictTck || "true".equalsIgnoreCase(System.getProperty("jboss.messaging.stricttck"));
    }
 
    public  String getPostOfficeName()
@@ -452,12 +329,12 @@
       _channelPartitionName = channelPartitionName;
    }
 
-   public int getRemotingBindAddress()
+   public Integer getRemotingBindAddress()
    {
       return _remotingBindAddress;
    }
 
-   public void setRemotingBindAddress(int remotingBindAddress)
+   public void setRemotingBindAddress(Integer remotingBindAddress)
    {
       this._remotingBindAddress = remotingBindAddress;
    }
@@ -469,14 +346,5 @@
       return configuration;
    }
 
-   public String getConfigurationUrl()
-   {
-      return configurationUrl;
-   }
-
-   public void setConfigurationUrl(String configurationUrl)
-   {
-      this.configurationUrl = configurationUrl;
-   }
 }
  

Added: trunk/src/main/org/jboss/messaging/core/FileConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/FileConfiguration.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/FileConfiguration.java	2008-01-31 09:47:03 UTC (rev 3651)
@@ -0,0 +1,170 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005, JBoss Inc., and individual contributors as indicated
+   * by the @authors tag. See the copyright.txt in the distribution for a
+   * full listing of individual contributors.
+   *
+   * This is free software; you can redistribute it and/or modify it
+   * under the terms of the GNU Lesser General Public License as
+   * published by the Free Software Foundation; either version 2.1 of
+   * the License, or (at your option) any later version.
+   *
+   * This software is distributed in the hope that it will be useful,
+   * but WITHOUT ANY WARRANTY; without even the implied warranty of
+   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   * Lesser General Public License for more details.
+   *
+   * You should have received a copy of the GNU Lesser General Public
+   * License along with this software; if not, write to the Free
+   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+   */
+package org.jboss.messaging.core;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.core.remoting.TransportType;
+import org.jboss.jms.server.security.Role;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.ArrayList;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * This class allows the Configuration class to be configured via a config file.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class FileConfiguration extends Configuration
+{
+
+   private static final String READ_ATTR = "read";
+   private static final String WRITE_ATTR = "write";
+   private static final String CREATE_ATTR = "create";
+   private static final String NAME_ATTR = "name";
+
+   //default confog file location
+   private String configurationUrl = "jbm-configuration.xml";
+
+   public void start() throws Exception
+   {
+
+      URL url = getClass().getClassLoader().getResource(configurationUrl);
+      Element e = XMLUtil.urlToElement(url);
+      messagingServerID = getInteger(e, "server-peer-id", messagingServerID);
+      _defaultQueueJNDIContext = getString(e, "default-queue-jndi-context", _defaultQueueJNDIContext);
+      _defaultTopicJNDIContext = getString(e, "default-topic-jndi-context", _defaultTopicJNDIContext);
+      _securityDomain = getString(e, "security-domain", _securityDomain);
+      _defaultDLQ = getString(e, "default-dlq", _defaultDLQ);
+      _defaultMaxDeliveryAttempts = getInteger(e, "default-max-delivery-attempts", _defaultMaxDeliveryAttempts);
+      _defaultExpiryQueue = getString(e, "default-expiry-queue", _defaultExpiryQueue);
+      _defaultRedeliveryDelay = getLong(e, "default-redelivery-delay", _defaultRedeliveryDelay);
+      _messageCounterSamplePeriod = getLong(e, "message-counter-sample-period", _messageCounterSamplePeriod);
+      _defaultMessageCounterHistoryDayLimit = getInteger(e, "default-message-counter-history-day-limit", _defaultMessageCounterHistoryDayLimit);
+      _strictTck = getBoolean(e, "strict-tck", _strictTck);
+      _postOfficeName = getString(e, "post-office-name", _postOfficeName);
+      _clustered = getBoolean(e, "clustered", _clustered);
+      _stateTimeout = getLong(e, "state-timeout", _stateTimeout);
+      _castTimeout = getLong(e, "cast-timeout", _castTimeout);
+      _groupName = getString(e, "group-name", _groupName);
+      _controlChannelName = getString(e, "control-channel-name", _controlChannelName);
+      _dataChannelName = getString(e, "data-channel-name", _dataChannelName);
+      _channelPartitionName = getString(e, "channel-partition-name", _channelPartitionName);
+      _remotingTransport = TransportType.valueOf(getString(e, "remoting-transport", _remotingTransport.name()));
+      _remotingBindAddress = getInteger(e, "remoting-bind-address", _remotingBindAddress);
+      _remotingTimeout = getInteger(e, "remoting-timeout", _remotingTimeout);
+      NodeList security = e.getElementsByTagName("default-security-config");
+      if (security.getLength() > 0)
+      {
+         HashSet<Role> securityConfig;
+         securityConfig = new HashSet<Role>();
+         NodeList roles = security.item(0).getChildNodes();
+         for (int k = 0; k < roles.getLength(); k++)
+         {
+            if ("role".equalsIgnoreCase(roles.item(k).getNodeName()))
+            {
+               Boolean read = roles.item(k).getAttributes().getNamedItem(READ_ATTR) != null && Boolean.valueOf(roles.item(k).getAttributes().getNamedItem(READ_ATTR).getNodeValue());
+               Boolean write = roles.item(k).getAttributes().getNamedItem(WRITE_ATTR) != null && Boolean.valueOf(roles.item(k).getAttributes().getNamedItem(WRITE_ATTR).getNodeValue());
+               Boolean create = roles.item(k).getAttributes().getNamedItem(CREATE_ATTR) != null && Boolean.valueOf(roles.item(k).getAttributes().getNamedItem(CREATE_ATTR).getNodeValue());
+               Role role = new Role(roles.item(k).getAttributes().getNamedItem(NAME_ATTR).getNodeValue(),
+                       read,
+                       write,
+                       create);
+               securityConfig.add(role);
+            }
+         }
+         _securityConfig = securityConfig;
+      }
+
+            NodeList defaultInterceptors = e.getElementsByTagName("default-interceptors-config");
+
+      ArrayList<String> interceptorList = new ArrayList<String>();
+      if (defaultInterceptors.getLength() > 0)
+      {
+
+         NodeList interceptors = defaultInterceptors.item(0).getChildNodes();
+         for (int k = 0; k < interceptors.getLength(); k++)
+         {
+            if ("interceptor".equalsIgnoreCase(interceptors.item(k).getNodeName()))
+            {
+               String clazz = interceptors.item(k).getAttributes().getNamedItem("class").getNodeValue();
+               interceptorList.add(clazz);
+            }
+         }
+      }
+      this.defaultInterceptors = interceptorList;
+   }
+
+   private Boolean getBoolean(Element e, String name, Boolean def)
+   {
+      NodeList nl = e.getElementsByTagName(name);
+      if (nl.getLength() > 0)
+      {
+         return Boolean.valueOf(nl.item(0).getTextContent().trim());
+      }
+      return def;
+   }
+
+   private Integer getInteger(Element e, String name, Integer def)
+   {
+      NodeList nl = e.getElementsByTagName(name);
+      if (nl.getLength() > 0)
+      {
+         return Integer.valueOf(nl.item(0).getTextContent().trim());
+      }
+      return def;
+   }
+
+   private Long getLong(Element e, String name, Long def)
+   {
+      NodeList nl = e.getElementsByTagName(name);
+      if (nl.getLength() > 0)
+      {
+         return Long.valueOf(nl.item(0).getTextContent().trim());
+      }
+      return def;
+   }
+
+   private String getString(Element e, String name, String def)
+   {
+      NodeList nl = e.getElementsByTagName(name);
+      if (nl.getLength() > 0)
+      {
+         return nl.item(0).getTextContent().trim();
+      }
+      return def;
+   }
+
+
+   public String getConfigurationUrl()
+   {
+      return configurationUrl;
+   }
+
+   public void setConfigurationUrl(String configurationUrl)
+   {
+      this.configurationUrl = configurationUrl;
+   }
+}

Added: trunk/src/main/org/jboss/messaging/core/NullPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/NullPersistenceManager.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/NullPersistenceManager.java	2008-01-31 09:47:03 UTC (rev 3651)
@@ -0,0 +1,117 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005, JBoss Inc., and individual contributors as indicated
+   * by the @authors tag. See the copyright.txt in the distribution for a
+   * full listing of individual contributors.
+   *
+   * This is free software; you can redistribute it and/or modify it
+   * under the terms of the GNU Lesser General Public License as
+   * published by the Free Software Foundation; either version 2.1 of
+   * the License, or (at your option) any later version.
+   *
+   * This software is distributed in the hope that it will be useful,
+   * but WITHOUT ANY WARRANTY; without even the implied warranty of
+   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   * Lesser General Public License for more details.
+   *
+   * You should have received a copy of the GNU Lesser General Public
+   * License along with this software; if not, write to the Free
+   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+   */
+package org.jboss.messaging.core;
+
+import javax.transaction.xa.Xid;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class NullPersistenceManager implements PersistenceManager
+{
+   public long generateMessageID()
+   {
+      return 0;
+   }
+
+   public void addMessage(Message message) throws Exception
+   {
+
+   }
+
+   public void deleteReference(MessageReference reference) throws Exception
+   {
+
+   }
+
+   public void commitTransaction(List<Message> messagesToAdd, List<MessageReference> referencesToRemove) throws Exception
+   {
+
+   }
+
+   public void prepareTransaction(Xid xid, List<Message> messagesToAdd, List<MessageReference> referencesToRemove) throws Exception
+   {
+
+   }
+
+   public void commitPreparedTransaction(Xid xid) throws Exception
+   {
+
+   }
+
+   public void unprepareTransaction(Xid xid, List<Message> messagesToAdd, List<MessageReference> referencesToRemove) throws Exception
+   {
+
+   }
+
+   public void updateDeliveryCount(Queue queue, MessageReference ref) throws Exception
+   {
+
+   }
+
+   public void deleteAllReferences(Queue queue) throws Exception
+   {
+
+   }
+
+   public List<Xid> getInDoubtXids() throws Exception
+   {
+      return new ArrayList<Xid>();
+   }
+
+   public boolean isInRecoveryMode() throws Exception
+   {
+      return false;
+   }
+
+   public void setInRecoveryMode(boolean recoveryMode)
+   {
+
+   }
+
+   public List<Binding> loadBindings(QueueFactory queueFactory) throws Exception
+   {
+      return new ArrayList<Binding>();
+   }
+
+   public void addBinding(Binding binding) throws Exception
+   {
+
+   }
+
+   public void deleteBinding(Binding binding) throws Exception
+   {
+
+   }
+
+   public void start() throws Exception
+   {
+
+   }
+
+   public void stop() throws Exception
+   {
+      
+   }
+}

Modified: trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java	2008-01-30 22:51:49 UTC (rev 3650)
+++ trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java	2008-01-31 09:47:03 UTC (rev 3651)
@@ -38,20 +38,12 @@
 import org.jboss.jms.server.endpoint.ConnectionFactoryAdvisedPacketHandler;
 import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
 import org.jboss.jms.server.plugin.contract.JMSUserManager;
+import org.jboss.jms.server.plugin.NullUserManager;
 import org.jboss.jms.server.security.Role;
 import org.jboss.jms.server.security.SecurityMetadataStore;
 import org.jboss.jms.server.security.NullAuthenticationManager;
 import org.jboss.logging.Logger;
-import org.jboss.messaging.core.Binding;
-import org.jboss.messaging.core.Condition;
-import org.jboss.messaging.core.Configuration;
-import org.jboss.messaging.core.DestinationType;
-import org.jboss.messaging.core.MemoryManager;
-import org.jboss.messaging.core.MessagingServer;
-import org.jboss.messaging.core.PersistenceManager;
-import org.jboss.messaging.core.PostOffice;
-import org.jboss.messaging.core.Queue;
-import org.jboss.messaging.core.QueueSettings;
+import org.jboss.messaging.core.*;
 import org.jboss.messaging.core.impl.ConditionImpl;
 import org.jboss.messaging.core.impl.QueueFactoryImpl;
 import org.jboss.messaging.core.impl.memory.SimpleMemoryManager;
@@ -113,15 +105,15 @@
 
    // plugins
 
-   private PersistenceManager persistenceManager;
+   private PersistenceManager persistenceManager = new NullPersistenceManager();
 
-   private JMSUserManager jmsUserManager;
+   private JMSUserManager jmsUserManager = new NullUserManager();
 
    private RemotingService remotingService;
 
-   private Configuration configuration;
-   private HierarchicalObjectRepository<HashSet<Role>> securityRepository = new HierarchicalObjectRepository<HashSet<Role>>();
-   private HierarchicalObjectRepository<QueueSettings> queueSettingsRepository = new HierarchicalObjectRepository<QueueSettings>();
+   private Configuration configuration = new Configuration();
+   private HierarchicalRepository<HashSet<Role>> securityRepository = new HierarchicalObjectRepository<HashSet<Role>>();
+   private HierarchicalRepository<QueueSettings> queueSettingsRepository = new HierarchicalObjectRepository<QueueSettings>();
    private QueueFactoryImpl queueFactory = new QueueFactoryImpl();
 
    // Constructors ---------------------------------------------------------------------------------
@@ -490,12 +482,18 @@
       return securityRepository;
    }
 
+   public HierarchicalRepository<QueueSettings> getQueueSettingsRepository()
+   {
+      return queueSettingsRepository;
+   }
 
    public void setAuthenticationManager(AuthenticationManager authenticationManager)
    {
       this.authenticationManager = authenticationManager;
    }
 
+
+
    public String toString()
    {
       return "MessagingServer[" + configuration.getMessagingServerID() + "]";

Modified: trunk/tests/src/org/jboss/jms/server/test/unit/ConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/jms/server/test/unit/ConfigurationTest.java	2008-01-30 22:51:49 UTC (rev 3650)
+++ trunk/tests/src/org/jboss/jms/server/test/unit/ConfigurationTest.java	2008-01-31 09:47:03 UTC (rev 3651)
@@ -29,6 +29,7 @@
 
 import org.jboss.jms.server.security.Role;
 import org.jboss.messaging.core.Configuration;
+import org.jboss.messaging.core.FileConfiguration;
 import org.jboss.messaging.core.remoting.RemotingConfiguration;
 import org.jboss.messaging.core.remoting.TransportType;
 
@@ -37,11 +38,11 @@
  */
 public class ConfigurationTest extends TestCase
 {
-   private Configuration configuration;
+   private FileConfiguration configuration;
 
    protected void setUp() throws Exception
    {
-      configuration = new Configuration();
+      configuration = new FileConfiguration();
       configuration.setConfigurationUrl("ConfigurationTest-config.xml");
       configuration.start();
    }
@@ -179,7 +180,7 @@
       assertEquals("failed to set channel partition name", "JMStest", configuration.getChannelPartitionName());
    }
 
-   public void testSetRemotingConfiguration() throws Exception
+   public void testSetRemoteBindAddress() throws Exception
    {
       RemotingConfiguration remotingConfig = configuration.getRemotingConfiguration();
       assertEquals(TransportType.TCP, remotingConfig.getTransport());




More information about the jboss-cvs-commits mailing list