qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ai...@apache.org
Subject svn commit: r764428 [1/2] - in /qpid/branches/0.5-fix/qpid/java/broker/src: main/java/org/apache/qpid/server/ main/java/org/apache/qpid/server/configuration/ main/java/org/apache/qpid/server/exchange/ main/java/org/apache/qpid/server/handler/ main/java...
Date Mon, 13 Apr 2009 12:42:40 GMT
Author: aidan
Date: Mon Apr 13 12:42:38 2009
New Revision: 764428

URL: http://svn.apache.org/viewvc?rev=764428&view=rev
Log:
QPID-1621: add ServerConfiguration, QueueConfiguration and SecurityConfiguration classes. Move almost all uses of o.a.commons.configuration.Configuration
behind there. 

@Configured delenda est


Modified:
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/IncomingMessage.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLManager.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/ConfigurationFilePrincipalDatabaseManager.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PrincipalDatabaseManager.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabaseManager.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MemoryMessageStore.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/store/MessageStore.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/util/NullApplicationRegistry.java
    qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/ack/TxAckTest.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/ACLManagerTest.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/PrincipalPermissionsTest.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/plugins/network/FirewallPluginTest.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/store/SkeletonMessageStore.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java
    qpid/branches/0.5-fix/qpid/java/broker/src/test/java/org/apache/qpid/server/util/TestApplicationRegistry.java

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java Mon Apr 13 12:42:38 2009
@@ -42,12 +42,8 @@
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
-import org.apache.commons.configuration.Configuration;
-
 import org.apache.qpid.AMQException;
 import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.configuration.Configurator;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
 import org.apache.qpid.server.exchange.Exchange;
 import org.apache.qpid.server.exchange.ExchangeFactory;
 import org.apache.qpid.server.exchange.ExchangeRegistry;
@@ -56,9 +52,9 @@
 import org.apache.qpid.server.management.MBeanDescription;
 import org.apache.qpid.server.management.ManagedBroker;
 import org.apache.qpid.server.management.ManagedObject;
-import org.apache.qpid.server.queue.QueueRegistry;
 import org.apache.qpid.server.queue.AMQQueue;
 import org.apache.qpid.server.queue.AMQQueueFactory;
+import org.apache.qpid.server.queue.QueueRegistry;
 import org.apache.qpid.server.store.MessageStore;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java Mon Apr 13 12:42:38 2009
@@ -20,6 +20,14 @@
  */
 package org.apache.qpid.server;
 
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.framing.AMQShortString;
@@ -29,7 +37,6 @@
 import org.apache.qpid.framing.abstraction.MessagePublishInfo;
 import org.apache.qpid.server.ack.UnacknowledgedMessageMap;
 import org.apache.qpid.server.ack.UnacknowledgedMessageMapImpl;
-import org.apache.qpid.server.configuration.Configurator;
 import org.apache.qpid.server.exchange.Exchange;
 import org.apache.qpid.server.exchange.NoRouteException;
 import org.apache.qpid.server.flow.FlowCreditManager;
@@ -51,14 +58,6 @@
 import org.apache.qpid.server.txn.NonTransactionalContext;
 import org.apache.qpid.server.txn.TransactionalContext;
 
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-
 public class AMQChannel
 {
     public static final int DEFAULT_PREFETCH = 5000;
@@ -117,9 +116,6 @@
     public AMQChannel(AMQProtocolSession session, int channelId, MessageStore messageStore)
             throws AMQException
     {
-        //Set values from configuration
-        Configurator.configure(this);
-
         _session = session;
         _channelId = channelId;
         _storeContext = new StoreContext("Session: " + session.getClientIdentifier() + "; channel: " + channelId);

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java Mon Apr 13 12:42:38 2009
@@ -20,6 +20,12 @@
  */
 package org.apache.qpid.server;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.BindException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Option;
@@ -27,36 +33,23 @@
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.PosixParser;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Logger;
 import org.apache.log4j.xml.DOMConfigurator;
 import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.FixedSizeByteBufferAllocator;
+import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
 import org.apache.mina.transport.socket.nio.SocketSessionConfig;
-import org.apache.qpid.AMQException;
+import org.apache.mina.util.NewThreadExecutor;
 import org.apache.qpid.common.QpidProperties;
 import org.apache.qpid.framing.ProtocolVersion;
 import org.apache.qpid.pool.ReadWriteThreadModel;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
-import org.apache.qpid.server.management.JMXManagedObjectRegistry;
+import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.protocol.AMQPFastProtocolHandler;
 import org.apache.qpid.server.protocol.AMQPProtocolProvider;
 import org.apache.qpid.server.registry.ApplicationRegistry;
 import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
-import org.apache.qpid.server.transport.ConnectorConfiguration;
-import org.apache.qpid.url.URLSyntaxException;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.BindException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.util.Collection;
-import java.util.List;
 
 /**
  * Main entry point for AMQPD.
@@ -200,13 +193,6 @@
                 _brokerLogger.error("Initialisation Error : " + e.getMessage());
                 shutdown(1);
             }
-            catch (ConfigurationException e)
-            {
-                System.out.println("Error configuring message broker: " + e);
-                _brokerLogger.error("Error configuring message broker: " + e);
-                e.printStackTrace();
-                shutdown(1);
-            }
             catch (Throwable e)
             {
                 System.out.println("Error initialising message broker: " + e);
@@ -223,7 +209,7 @@
         System.exit(status);
     }
 
-    protected void startup() throws InitException, ConfigurationException, Exception
+    protected void startup() throws Exception
     {
         final String QpidHome = System.getProperty(QPID_HOME);
         final File defaultConfigFile = new File(QpidHome, DEFAULT_CONFIG_FILE);
@@ -259,40 +245,32 @@
         }
 
         ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(configFile);
-
-
-        updateManagementPort(config.getConfiguration(), commandLine.getOptionValue("m"));
-
-
+        ServerConfiguration serverConfig = config.getConfiguration();
+        updateManagementPort(serverConfig, commandLine.getOptionValue("m"));
 
         ApplicationRegistry.initialise(config);
 
-
         //fixme .. use QpidProperties.getVersionString when we have fixed the classpath issues
         // that are causing the broker build to pick up the wrong properties file and hence say
         // Starting Qpid Client 
         _brokerLogger.info("Starting Qpid Broker " + QpidProperties.getReleaseVersion()
                            + " build: " + QpidProperties.getBuildVersion());
 
-        ConnectorConfiguration connectorConfig =
-                ApplicationRegistry.getInstance().getConfiguredObject(ConnectorConfiguration.class);
-
-        ByteBuffer.setUseDirectBuffers(connectorConfig.enableDirectBuffers);
+        ByteBuffer.setUseDirectBuffers(serverConfig.getEnableDirectBuffers());
 
         // the MINA default is currently to use the pooled allocator although this may change in future
         // once more testing of the performance of the simple allocator has been done
-        if (!connectorConfig.enablePooledAllocator)
+        if (!serverConfig.getEnablePooledAllocator())
         {
             ByteBuffer.setAllocator(new FixedSizeByteBufferAllocator());
         }
 
-
-        if(connectorConfig.useBiasedWrites)
+        if(serverConfig.getUseBiasedWrites())
         {
             System.setProperty("org.apache.qpid.use_write_biased_pool","true");
         }
 
-        int port = connectorConfig.port;
+        int port = serverConfig.getPort();
 
         String portStr = commandLine.getOptionValue("p");
         if (portStr != null)
@@ -306,29 +284,8 @@
                 throw new InitException("Invalid port: " + portStr, e);
             }
         }
-
-        String VIRTUAL_HOSTS = "virtualhosts";
-
-        Object virtualHosts = ApplicationRegistry.getInstance().getConfiguration().getProperty(VIRTUAL_HOSTS);
-
-        if (virtualHosts != null)
-        {
-            if (virtualHosts instanceof Collection)
-            {
-                int totalVHosts = ((Collection) virtualHosts).size();
-                for (int vhost = 0; vhost < totalVHosts; vhost++)
-                {
-                    setupVirtualHosts(configFile.getParent(), (String) ((List) virtualHosts).get(vhost));
-                }
-            }
-            else
-            {
-                setupVirtualHosts(configFile.getParent(), (String) virtualHosts);
-            }
-        }
-
-        bind(port, connectorConfig);
-
+        
+        bind(port, serverConfig);
     }
 
     /**
@@ -336,86 +293,59 @@
      * @param configuration
      * @param managementPort The string from the command line
      */
-    private void updateManagementPort(Configuration configuration, String managementPort)
+    private void updateManagementPort(ServerConfiguration configuration, String managementPort)
     {
         if (managementPort != null)
         {
-            int mport;
-            int defaultMPort = configuration.getInt(JMXManagedObjectRegistry.MANAGEMENT_PORT_CONFIG_PATH);
             try
             {
-                mport = Integer.parseInt(managementPort);
-                configuration.setProperty(JMXManagedObjectRegistry.MANAGEMENT_PORT_CONFIG_PATH, mport);
+                configuration.setJMXManagementPort(Integer.parseInt(managementPort));
             }
             catch (NumberFormatException e)
             {
-                _logger.warn("Invalid management port: " + managementPort + " will use default:" + defaultMPort, e);
+                _logger.warn("Invalid management port: " + managementPort + " will use:" + configuration.getJMXManagementPort(), e);
             }
         }
     }
 
-    protected void setupVirtualHosts(String configFileParent, String configFilePath)
-            throws ConfigurationException, AMQException, URLSyntaxException
-    {
-        String configVar = "${conf}";
-
-        if (configFilePath.startsWith(configVar))
-        {
-            configFilePath = configFileParent + configFilePath.substring(configVar.length());
-        }
-
-        if (configFilePath.indexOf(".xml") != -1)
-        {
-            VirtualHostConfiguration vHostConfig = new VirtualHostConfiguration(configFilePath);
-            vHostConfig.performBindings();
-        }
-        else
-        {
-            // the virtualhosts value is a path. Search it for XML files.
-
-            File virtualHostDir = new File(configFilePath);
-
-            String[] fileNames = virtualHostDir.list();
-
-            for (int each = 0; each < fileNames.length; each++)
-            {
-                if (fileNames[each].endsWith(".xml"))
-                {
-                    VirtualHostConfiguration vHostConfig =
-                            new VirtualHostConfiguration(configFilePath + "/" + fileNames[each]);
-                    vHostConfig.performBindings();
-                }
-            }
-        }
-    }
-
-    protected void bind(int port, ConnectorConfiguration connectorConfig) throws BindException
+    protected void bind(int port, ServerConfiguration config) throws BindException
     {
         String bindAddr = commandLine.getOptionValue("b");
         if (bindAddr == null)
         {
-            bindAddr = connectorConfig.bindAddress;
+            bindAddr = config.getBind();
         }
 
         try
         {
-            // IoAcceptor acceptor = new SocketAcceptor(connectorConfig.processors);
-            IoAcceptor acceptor = connectorConfig.createAcceptor();
+            IoAcceptor acceptor;
+            
+            if (ApplicationRegistry.getInstance().getConfiguration().getQpidNIO())
+            {
+                _logger.warn("Using Qpid Multithreaded IO Processing");
+                acceptor = new org.apache.mina.transport.socket.nio.MultiThreadSocketAcceptor(config.getProcessors(), new NewThreadExecutor());
+            }
+            else
+            {
+                _logger.warn("Using Mina IO Processing");
+                acceptor = new org.apache.mina.transport.socket.nio.SocketAcceptor(config.getProcessors(), new NewThreadExecutor());
+            }
+            
             SocketAcceptorConfig sconfig = (SocketAcceptorConfig) acceptor.getDefaultConfig();
             SocketSessionConfig sc = (SocketSessionConfig) sconfig.getSessionConfig();
 
-            sc.setReceiveBufferSize(connectorConfig.socketReceiveBufferSize);
-            sc.setSendBufferSize(connectorConfig.socketWriteBuferSize);
-            sc.setTcpNoDelay(connectorConfig.tcpNoDelay);
+            sc.setReceiveBufferSize(config.getReceiveBufferSize());
+            sc.setSendBufferSize(config.getWriteBufferSize());
+            sc.setTcpNoDelay(config.getTcpNoDelay());
 
             // if we do not use the executor pool threading model we get the default leader follower
             // implementation provided by MINA
-            if (connectorConfig.enableExecutorPool)
+            if (config.getEnableExecutorPool())
             {
                 sconfig.setThreadModel(ReadWriteThreadModel.getInstance());
             }
 
-            if (!connectorConfig.enableSSL || !connectorConfig.sslOnly)
+            if (!config.getEnableSSL() || !config.getSSLOnly())
             {
                 AMQPFastProtocolHandler handler = new AMQPProtocolProvider().getHandler();
                 InetSocketAddress bindAddress;
@@ -434,16 +364,16 @@
                 _brokerLogger.info("Qpid.AMQP listening on non-SSL address " + bindAddress);
             }
 
-            if (connectorConfig.enableSSL)
+            if (config.getEnableSSL())
             {
                 AMQPFastProtocolHandler handler = new AMQPProtocolProvider().getHandler();
                 try
                 {
 
-                    bind(acceptor, new InetSocketAddress(connectorConfig.sslPort), handler, sconfig);
+                    bind(acceptor, new InetSocketAddress(config.getSSLPort()), handler, sconfig);
 
                     //fixme  qpid.AMQP should be using qpidproperties to get value
-                    _brokerLogger.info("Qpid.AMQP listening on SSL port " + connectorConfig.sslPort);
+                    _brokerLogger.info("Qpid.AMQP listening on SSL port " + config.getSSLPort());
 
                 }
                 catch (IOException e)

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java Mon Apr 13 12:42:38 2009
@@ -20,267 +20,104 @@
  */
 package org.apache.qpid.server.configuration;
 
-import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.commons.configuration.CompositeConfiguration;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.XMLConfiguration;
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.exchange.ExchangeRegistry;
-import org.apache.qpid.server.exchange.ExchangeFactory;
-import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.queue.AMQQueueFactory;
 import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.store.MemoryMessageStore;
 
 public class VirtualHostConfiguration
 {
-    private static final Logger _logger = Logger.getLogger(VirtualHostConfiguration.class);
-
-    private static XMLConfiguration _config;
-
-    private static final String VIRTUALHOST_PROPERTY_BASE = "virtualhost.";
-
-
-    public VirtualHostConfiguration(String configFile) throws ConfigurationException
-    {
-        _logger.info("Loading Config file:" + configFile);
-
-        _config = new XMLConfiguration(configFile);
-
-    }
-
-
-
-    private void configureVirtualHost(String virtualHostName, Configuration configuration) throws ConfigurationException, AMQException
-    {
-        _logger.debug("Loding configuration for virtaulhost: "+virtualHostName);
-
-
-        VirtualHost virtualHost = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost(virtualHostName);
-
-
-
-        if(virtualHost == null)
-        {
-            throw new ConfigurationException("Unknown virtual host: " + virtualHostName);
-        }
-
-        List exchangeNames = configuration.getList("exchanges.exchange.name");
-
-        for(Object exchangeNameObj : exchangeNames)
-        {
-            String exchangeName = String.valueOf(exchangeNameObj);
-            configureExchange(virtualHost, exchangeName, configuration);
-        }
-
-
-        List queueNames = configuration.getList("queues.queue.name");
-
-        for(Object queueNameObj : queueNames)
-        {
-            String queueName = String.valueOf(queueNameObj);
-            configureQueue(virtualHost, queueName, configuration);
-        }
-
-    }
-
-    private void configureExchange(VirtualHost virtualHost, String exchangeNameString, Configuration configuration) throws AMQException
-    {
-
-        CompositeConfiguration exchangeConfiguration = new CompositeConfiguration();
-
-        exchangeConfiguration.addConfiguration(configuration.subset("exchanges.exchange."+ exchangeNameString));
-        exchangeConfiguration.addConfiguration(configuration.subset("exchanges"));
-
-        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
-        MessageStore messageStore = virtualHost.getMessageStore();
-        ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
-        ExchangeFactory exchangeFactory = virtualHost.getExchangeFactory();
-
-        AMQShortString exchangeName = new AMQShortString(exchangeNameString);
-
-
-        Exchange exchange;
-
-
-
-        synchronized (exchangeRegistry)
-        {
-            exchange = exchangeRegistry.getExchange(exchangeName);
-            if(exchange == null)
-            {
-
-                AMQShortString type = new AMQShortString(exchangeConfiguration.getString("type","direct"));
-                boolean durable = exchangeConfiguration.getBoolean("durable",false);
-                boolean autodelete = exchangeConfiguration.getBoolean("autodelete",false);
-
-                Exchange newExchange = exchangeFactory.createExchange(exchangeName,type,durable,autodelete,0);
-                exchangeRegistry.registerExchange(newExchange);
-            }
-
-        }
-    }
-
-    public static CompositeConfiguration getDefaultQueueConfiguration(VirtualHost host)
-    {
-        CompositeConfiguration queueConfiguration = null;
-        if (_config == null)
-            return null;
-
-        Configuration vHostConfiguration = _config.subset(VIRTUALHOST_PROPERTY_BASE + host.getName());
-
-        if (vHostConfiguration == null)
-            return null;
-
-        Configuration defaultQueueConfiguration = vHostConfiguration.subset("queues");
-        if (defaultQueueConfiguration != null)
-        {
-            queueConfiguration = new CompositeConfiguration();
-            queueConfiguration.addConfiguration(defaultQueueConfiguration);
-        }
-
-        return queueConfiguration;
-    }
-
-    private void configureQueue(VirtualHost virtualHost, String queueNameString, Configuration configuration) throws AMQException, ConfigurationException
-    {
-        CompositeConfiguration queueConfiguration = new CompositeConfiguration();
-
-        queueConfiguration.addConfiguration(configuration.subset("queues.queue."+ queueNameString));
-        queueConfiguration.addConfiguration(configuration.subset("queues"));
-
-        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
-        MessageStore messageStore = virtualHost.getMessageStore();
-        ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
-
-
-        AMQShortString queueName = new AMQShortString(queueNameString);
-
-        AMQQueue queue;
-
-        synchronized (queueRegistry)
-        {
-            queue = queueRegistry.getQueue(queueName);
-
-            if (queue == null)
-            {
-                _logger.info("Creating queue '" + queueName + "' on virtual host " + virtualHost.getName());
-
-                boolean durable = queueConfiguration.getBoolean("durable" ,false);
-                boolean autodelete = queueConfiguration.getBoolean("autodelete", false);
-                String owner = queueConfiguration.getString("owner", null);
-                FieldTable arguments = null;
-                boolean priority = queueConfiguration.getBoolean("priority", false);
-                int priorities = queueConfiguration.getInt("priorities", -1);
-                if(priority || priorities > 0)
-                {
-                    if(arguments == null)
-                    {
-                        arguments = new FieldTable();
-                    }
-                    if (priorities < 0)
-                    {
-                        priorities = 10;
-                    }
-                    arguments.put(new AMQShortString("x-qpid-priorities"), priorities);
-                }
-
-
-                queue = AMQQueueFactory.createAMQQueueImpl(queueName,
-                        durable,
-                        owner == null ? null : new AMQShortString(owner) /* These queues will have no owner */,
-                        autodelete /* Therefore autodelete makes no sence */, 
-                        virtualHost, 
-                        arguments,
-                        queueConfiguration);
-
-                if (queue.isDurable())
-                {
-                    messageStore.createQueue(queue);
-                }
-
-                queueRegistry.registerQueue(queue);
-            }
-            else
-            {
-                _logger.info("Queue '" + queueNameString + "' already exists on virtual host "+virtualHost.getName()+", not creating.");
-            }
-
-            String exchangeName = queueConfiguration.getString("exchange", null);
-
-            Exchange exchange = exchangeRegistry.getExchange(exchangeName == null ? null : new AMQShortString(exchangeName));
-
-            if(exchange == null)
-            {
-                exchange = virtualHost.getExchangeRegistry().getDefaultExchange();
-            }
-
-            if (exchange == null)
-            {
-                throw new ConfigurationException("Attempt to bind queue to unknown exchange:" + exchangeName);
-            }
-
-            synchronized (exchange)
-            {
-                List routingKeys = queueConfiguration.getList("routingKey");
-                if(routingKeys == null || routingKeys.isEmpty())
-                {
-                    routingKeys = Collections.singletonList(queue.getName());
-                }
-
-                for(Object routingKeyNameObj : routingKeys)
-                {
-                    AMQShortString routingKey = new AMQShortString(String.valueOf(routingKeyNameObj));
-                    
-
-                    queue.bind(exchange, routingKey, null);
-
-
-                    _logger.info("Queue '" + queue.getName() + "' bound to exchange:" + exchangeName + " RK:'" + routingKey + "'");
-                }
-
-                if(exchange != virtualHost.getExchangeRegistry().getDefaultExchange())
-                {
-                    queue.bind(virtualHost.getExchangeRegistry().getDefaultExchange(), queue.getName(), null);
-                }
-            }
-
-        }
-    }
-
-
-    public void performBindings() throws AMQException, ConfigurationException
-    {
-        List virtualHostNames = _config.getList(VIRTUALHOST_PROPERTY_BASE + "name");
-        String defaultVirtualHostName = _config.getString("default");
-        if(defaultVirtualHostName != null)
-        {
-            ApplicationRegistry.getInstance().getVirtualHostRegistry().setDefaultVirtualHostName(defaultVirtualHostName);            
-        }
-        _logger.info("Configuring " + virtualHostNames == null ? 0 : virtualHostNames.size() + " virtual hosts: " + virtualHostNames);
-
-        for(Object nameObject : virtualHostNames)
-        {
-            String name = String.valueOf(nameObject);
-            configureVirtualHost(name, _config.subset(VIRTUALHOST_PROPERTY_BASE + name));
-        }
-
-        if (virtualHostNames == null || virtualHostNames.isEmpty())
-        {
-            throw new ConfigurationException(
-                    "Virtualhost Configuration document does not contain a valid virtualhost.");
-        }
-    }
-
-
-
+	private Configuration _config;
+	private String _name;
+	private Map<String, QueueConfiguration> _queues = new HashMap<String, QueueConfiguration>();
+	private Map<String, ExchangeConfiguration> _exchanges = new HashMap<String, ExchangeConfiguration>();
+
+	public VirtualHostConfiguration(String name, Configuration config) throws ConfigurationException
+	{
+		_config = config;
+		_name = name;
+		Iterator i = _config.getList("queues.queue.name").iterator();
+		
+		while (i.hasNext())
+		{
+			String queueName = (String) i.next();
+			CompositeConfiguration mungedConf = new CompositeConfiguration();
+			mungedConf.addConfiguration(_config.subset("queues.queue." + queueName));
+			mungedConf.addConfiguration(_config.subset("queues"));
+			_queues.put(queueName, new QueueConfiguration(queueName, mungedConf));
+        }
+
+		i = _config.getList("exchanges.exchange.name").iterator();
+		int count = 0;
+		while (i.hasNext())
+        {
+			CompositeConfiguration mungedConf = new CompositeConfiguration();
+			mungedConf.addConfiguration(config.subset("exchanges.exchange(" + count++ + ")"));
+			mungedConf.addConfiguration(_config.subset("exchanges"));
+			String exchName = (String) i.next();
+			_exchanges.put(exchName, new ExchangeConfiguration(exchName, mungedConf));
+        }
+
+    }
+
+	public String getName()
+	{
+        return _name;
+    }
+
+	public long getHousekeepingExpiredMessageCheckPeriod()
+	{
+		return _config.getLong("housekeeping.expiredMessageCheckPeriod", ApplicationRegistry.getInstance().getConfiguration().getHousekeepingExpiredMessageCheckPeriod());
+	}
+
+	public String getAuthenticationDatabase()
+	{
+		return _config.getString("security.authentication.name");
+	}
+	
+	public List getCustomExchanges()
+	{
+		return _config.getList("custom-exchanges.class-name");
+	}
+	
+	public SecurityConfiguration getSecurityConfiguration()
+	{
+		return new SecurityConfiguration(_config.subset("security"));
+	}
+
+	public Configuration getStoreConfiguration()
+	{
+		return _config.subset("store");
+	}
+
+	public String getMessageStoreClass()
+	{
+		return _config.getString("store.class", MemoryMessageStore.class.getName());
+	}
+
+	public List getExchanges()
+	{
+		return _config.getList("exchanges.exchange.name");
+	}
+
+	public ExchangeConfiguration getExchangeConfiguration(String exchangeName)
+	{
+		return _exchanges.get(exchangeName);
+	}
+
+	public String[] getQueueNames()
+	{
+		return _queues.keySet().toArray(new String[_queues.size()]);
+	}
+
+	public QueueConfiguration getQueueConfiguration(String queueName)
+	{
+		return _queues.get(queueName);
+	}
 }

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java Mon Apr 13 12:42:38 2009
@@ -25,11 +25,11 @@
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.apache.commons.configuration.Configuration;
 
 import org.apache.qpid.AMQException;
 import org.apache.qpid.AMQUnknownExchangeType;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.server.configuration.VirtualHostConfiguration;
 import org.apache.qpid.server.registry.ApplicationRegistry;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 
@@ -73,7 +73,8 @@
         return e;
     }
 
-    public void initialise(Configuration hostConfig)
+    @Override
+    public void initialise(VirtualHostConfiguration hostConfig)
     {
 
         if (hostConfig == null)
@@ -81,7 +82,7 @@
             return;
         }
 
-        for(Object className : hostConfig.getList("custom-exchanges.class-name"))
+        for(Object className : hostConfig.getCustomExchanges())
         {
             try
             {

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java Mon Apr 13 12:42:38 2009
@@ -26,6 +26,7 @@
 
 import org.apache.qpid.AMQException;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.server.configuration.VirtualHostConfiguration;
 
 
 public interface ExchangeFactory
@@ -34,7 +35,7 @@
                             int ticket)
             throws AMQException;
 
-    void initialise(Configuration hostConfig);
+    void initialise(VirtualHostConfiguration hostConfig);
 
     Collection<ExchangeType<? extends Exchange>> getRegisteredTypes();
 }

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java Mon Apr 13 12:42:38 2009
@@ -25,14 +25,16 @@
 
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
+import org.apache.qpid.framing.ConnectionCloseBody;
+import org.apache.qpid.framing.ConnectionSecureBody;
+import org.apache.qpid.framing.ConnectionSecureOkBody;
+import org.apache.qpid.framing.ConnectionTuneBody;
+import org.apache.qpid.framing.MethodRegistry;
 import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.protocol.AMQMethodEvent;
 import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.protocol.HeartbeatConfig;
 import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
+import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
 import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
 import org.apache.qpid.server.state.AMQState;
 import org.apache.qpid.server.state.AMQStateManager;
@@ -92,7 +94,7 @@
                 ConnectionTuneBody tuneBody =
                         methodRegistry.createConnectionTuneBody(0xFFFF,
                                                                 ConnectionStartOkMethodHandler.getConfiguredFrameSize(),
-                                                                HeartbeatConfig.getInstance().getDelay());
+                                                                ApplicationRegistry.getInstance().getConfiguration().getHeartBeatDelay());
                 session.writeFrame(tuneBody.generateFrame(0));
                 session.setAuthorizedID(new UsernamePrincipal(ss.getAuthorizationID()));
                 disposeSaslServer(session);

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java Mon Apr 13 12:42:38 2009
@@ -23,18 +23,19 @@
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 
-import org.apache.commons.configuration.Configuration;
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.protocol.AMQMethodEvent;
+import org.apache.qpid.framing.ConnectionCloseBody;
+import org.apache.qpid.framing.ConnectionSecureBody;
+import org.apache.qpid.framing.ConnectionStartOkBody;
+import org.apache.qpid.framing.ConnectionTuneBody;
+import org.apache.qpid.framing.MethodRegistry;
 import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.protocol.HeartbeatConfig;
-import org.apache.qpid.server.protocol.AMQMinaProtocolSession;
 import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
+import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
 import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
 import org.apache.qpid.server.state.AMQState;
 import org.apache.qpid.server.state.AMQStateManager;
@@ -47,8 +48,6 @@
 
     private static ConnectionStartOkMethodHandler _instance = new ConnectionStartOkMethodHandler();
 
-    private static final int DEFAULT_FRAME_SIZE = 65536;
-
     public static ConnectionStartOkMethodHandler getInstance()
     {
         return _instance;
@@ -117,7 +116,7 @@
 
                     ConnectionTuneBody tuneBody = methodRegistry.createConnectionTuneBody(0xFFFF,
                                                                                           getConfiguredFrameSize(),
-                                                                                          HeartbeatConfig.getInstance().getDelay());
+                                                                                          ApplicationRegistry.getInstance().getConfiguration().getHeartBeatDelay());
                     session.writeFrame(tuneBody.generateFrame(0));
                     break;
                 case CONTINUE:
@@ -153,8 +152,8 @@
 
     static int getConfiguredFrameSize()
     {
-        final Configuration config = ApplicationRegistry.getInstance().getConfiguration();
-        final int framesize = config.getInt("advanced.framesize", DEFAULT_FRAME_SIZE);
+        final ServerConfiguration config = ApplicationRegistry.getInstance().getConfiguration();
+        final int framesize = config.getFrameSize();
         _logger.info("Framesize set to " + framesize);
         return framesize;
     }

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java Mon Apr 13 12:42:38 2009
@@ -20,30 +20,28 @@
  */
 package org.apache.qpid.server.handler;
 
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
-import org.apache.qpid.configuration.Configured;
-
-import org.apache.qpid.framing.*;
+import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.framing.MethodRegistry;
+import org.apache.qpid.framing.QueueDeclareBody;
+import org.apache.qpid.framing.QueueDeclareOkBody;
 import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.configuration.Configurator;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
+import org.apache.qpid.server.AMQChannel;
 import org.apache.qpid.server.exchange.Exchange;
 import org.apache.qpid.server.exchange.ExchangeRegistry;
 import org.apache.qpid.server.protocol.AMQProtocolSession;
-import org.apache.qpid.server.queue.QueueRegistry;
-import org.apache.qpid.server.security.access.Permission;
 import org.apache.qpid.server.queue.AMQQueue;
 import org.apache.qpid.server.queue.AMQQueueFactory;
+import org.apache.qpid.server.queue.QueueRegistry;
+import org.apache.qpid.server.registry.ApplicationRegistry;
 import org.apache.qpid.server.state.AMQStateManager;
 import org.apache.qpid.server.state.StateAwareMethodListener;
 import org.apache.qpid.server.store.MessageStore;
 import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.AMQChannel;
-import org.apache.commons.configuration.Configuration;
 
 public class QueueDeclareHandler implements StateAwareMethodListener<QueueDeclareBody>
 {
@@ -56,17 +54,10 @@
         return _instance;
     }
 
-    @Configured(path = "queue.auto_register", defaultValue = "true")
-    public boolean autoRegister;
+    public boolean autoRegister = ApplicationRegistry.getInstance().getConfiguration().getQueueAutoRegister();
 
     private final AtomicInteger _counter = new AtomicInteger();
 
-
-    protected QueueDeclareHandler()
-    {
-        Configurator.configure(this);
-    }
-
     public void methodReceived(AMQStateManager stateManager, QueueDeclareBody body, int channelId) throws AMQException
     {
         AMQProtocolSession session = stateManager.getProtocolSession();

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java Mon Apr 13 12:42:38 2009
@@ -32,9 +32,12 @@
 import org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5HashedInitialiser;
 import org.apache.qpid.server.security.auth.sasl.plain.PlainInitialiser;
 
+import javax.management.InstanceNotFoundException;
 import javax.management.JMException;
+import javax.management.MBeanRegistrationException;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
 import javax.management.remote.JMXConnectorServer;
 import javax.management.remote.JMXConnectorServerFactory;
 import javax.management.remote.JMXServiceURL;
@@ -85,7 +88,7 @@
         IApplicationRegistry appRegistry = ApplicationRegistry.getInstance();
 
         // Retrieve the config parameters
-        boolean platformServer = appRegistry.getConfiguration().getBoolean("management.platform-mbeanserver", true);
+        boolean platformServer = appRegistry.getConfiguration().getPlatformMbeanserver();
 
         _mbeanServer =
                 platformServer ? ManagementFactory.getPlatformMBeanServer()
@@ -105,11 +108,11 @@
 
         IApplicationRegistry appRegistry = ApplicationRegistry.getInstance();
 
-        boolean jmxmpSecurity = appRegistry.getConfiguration().getBoolean("management.security-enabled", false);
-        int port = appRegistry.getConfiguration().getInt(MANAGEMENT_PORT_CONFIG_PATH, MANAGEMENT_PORT_DEFAULT);
+        boolean jmxmpSecurity = appRegistry.getConfiguration().getManagementSecurityEnabled();
+        int port = appRegistry.getConfiguration().getJMXManagementPort();
 
         //retrieve the Principal Database assigned to JMX authentication duties
-        String jmxDatabaseName = appRegistry.getConfiguration().getString("security.jmx.principal-database");
+        String jmxDatabaseName = appRegistry.getConfiguration().getJMXPrincipalDatabase();
         Map<String, PrincipalDatabase> map = appRegistry.getDatabaseManager().getDatabases();        
         PrincipalDatabase db = map.get(jmxDatabaseName);
 
@@ -154,7 +157,7 @@
             RMIServerSocketFactory ssf;
             
             //check ssl enabled option in config, default to true if option is not set
-            boolean sslEnabled = appRegistry.getConfiguration().getBoolean("management.ssl.enabled", true);
+            boolean sslEnabled = appRegistry.getConfiguration().getManagementSSLEnabled();
 
             if (sslEnabled)
             {
@@ -167,7 +170,7 @@
                     keyStorePath = System.getProperty("javax.net.ssl.keyStore");
                 }
                 else{
-                    keyStorePath = appRegistry.getConfiguration().getString("management.ssl.keyStorePath", null);
+                    keyStorePath = appRegistry.getConfiguration().getManagementKeyStorePath();
                 }
                 
                 //check the keystore path value is valid
@@ -202,7 +205,7 @@
                 if (System.getProperty("javax.net.ssl.keyStorePassword") == null)
                 {
                 
-                    if (appRegistry.getConfiguration().getString("management.ssl.keyStorePassword") == null)
+                    if (appRegistry.getConfiguration().getManagementKeyStorePassword() == null)
                     {
                         throw new ConfigurationException("JMX management SSL keystore password not defined, " +
                         		                         "unable to start requested SSL protected JMX server");
@@ -210,7 +213,7 @@
                     else
                     {
                         System.setProperty("javax.net.ssl.keyStorePassword",
-                                appRegistry.getConfiguration().getString("management.ssl.keyStorePassword"));
+                                appRegistry.getConfiguration().getManagementKeyStorePassword());
                     }
                 }
 
@@ -379,6 +382,17 @@
             // Stopping the RMI registry
             UnicastRemoteObject.unexportObject(_rmiRegistry, true);
         }
+        for (ObjectName name : _mbeanServer.queryNames(null, null))
+        {
+            try
+            {
+                _mbeanServer.unregisterMBean(name);
+            }
+            catch (JMException e)
+            {
+                // Really shouldn't happen, but we'll ignore that...
+            }
+        }
     }
 
 }

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java Mon Apr 13 12:42:38 2009
@@ -582,7 +582,7 @@
         if (delay > 0)
         {
             _minaProtocolSession.setIdleTime(IdleStatus.WRITER_IDLE, delay);
-            _minaProtocolSession.setIdleTime(IdleStatus.READER_IDLE, HeartbeatConfig.getInstance().getTimeout(delay));
+            _minaProtocolSession.setIdleTime(IdleStatus.READER_IDLE, (int) (ApplicationRegistry.getInstance().getConfiguration().getHeartBeatTimeout() * delay));
         }
     }
 

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java Mon Apr 13 12:42:38 2009
@@ -20,6 +20,9 @@
  */
 package org.apache.qpid.server.protocol;
 
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
 import org.apache.log4j.Logger;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IdleStatus;
@@ -34,15 +37,19 @@
 import org.apache.mina.util.SessionUtil;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.codec.AMQCodecFactory;
-import org.apache.qpid.framing.*;
+import org.apache.qpid.framing.AMQDataBlock;
+import org.apache.qpid.framing.AMQProtocolHeaderException;
+import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.framing.ConnectionCloseBody;
+import org.apache.qpid.framing.HeartbeatBody;
+import org.apache.qpid.framing.MethodRegistry;
+import org.apache.qpid.framing.ProtocolInitiation;
+import org.apache.qpid.framing.ProtocolVersion;
+import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.registry.ApplicationRegistry;
 import org.apache.qpid.server.registry.IApplicationRegistry;
-import org.apache.qpid.server.transport.ConnectorConfiguration;
 import org.apache.qpid.ssl.SSLContextFactory;
 
-import java.io.IOException;
-import java.net.InetSocketAddress;
-
 /**
  * The protocol handler handles "protocol events" for all connections. The state
  * associated with an individual connection is accessed through the protocol session.
@@ -56,9 +63,6 @@
 
     private final IApplicationRegistry _applicationRegistry;
 
-    private static String DEFAULT_BUFFER_READ_LIMIT_SIZE = "262144";
-    private static String DEFAULT_BUFFER_WRITE_LIMIT_SIZE = "262144";
-
     private final int BUFFER_READ_LIMIT_SIZE;
     private final int BUFFER_WRITE_LIMIT_SIZE;
 
@@ -72,8 +76,8 @@
         _applicationRegistry = applicationRegistry;
 
         // Read the configuration from the application registry
-        BUFFER_READ_LIMIT_SIZE = Integer.parseInt(_applicationRegistry.getConfiguration().getString("broker.connector.protectio.readBufferLimitSize", DEFAULT_BUFFER_READ_LIMIT_SIZE));
-        BUFFER_WRITE_LIMIT_SIZE = Integer.parseInt(_applicationRegistry.getConfiguration().getString("broker.connector.protectio.writeBufferLimitSize", DEFAULT_BUFFER_WRITE_LIMIT_SIZE));
+        BUFFER_READ_LIMIT_SIZE = _applicationRegistry.getConfiguration().getBufferReadLimit();
+        BUFFER_WRITE_LIMIT_SIZE = _applicationRegistry.getConfiguration().getBufferWriteLimit();
 
         _logger.debug("AMQPFastProtocolHandler created");
     }
@@ -92,17 +96,22 @@
         _logger.info("Protocol session created for:" + protocolSession.getRemoteAddress());
 
         final QpidProtocolCodecFilter pcf = new QpidProtocolCodecFilter(codecFactory);
-
-        ConnectorConfiguration connectorConfig = ApplicationRegistry.getInstance().
-                getConfiguredObject(ConnectorConfiguration.class);
-        if (connectorConfig.enableExecutorPool)
+        final ServerConfiguration config = _applicationRegistry.getConfiguration();
+        
+        String keystorePath = config.getKeystorePath();
+        String keystorePassword = config.getKeystorePassword();
+        String certType = config.getCertType();
+        SSLContextFactory sslContextFactory = null;
+        boolean isSsl = false; 
+        if (config.getEnableSSL() && isSSLClient(config, protocolSession))
         {
-            if (connectorConfig.enableSSL && isSSLClient(connectorConfig, protocolSession))
+            sslContextFactory = new SSLContextFactory(keystorePath, keystorePassword, certType);
+            isSsl = true;
+        }
+        if (config.getEnableExecutorPool())
+        {
+            if (isSsl)
             {
-                String keystorePath = connectorConfig.keystorePath;
-                String keystorePassword = connectorConfig.keystorePassword;
-                String certType = connectorConfig.certType;
-                SSLContextFactory sslContextFactory = new SSLContextFactory(keystorePath, keystorePassword, certType);
                 protocolSession.getFilterChain().addAfter("AsynchronousReadFilter", "sslFilter",
                                                           new SSLFilter(sslContextFactory.buildServerContext()));
             }
@@ -111,19 +120,14 @@
         else
         {
             protocolSession.getFilterChain().addLast("protocolFilter", pcf);
-            if (connectorConfig.enableSSL && isSSLClient(connectorConfig, protocolSession))
+            if (isSsl)
             {
-                String keystorePath = connectorConfig.keystorePath;
-                String keystorePassword = connectorConfig.keystorePassword;
-                String certType = connectorConfig.certType;
-                SSLContextFactory sslContextFactory = new SSLContextFactory(keystorePath, keystorePassword, certType);
                 protocolSession.getFilterChain().addBefore("protocolFilter", "sslFilter",
                                                            new SSLFilter(sslContextFactory.buildServerContext()));
             }
-
         }
 
-        if (ApplicationRegistry.getInstance().getConfiguration().getBoolean("broker.connector.protectio.enabled", false))
+        if (ApplicationRegistry.getInstance().getConfiguration().getProtectIOEnabled())
         {
             try
             {
@@ -271,10 +275,10 @@
         }
     }
 
-    protected boolean isSSLClient(ConnectorConfiguration connectionConfig,
+    protected boolean isSSLClient(ServerConfiguration connectionConfig,
                                   IoSession protocolSession)
     {
         InetSocketAddress addr = (InetSocketAddress) protocolSession.getLocalAddress();
-        return addr.getPort() == connectionConfig.sslPort;
+        return addr.getPort() == connectionConfig.getSSLPort();
     }
 }

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java Mon Apr 13 12:42:38 2009
@@ -144,6 +144,8 @@
 
     long getMinimumAlertRepeatGap();
 
+    void setMinimumAlertRepeatGap(long value);
+
 
     void deleteMessageFromTop(StoreContext storeContext) throws AMQException;
 
@@ -165,7 +167,6 @@
 
     void stop();
 
-
     /**
      * ExistingExclusiveSubscription signals a failure to create a subscription, because an exclusive subscription
      * already exists.
@@ -213,6 +214,4 @@
     {
         public void doTask(AMQQueue queue) throws AMQException;
     }
-
-    void configure(Configuration virtualHostDefaultQueueConfiguration);
 }

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java Mon Apr 13 12:42:38 2009
@@ -20,12 +20,11 @@
  */
 package org.apache.qpid.server.queue;
 
-import org.apache.commons.configuration.Configuration;
+import org.apache.qpid.AMQException;
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
+import org.apache.qpid.server.configuration.QueueConfiguration;
 import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.AMQException;
 
 
 public class AMQQueueFactory
@@ -33,25 +32,10 @@
     public static final AMQShortString X_QPID_PRIORITIES = new AMQShortString("x-qpid-priorities");
 
     public static AMQQueue createAMQQueueImpl(AMQShortString name,
-            boolean durable,
-            AMQShortString owner,
-            boolean autoDelete,
-            VirtualHost virtualHost, final FieldTable arguments) 
-
-    throws AMQException
-    {
-
-        return createAMQQueueImpl(name, durable, owner, autoDelete, 
-                virtualHost, arguments, 
-                VirtualHostConfiguration.getDefaultQueueConfiguration(virtualHost));
-    }
-    
-    public static AMQQueue createAMQQueueImpl(AMQShortString name,
                                               boolean durable,
                                               AMQShortString owner,
                                               boolean autoDelete,
-                                              VirtualHost virtualHost, final FieldTable arguments, 
-                                              Configuration queueConfiguration)
+                                              VirtualHost virtualHost, final FieldTable arguments)
             throws AMQException
     {
 
@@ -66,13 +50,41 @@
         {
             q = new SimpleAMQQueue(name, durable, owner, autoDelete, virtualHost);
         }
-        if (q != null && queueConfiguration != null)
-        {
-            q.configure(queueConfiguration);
-        }
 
         //Register the new queue
         virtualHost.getQueueRegistry().registerQueue(q);
         return q;
     }
+
+    public static AMQQueue createAMQQueueImpl(QueueConfiguration config, VirtualHost host) throws AMQException
+    {
+        AMQShortString queueName = new AMQShortString(config.getName());
+
+        boolean durable = config.getDurable();
+        boolean autodelete = config.getAutoDelete();
+        AMQShortString owner = (config.getOwner() != null) ? new AMQShortString(config.getOwner()) : null;
+        FieldTable arguments = null;
+        boolean priority = config.getPriority();
+        int priorities = config.getPriorities();
+        if(priority || priorities > 0)
+        {
+            if(arguments == null)
+            {
+                arguments = new FieldTable();
+            }
+            if (priorities < 0)
+            {
+                priorities = 10;
+            }
+            arguments.put(new AMQShortString("x-qpid-priorities"), priorities);
+        }
+
+        AMQQueue q = createAMQQueueImpl(queueName, durable, owner, autodelete, host, arguments);
+        q.setMaximumMessageAge(config.getMaximumMessageAge());
+        q.setMaximumQueueDepth(config.getMaximumQueueDepth());
+        q.setMaximumMessageSize(config.getMaximumMessageSize());
+        q.setMaximumMessageCount(config.getMaximumMessageCount());
+        q.setMinimumAlertRepeatGap(config.getMinimumAlertRepeatGap());
+        return q;
+    }
 }

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/IncomingMessage.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/IncomingMessage.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/IncomingMessage.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/IncomingMessage.java Mon Apr 13 12:42:38 2009
@@ -44,7 +44,7 @@
     private static final Logger _logger = Logger.getLogger(IncomingMessage.class);
 
     private static final boolean SYNCHED_CLOCKS =
-            ApplicationRegistry.getInstance().getConfiguration().getBoolean("advanced.synced-clocks", false);
+            ApplicationRegistry.getInstance().getConfiguration().getSynchedClocks();
 
     private final MessagePublishInfo _messagePublishInfo;
     private ContentHeaderBody _contentHeaderBody;
@@ -53,7 +53,7 @@
     private final TransactionalContext _txnContext;
 
     private static final boolean MSG_AUTH = 
-        ApplicationRegistry.getInstance().getConfiguration().getBoolean("security.msg-auth", false);
+        ApplicationRegistry.getInstance().getConfiguration().getMsgAuth();
 
 
     /**

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java Mon Apr 13 12:42:38 2009
@@ -1,28 +1,9 @@
 package org.apache.qpid.server.queue;
 
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.configuration.Configurator;
-import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.store.StoreContext;
-import org.apache.qpid.server.store.MessageStore;
-import org.apache.qpid.server.subscription.Subscription;
-import org.apache.qpid.server.subscription.SubscriptionList;
-import org.apache.qpid.server.output.ProtocolOutputConverter;
-import org.apache.qpid.server.management.ManagedObject;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.pool.ReadWriteRunnable;
-import org.apache.qpid.pool.ReferenceCountingExecutorService;
-import org.apache.qpid.configuration.Configured;
-import org.apache.commons.configuration.Configuration;
-import org.apache.log4j.Logger;
-
-import javax.management.JMException;
-import java.util.List;
-import java.util.Set;
 import java.util.ArrayList;
 import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Executor;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -30,6 +11,24 @@
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 
+import javax.management.JMException;
+
+import org.apache.log4j.Logger;
+import org.apache.qpid.AMQException;
+import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.framing.FieldTable;
+import org.apache.qpid.pool.ReadWriteRunnable;
+import org.apache.qpid.pool.ReferenceCountingExecutorService;
+import org.apache.qpid.server.exchange.Exchange;
+import org.apache.qpid.server.management.ManagedObject;
+import org.apache.qpid.server.output.ProtocolOutputConverter;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.store.MessageStore;
+import org.apache.qpid.server.store.StoreContext;
+import org.apache.qpid.server.subscription.Subscription;
+import org.apache.qpid.server.subscription.SubscriptionList;
+import org.apache.qpid.server.virtualhost.VirtualHost;
+
 /*
 *
 * Licensed to the Apache Software Foundation (ASF) under one
@@ -91,24 +90,19 @@
     private final AtomicLong _totalMessagesReceived = new AtomicLong();
 
     /** max allowed size(KB) of a single message */
-    @Configured(path = "maximumMessageSize", defaultValue = "0")
-    public long _maximumMessageSize;
+    public long _maximumMessageSize = ApplicationRegistry.getInstance().getConfiguration().getMaximumMessageSize();
 
     /** max allowed number of messages on a queue. */
-    @Configured(path = "maximumMessageCount", defaultValue = "0")
-    public long _maximumMessageCount;
+    public long _maximumMessageCount = ApplicationRegistry.getInstance().getConfiguration().getMaximumMessageCount();
 
     /** max queue depth for the queue */
-    @Configured(path = "maximumQueueDepth", defaultValue = "0")
-    public long _maximumQueueDepth;
+    public long _maximumQueueDepth = ApplicationRegistry.getInstance().getConfiguration().getMaximumQueueDepth();
 
     /** maximum message age before alerts occur */
-    @Configured(path = "maximumMessageAge", defaultValue = "0")
-    public long _maximumMessageAge;
+    public long _maximumMessageAge = ApplicationRegistry.getInstance().getConfiguration().getMaximumMessageAge();
 
-    /** the minimum interval between sending out consequetive alerts of the same type */
-    @Configured(path = "minimumAlertRepeatGap", defaultValue = "0")
-    public long _minimumAlertRepeatGap;
+    /** the minimum interval between sending out consecutive alerts of the same type */
+    public long _minimumAlertRepeatGap = ApplicationRegistry.getInstance().getConfiguration().getMinimumAlertRepeatGap();
 
     private static final int MAX_ASYNC_DELIVERIES = 10;
 
@@ -167,7 +161,7 @@
 
     }
 
-    private void resetNotifications()
+    public void resetNotifications()
     {
         // This ensure that the notification checks for the configured alerts are created.
         setMaximumMessageAge(_maximumMessageAge);
@@ -1590,10 +1584,4 @@
         }
         return ids;
     }
-
-    public void configure(Configuration queueConfiguration)
-    {
-        Configurator.configure(this, queueConfiguration);
-        resetNotifications();
-    }
-}
\ No newline at end of file
+}

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java Mon Apr 13 12:42:38 2009
@@ -20,24 +20,20 @@
  */
 package org.apache.qpid.server.registry;
 
-import org.apache.commons.configuration.Configuration;
+import java.net.InetSocketAddress;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.log4j.Logger;
-import org.apache.qpid.server.configuration.Configurator;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
+import org.apache.mina.common.IoAcceptor;
+import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.management.ManagedObjectRegistry;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabaseManager;
-import org.apache.qpid.server.security.auth.database.ConfigurationFilePrincipalDatabaseManager;
-import org.apache.qpid.server.security.access.ACLPlugin;
-import org.apache.qpid.server.security.access.ACLManager;
 import org.apache.qpid.server.plugins.PluginManager;
-import org.apache.mina.common.IoAcceptor;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.net.InetSocketAddress;
+import org.apache.qpid.server.security.access.ACLManager;
+import org.apache.qpid.server.security.auth.database.PrincipalDatabaseManager;
+import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
+import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
 
 /**
  * An abstract application registry that provides access to configuration information and handles the
@@ -53,7 +49,7 @@
 
     private final Map<Class<?>, Object> _configuredObjects = new HashMap<Class<?>, Object>();
 
-    protected final Configuration _configuration;
+    protected final ServerConfiguration _configuration;
 
     public static final int DEFAULT_INSTANCE = 1;
     public static final String DEFAULT_APPLICATION_REGISTRY = "org.apache.qpid.server.util.NullApplicationRegistry";
@@ -154,7 +150,7 @@
         }
     }
 
-    protected ApplicationRegistry(Configuration configuration)
+    protected ApplicationRegistry(ServerConfiguration configuration)
     {
         _configuration = configuration;
     }
@@ -242,7 +238,7 @@
         }
     }
 
-    public Configuration getConfiguration()
+    public ServerConfiguration getConfiguration()
     {
         return _configuration;
     }
@@ -255,26 +251,6 @@
         }
     }
 
-    public <T> T getConfiguredObject(Class<T> instanceType)
-    {
-        T instance = (T) _configuredObjects.get(instanceType);
-        if (instance == null)
-        {
-            try
-            {
-                instance = instanceType.newInstance();
-            }
-            catch (Exception e)
-            {
-                _logger.error("Unable to instantiate configuration class " + instanceType + " - ensure it has a public default constructor");
-                throw new IllegalArgumentException("Unable to instantiate configuration class " + instanceType + " - ensure it has a public default constructor", e);
-            }
-            Configurator.configure(instance);
-            _configuredObjects.put(instanceType, instance);
-        }
-        return instance;
-    }
-
     public static void setDefaultApplicationRegistry(String clazz)
     {
         _APPLICATION_REGISTRY = clazz;
@@ -287,7 +263,7 @@
 
     public ACLManager getAccessManager()
     {
-        return new ACLManager(_configuration, _pluginManager);
+        return new ACLManager(_configuration.getSecurityConfiguration(), _pluginManager);
     }
 
     public ManagedObjectRegistry getManagedObjectRegistry()

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java Mon Apr 13 12:42:38 2009
@@ -21,71 +21,25 @@
 package org.apache.qpid.server.registry;
 
 import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.SystemConfiguration;
-import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.qpid.AMQException;
+import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.management.JMXManagedObjectRegistry;
-import org.apache.qpid.server.management.ManagedObjectRegistry;
-import org.apache.qpid.server.management.ManagementConfiguration;
 import org.apache.qpid.server.management.NoopManagedObjectRegistry;
 import org.apache.qpid.server.plugins.PluginManager;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
+import org.apache.qpid.server.security.access.ACLManager;
 import org.apache.qpid.server.security.auth.database.ConfigurationFilePrincipalDatabaseManager;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabaseManager;
 import org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager;
-import org.apache.qpid.server.security.access.ACLPlugin;
-import org.apache.qpid.server.security.access.ACLManager;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-import org.apache.qpid.AMQException;
 
 public class ConfigurationFileApplicationRegistry extends ApplicationRegistry
 {
 
     public ConfigurationFileApplicationRegistry(File configurationURL) throws ConfigurationException
     {
-        super(config(configurationURL));
-    }
-
-    // Our configuration class needs to make the interpolate method
-    // public so it can be called below from the config method.
-    private static class MyConfiguration extends CompositeConfiguration
-    {
-        public String interpolate(String obj)
-        {
-            return super.interpolate(obj);
-        }
-    }
-
-    private static final Configuration config(File url) throws ConfigurationException
-    {
-        // We have to override the interpolate methods so that
-        // interpolation takes place accross the entirety of the
-        // composite configuration. Without doing this each
-        // configuration object only interpolates variables defined
-        // inside itself.
-        final MyConfiguration conf = new MyConfiguration();
-        conf.addConfiguration(new SystemConfiguration()
-        {
-            protected String interpolate(String o)
-            {
-                return conf.interpolate(o);
-            }
-        });
-        conf.addConfiguration(new XMLConfiguration(url)
-        {
-            protected String interpolate(String o)
-            {
-                return conf.interpolate(o);
-            }
-        });
-        return conf;
+        super(new ServerConfiguration(configurationURL));
     }
 
     public void initialise() throws Exception
@@ -94,9 +48,9 @@
 
         _virtualHostRegistry = new VirtualHostRegistry();
 
-        _pluginManager = new PluginManager(_configuration.getString("plugin-directory"));
+        _pluginManager = new PluginManager(_configuration.getPluginDirectory());
 
-        _accessManager = new ACLManager(_configuration, _pluginManager);
+        _accessManager = new ACLManager(_configuration.getSecurityConfiguration(), _pluginManager);
         
         _databaseManager = new ConfigurationFilePrincipalDatabaseManager(_configuration);
 
@@ -111,18 +65,17 @@
     }
 
     private void initialiseVirtualHosts() throws Exception
-    {
-        for (String name : getVirtualHostNames())
+    {        
+        for (String name : _configuration.getVirtualHosts())
         {
-
-            _virtualHostRegistry.registerVirtualHost(new VirtualHost(name, getConfiguration().subset("virtualhosts.virtualhost." + name)));
+            _virtualHostRegistry.registerVirtualHost(new VirtualHost(_configuration.getVirtualHostConfig(name)));
         }
+        getVirtualHostRegistry().setDefaultVirtualHostName(_configuration.getDefaultVirtualHost());
     }
 
     private void initialiseManagedObjectRegistry() throws AMQException
     {
-        ManagementConfiguration config = getConfiguredObject(ManagementConfiguration.class);
-        if (config.enabled)
+        if (_configuration.getManagementEnabled())
         {
             _managedObjectRegistry = new JMXManagedObjectRegistry();
         }
@@ -131,10 +84,4 @@
             _managedObjectRegistry = new NoopManagedObjectRegistry();
         }
     }
-
-    public Collection<String> getVirtualHostNames()
-    {
-        return getConfiguration().getList("virtualhosts.virtualhost.name");
-    }
-
 }

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java Mon Apr 13 12:42:38 2009
@@ -24,6 +24,7 @@
 import java.net.InetSocketAddress;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.management.ManagedObjectRegistry;
 import org.apache.qpid.server.plugins.PluginManager;
 import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
@@ -49,21 +50,11 @@
     void close() throws Exception;
 
     /**
-     * This gets access to a "configured object". A configured object has fields populated from a the configuration
-     * object (Commons Configuration) automatically, where it has the appropriate attributes defined on fields.
-     * Application registry implementations can choose the refresh strategy or caching approach.
-     * @param instanceType the type of object you want initialised. This must be unique - i.e. you can only
-     * have a single object of this type in the system.
-     * @return the configured object
-     */
-    <T> T getConfiguredObject(Class<T> instanceType);
-
-    /**
      * Get the low level configuration. For use cases where the configured object approach is not required
      * you can get the complete configuration information.
      * @return a Commons Configuration instance
      */
-    Configuration getConfiguration();
+    ServerConfiguration getConfiguration();
 
     ManagedObjectRegistry getManagedObjectRegistry();
 
@@ -71,8 +62,6 @@
 
     AuthenticationManager getAuthenticationManager();
 
-    Collection<String> getVirtualHostNames();
-
     VirtualHostRegistry getVirtualHostRegistry();
 
     ACLManager getAccessManager();

Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLManager.java?rev=764428&r1=764427&r2=764428&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLManager.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/ACLManager.java Mon Apr 13 12:42:38 2009
@@ -30,6 +30,9 @@
 import org.apache.commons.configuration.Configuration;
 import org.apache.log4j.Logger;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.server.configuration.SecurityConfiguration;
+import org.apache.qpid.server.configuration.ServerConfiguration;
+import org.apache.qpid.server.configuration.VirtualHostConfiguration;
 import org.apache.qpid.server.exchange.Exchange;
 import org.apache.qpid.server.plugins.PluginManager;
 import org.apache.qpid.server.protocol.AMQProtocolSession;
@@ -46,12 +49,12 @@
     private Map<String, ACLPlugin> _globalPlugins = new HashMap<String, ACLPlugin>();
     private Map<String, ACLPlugin> _hostPlugins = new HashMap<String, ACLPlugin>();
 
-    public ACLManager(Configuration configuration, PluginManager manager)
+    public ACLManager(SecurityConfiguration configuration, PluginManager manager)
     {
         this(configuration, manager, null);
     }
 
-    public ACLManager(Configuration configuration, PluginManager manager, ACLPluginFactory securityPlugin)
+    public ACLManager(SecurityConfiguration configuration, PluginManager manager, ACLPluginFactory securityPlugin)
     {
         _pluginManager = manager;
 
@@ -70,14 +73,14 @@
     }
 
 
-    public void configureHostPlugins(Configuration hostConfig)
+    public void configureHostPlugins(SecurityConfiguration hostConfig)
     {
         _hostPlugins = configurePlugins(hostConfig);
     }
     
-    public Map<String, ACLPlugin> configurePlugins(Configuration configuration)
+    public Map<String, ACLPlugin> configurePlugins(SecurityConfiguration hostConfig)
     {
-        Configuration securityConfig = configuration.subset("security");
+        Configuration securityConfig = hostConfig.getConfiguration();
         Map<String, ACLPlugin> plugins = new HashMap<String, ACLPlugin>();
         Iterator keys = securityConfig.getKeys();
         Collection<String> handledTags = new HashSet();
@@ -86,7 +89,6 @@
             // Splitting the string is necessary here because of the way that getKeys() returns only
             // bottom level children
             String tag = ((String) keys.next()).split("\\.", 2)[0];
-            
             if (!handledTags.contains(tag))
             {
                 for (ACLPluginFactory plugin : _allSecurityPlugins.values())



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message