qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1585979 [3/6] - in /qpid/trunk/qpid/java: bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/ broker-core/src/main/java/org/apache/qpid/server/binding/ br...
Date Wed, 09 Apr 2014 14:13:17 GMT
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java Wed Apr  9 14:13:13 2014
@@ -32,6 +32,8 @@ import org.apache.qpid.server.configurat
 import org.apache.qpid.server.logging.messages.BrokerMessages;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.KeyStore;
+import org.apache.qpid.server.model.ManagedAttribute;
+import org.apache.qpid.server.model.ManagedAttributeField;
 import org.apache.qpid.server.model.ManagedObject;
 import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.Transport;
@@ -48,13 +50,21 @@ import org.apache.qpid.transport.network
 @ManagedObject( category = false, type = "AMQP")
 public class AmqpPort extends PortWithAuthProvider<AmqpPort>
 {
-    public static final int DEFAULT_AMQP_SEND_BUFFER_SIZE = 262144;
-    public static final int DEFAULT_AMQP_RECEIVE_BUFFER_SIZE = 262144;
-    public static final boolean DEFAULT_AMQP_NEED_CLIENT_AUTH = false;
-    public static final boolean DEFAULT_AMQP_WANT_CLIENT_AUTH = false;
-    public static final boolean DEFAULT_AMQP_TCP_NO_DELAY = true;
+    public static final String DEFAULT_AMQP_SEND_BUFFER_SIZE = "262144";
+    public static final String DEFAULT_AMQP_RECEIVE_BUFFER_SIZE = "262144";
+
+    public static final String DEFAULT_AMQP_TCP_NO_DELAY = "true";
     public static final String DEFAULT_AMQP_BINDING = "*";
 
+    @ManagedAttributeField
+    private boolean _tcpNoDelay;
+
+    @ManagedAttributeField
+    private int _sendBufferSize;
+
+    @ManagedAttributeField
+    private int _receiveBufferSize;
+
     private final Broker<?> _broker;
     private AcceptingTransport _transport;
 
@@ -74,16 +84,30 @@ public class AmqpPort extends PortWithAu
         defaults.put(BINDING_ADDRESS, DEFAULT_AMQP_BINDING);
         defaults.put(NAME, attributes.containsKey(BINDING_ADDRESS) ? attributes.get(BINDING_ADDRESS) : DEFAULT_AMQP_BINDING + ":" + attributes.get(PORT));
         defaults.put(PROTOCOLS, getDefaultProtocols());
-        defaults.put(TCP_NO_DELAY, DEFAULT_AMQP_TCP_NO_DELAY);
-        defaults.put(WANT_CLIENT_AUTH, DEFAULT_AMQP_WANT_CLIENT_AUTH);
-        defaults.put(NEED_CLIENT_AUTH, DEFAULT_AMQP_NEED_CLIENT_AUTH);
-        defaults.put(RECEIVE_BUFFER_SIZE, DEFAULT_AMQP_RECEIVE_BUFFER_SIZE);
-        defaults.put(SEND_BUFFER_SIZE, DEFAULT_AMQP_SEND_BUFFER_SIZE);
+
 
         return defaults;
     }
 
 
+    @ManagedAttribute( automate = true , defaultValue = DEFAULT_AMQP_TCP_NO_DELAY )
+    public boolean isTcpNoDelay()
+    {
+        return _tcpNoDelay;
+    }
+
+    @ManagedAttribute( automate = true , defaultValue = DEFAULT_AMQP_SEND_BUFFER_SIZE )
+    public int getSendBufferSize()
+    {
+        return _sendBufferSize;
+    }
+
+    @ManagedAttribute( automate = true , defaultValue = DEFAULT_AMQP_RECEIVE_BUFFER_SIZE )
+    public int getReceiveBufferSize()
+    {
+        return _receiveBufferSize;
+    }
+
     private static Set<Protocol> getDefaultProtocols()
     {
         Set<Protocol> defaultProtocols = EnumSet.of(Protocol.AMQP_0_8, Protocol.AMQP_0_9, Protocol.AMQP_0_9_1,

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java Wed Apr  9 14:13:13 2014
@@ -20,14 +20,14 @@
  */
 package org.apache.qpid.server.model.port;
 
-import org.apache.qpid.server.configuration.updater.TaskExecutor;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.ManagedObject;
-
 import java.util.Collections;
 import java.util.Map;
 import java.util.UUID;
 
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ManagedObject;
+
 @ManagedObject( category = false, type = "JMX")
 public class JmxPort extends PortWithAuthProvider<JmxPort>
 {
@@ -37,8 +37,12 @@ public class JmxPort extends PortWithAut
                    final TaskExecutor taskExecutor)
     {
         super(id, broker, attributes, Collections.<String,Object>emptyMap(), taskExecutor);
+    }
 
-        validateOnlyOneInstance(broker);
-
+    @Override
+    public void validate()
+    {
+        super.validate();
+        validateOnlyOneInstance();
     }
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java Wed Apr  9 14:13:13 2014
@@ -20,20 +20,31 @@
  */
 package org.apache.qpid.server.model.port;
 
+import java.util.Map;
+import java.util.UUID;
+
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ManagedAttribute;
-import org.apache.qpid.server.model.Port;
-
-import java.util.Map;
-import java.util.UUID;
+import org.apache.qpid.server.model.ManagedAttributeField;
+import org.apache.qpid.server.model.Transport;
 
 abstract public class PortWithAuthProvider<X extends PortWithAuthProvider<X>> extends AbstractPort<X>
 {
+    public static final String DEFAULT_AMQP_NEED_CLIENT_AUTH = "false";
+    public static final String DEFAULT_AMQP_WANT_CLIENT_AUTH = "false";
+
+    @ManagedAttributeField
     private AuthenticationProvider _authenticationProvider;
 
+    @ManagedAttributeField
+    private boolean _needClientAuth;
+
+    @ManagedAttributeField
+    private boolean _wantClientAuth;
+
     public PortWithAuthProvider(final UUID id,
                                 final Broker<?> broker,
                                 final Map<String, Object> attributes,
@@ -41,23 +52,48 @@ abstract public class PortWithAuthProvid
                                 final TaskExecutor taskExecutor)
     {
         super(id, broker, attributes, defaults, taskExecutor);
-        String authProvider = (String)getAttribute(Port.AUTHENTICATION_PROVIDER);
-        if (authProvider == null)
-        {
-            throw new IllegalConfigurationException("An authentication provider must be specified for port : " + getName());
-        }
-        _authenticationProvider = broker.findAuthenticationProviderByName(authProvider);
+    }
 
-        if(_authenticationProvider == null)
-        {
-            throw new IllegalConfigurationException("The authentication provider '" + authProvider + "' could not be found for port : " + getName());
-        }
+    @ManagedAttribute( automate = true, defaultValue = DEFAULT_AMQP_NEED_CLIENT_AUTH )
+    public boolean getNeedClientAuth()
+    {
+        return _needClientAuth;
     }
 
+    @ManagedAttribute( automate = true, defaultValue = DEFAULT_AMQP_WANT_CLIENT_AUTH )
+    public boolean getWantClientAuth()
+    {
+        return _wantClientAuth;
+    }
 
-    @ManagedAttribute
+    @ManagedAttribute( automate = true, mandatory = true )
     public AuthenticationProvider getAuthenticationProvider()
     {
+        Broker<?> broker = getParent(Broker.class);
+        if(broker.isManagementMode())
+        {
+            return broker.getManagementModeAuthenticationProvider();
+        }
         return _authenticationProvider;
     }
+
+    @Override
+    public void validate()
+    {
+        super.validate();
+        boolean useClientAuth = getNeedClientAuth() || getWantClientAuth();
+
+        if(useClientAuth && (getTrustStores() == null || getTrustStores().isEmpty()))
+        {
+            throw new IllegalConfigurationException("Can't create port which requests SSL client certificates but has no trust stores configured.");
+        }
+
+        boolean useTLSTransport = getTransports().contains(Transport.SSL) || getTransports().contains(Transport.WSS);
+        if(useClientAuth && !useTLSTransport)
+        {
+            throw new IllegalConfigurationException(
+                    "Can't create port which requests SSL client certificates but doesn't use SSL transport.");
+        }
+
+    }
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/RmiPort.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/RmiPort.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/RmiPort.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/RmiPort.java Wed Apr  9 14:13:13 2014
@@ -20,16 +20,16 @@
  */
 package org.apache.qpid.server.model.port;
 
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ManagedObject;
 import org.apache.qpid.server.model.Transport;
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
 @ManagedObject( category = false, type = "RMI")
 public class RmiPort extends AbstractPort<RmiPort>
 {
@@ -39,12 +39,19 @@ public class RmiPort extends AbstractPor
                    final TaskExecutor taskExecutor)
     {
         super(id, broker, attributes, Collections.<String,Object>emptyMap(), taskExecutor);
+    }
 
-        validateOnlyOneInstance(broker);
+    @Override
+    public void validate()
+    {
+        super.validate();
+
+        validateOnlyOneInstance();
 
         if (getTransports().contains(Transport.SSL))
         {
             throw new IllegalConfigurationException("Can't create RMI registry port which requires SSL");
         }
+
     }
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java Wed Apr  9 14:13:13 2014
@@ -24,13 +24,13 @@ import java.util.Map;
 
 import org.apache.qpid.server.exchange.ExchangeImpl;
 import org.apache.qpid.server.virtualhost.UnknownExchangeException;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 public interface ExchangeType<T extends ExchangeImpl<T>> extends Pluggable
 {
     public String getType();
 
-    public T newInstance(final VirtualHost virtualHost, Map<String, Object> attributes) throws UnknownExchangeException;
+    public T newInstance(final VirtualHostImpl virtualHost, Map<String, Object> attributes) throws UnknownExchangeException;
 
     public String getDefaultExchangeName();
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageConverter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageConverter.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageConverter.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageConverter.java Wed Apr  9 14:13:13 2014
@@ -21,12 +21,12 @@
 package org.apache.qpid.server.plugin;
 
 import org.apache.qpid.server.message.ServerMessage;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 public interface MessageConverter<M extends ServerMessage, N extends ServerMessage> extends Pluggable
 {
     Class<M> getInputClass();
     Class<N> getOutputClass();
 
-    N convert(M message, VirtualHost vhost);
+    N convert(M message, VirtualHostImpl vhost);
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/SystemNodeCreator.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/SystemNodeCreator.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/SystemNodeCreator.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/SystemNodeCreator.java Wed Apr  9 14:13:13 2014
@@ -21,7 +21,7 @@
 package org.apache.qpid.server.plugin;
 
 import org.apache.qpid.server.message.MessageNode;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 public interface SystemNodeCreator extends Pluggable
 {
@@ -30,7 +30,7 @@ public interface SystemNodeCreator exten
         void registerSystemNode(MessageNode node);
         void removeSystemNode(MessageNode node);
 
-        VirtualHost getVirtualHost();
+        VirtualHostImpl getVirtualHost();
         org.apache.qpid.server.model.VirtualHost getVirtualHostModel();
     }
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java Wed Apr  9 14:13:13 2014
@@ -26,14 +26,13 @@ import org.apache.qpid.server.exchange.E
 import org.apache.qpid.server.logging.LogSubject;
 import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.message.MessageSource;
-import org.apache.qpid.server.model.Binding;
 import org.apache.qpid.server.model.ExclusivityPolicy;
 import org.apache.qpid.server.model.LifetimePolicy;
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.model.QueueNotificationListener;
 import org.apache.qpid.server.protocol.CapacityChecker;
 import org.apache.qpid.server.util.Deletable;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 import java.util.Collection;
 import java.util.List;
@@ -68,7 +67,7 @@ public interface AMQQueue<X extends AMQQ
 
     String getOwner();
 
-    VirtualHost getVirtualHost();
+    VirtualHostImpl getVirtualHost();
 
     public Collection<QueueConsumer<?>> getConsumers();
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java Wed Apr  9 14:13:13 2014
@@ -39,7 +39,7 @@ import org.apache.qpid.server.util.Serve
 import org.apache.qpid.server.virtualhost.ExchangeExistsException;
 import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
 import org.apache.qpid.server.virtualhost.UnknownExchangeException;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 import org.apache.qpid.server.virtualhost.QueueExistsException;
 
 public class AMQQueueFactory implements QueueFactory
@@ -50,10 +50,10 @@ public class AMQQueueFactory implements 
     public static final String DLQ_ROUTING_KEY = "dlq";
     private static final int MAX_LENGTH = 255;
 
-    private final VirtualHost _virtualHost;
+    private final VirtualHostImpl _virtualHost;
     private final QueueRegistry _queueRegistry;
 
-    public AMQQueueFactory(VirtualHost virtualHost, QueueRegistry queueRegistry)
+    public AMQQueueFactory(VirtualHostImpl virtualHost, QueueRegistry queueRegistry)
     {
         _virtualHost = virtualHost;
         _queueRegistry = queueRegistry;
@@ -99,7 +99,7 @@ public class AMQQueueFactory implements 
         {
             queue = new StandardQueue(_virtualHost, attributes);
         }
-
+        queue.open();
         //Register the new queue
         _queueRegistry.registerQueue(queue);
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java Wed Apr  9 14:13:13 2014
@@ -23,7 +23,15 @@ import java.security.AccessControlExcept
 import java.security.AccessController;
 import java.security.Principal;
 import java.security.PrivilegedAction;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentSkipListSet;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Executor;
@@ -32,30 +40,40 @@ import java.util.concurrent.atomic.Atomi
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
+import javax.security.auth.Subject;
+
 import org.apache.log4j.Logger;
+
+import org.apache.qpid.pool.ReferenceCountingExecutorService;
 import org.apache.qpid.server.binding.BindingImpl;
+import org.apache.qpid.server.configuration.BrokerProperties;
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.connection.SessionPrincipal;
 import org.apache.qpid.server.consumer.ConsumerImpl;
+import org.apache.qpid.server.consumer.ConsumerTarget;
 import org.apache.qpid.server.exchange.ExchangeImpl;
-import org.apache.qpid.server.logging.EventLogger;
-import org.apache.qpid.server.message.MessageSource;
-import org.apache.qpid.server.model.*;
-import org.apache.qpid.server.model.Queue;
-import org.apache.qpid.server.model.AbstractConfiguredObject;
-import org.apache.qpid.server.protocol.AMQConnectionModel;
-import org.apache.qpid.pool.ReferenceCountingExecutorService;
-import org.apache.qpid.server.configuration.BrokerProperties;
 import org.apache.qpid.server.filter.FilterManager;
+import org.apache.qpid.server.logging.EventLogger;
 import org.apache.qpid.server.logging.LogSubject;
 import org.apache.qpid.server.logging.messages.QueueMessages;
 import org.apache.qpid.server.logging.subjects.QueueLogSubject;
 import org.apache.qpid.server.message.InstanceProperties;
 import org.apache.qpid.server.message.MessageInstance;
 import org.apache.qpid.server.message.MessageReference;
+import org.apache.qpid.server.message.MessageSource;
 import org.apache.qpid.server.message.ServerMessage;
+import org.apache.qpid.server.model.AbstractConfiguredObject;
+import org.apache.qpid.server.model.Binding;
+import org.apache.qpid.server.model.ConfigurationChangeListener;
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.model.Exchange;
+import org.apache.qpid.server.model.ExclusivityPolicy;
+import org.apache.qpid.server.model.LifetimePolicy;
+import org.apache.qpid.server.model.Queue;
+import org.apache.qpid.server.model.QueueNotificationListener;
+import org.apache.qpid.server.model.State;
+import org.apache.qpid.server.protocol.AMQConnectionModel;
 import org.apache.qpid.server.protocol.AMQSessionModel;
-import org.apache.qpid.server.consumer.ConsumerTarget;
 import org.apache.qpid.server.security.SecurityManager;
 import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
 import org.apache.qpid.server.store.DurableConfigurationStoreHelper;
@@ -68,9 +86,7 @@ import org.apache.qpid.server.util.Delet
 import org.apache.qpid.server.util.MapValueConverter;
 import org.apache.qpid.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.server.util.StateChangeListener;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-import javax.security.auth.Subject;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 public abstract class AbstractQueue
         extends AbstractConfiguredObject<AbstractQueue>
@@ -98,13 +114,13 @@ public abstract class AbstractQueue
         }
     };
 
-    private final VirtualHost _virtualHost;
+    private final VirtualHostImpl _virtualHost;
     private final DeletedChildListener _deletedChildListener = new DeletedChildListener();
 
     /** null means shared */
     private String _description;
 
-    private final boolean _durable;
+    private boolean _durable;
 
     private ExchangeImpl _alternateExchange;
 
@@ -186,14 +202,14 @@ public abstract class AbstractQueue
 
     private final AtomicBoolean _overfull = new AtomicBoolean(false);
     private final CopyOnWriteArrayList<BindingImpl> _bindings = new CopyOnWriteArrayList<BindingImpl>();
-    private final Map<String, Object> _arguments;
+    private Map<String, Object> _arguments;
 
     //TODO : persist creation time
     private long _createTime = System.currentTimeMillis();
 
     /** the maximum delivery count for each message on this queue or 0 if maximum delivery count is not to be enforced. */
     private int _maximumDeliveryCount;
-    private final MessageGroupManager _messageGroupManager;
+    private MessageGroupManager _messageGroupManager;
 
     private final Collection<ConsumerRegistrationListener<? super MessageSource>> _consumerListeners =
             new ArrayList<ConsumerRegistrationListener<? super MessageSource>>();
@@ -201,14 +217,25 @@ public abstract class AbstractQueue
     private QueueNotificationListener  _notificationListener;
     private final long[] _lastNotificationTimes = new long[NotificationCheck.values().length];
 
-    protected AbstractQueue(VirtualHost virtualHost,
+    protected AbstractQueue(VirtualHostImpl virtualHost,
                             Map<String, Object> attributes,
                             QueueEntryListFactory entryListFactory)
     {
-        super(MapValueConverter.getUUIDAttribute(Queue.ID, attributes),
+        super(Collections.<Class<? extends ConfiguredObject>, ConfiguredObject<?>>singletonMap(org.apache.qpid.server.model.VirtualHost.class, (org.apache.qpid.server.model.VirtualHost)virtualHost),
               Collections.<String,Object>emptyMap(), attributes, virtualHost.getTaskExecutor());
 
-        if (virtualHost == null)
+        _entries = entryListFactory.createQueueEntryList(this);
+        _virtualHost = virtualHost;
+        _asyncDelivery = ReferenceCountingExecutorService.getInstance().acquireExecutorService();
+
+
+
+    }
+
+    public void validate()
+    {
+        super.validate();
+        if (_virtualHost == null)
         {
             throw new IllegalArgumentException("Virtual Host must not be null");
         }
@@ -218,7 +245,16 @@ public abstract class AbstractQueue
             throw new IllegalArgumentException("Queue name must not be null");
         }
 
-        boolean durable = MapValueConverter.getBooleanAttribute(Queue.DURABLE,attributes,false);
+
+    }
+
+    protected void onOpen()
+    {
+        super.onOpen();
+
+        Map<String,Object> attributes = getActualAttributes();
+
+        boolean durable = MapValueConverter.getBooleanAttribute(Queue.DURABLE, attributes, false);
 
 
         _exclusivityPolicy = MapValueConverter.getEnumAttribute(ExclusivityPolicy.class,
@@ -231,8 +267,6 @@ public abstract class AbstractQueue
                                                              LifetimePolicy.PERMANENT);
 
         _durable = durable;
-        _virtualHost = virtualHost;
-        _entries = entryListFactory.createQueueEntryList(this);
         final LinkedHashMap<String, Object> arguments = new LinkedHashMap<String, Object>(attributes);
 
         arguments.put(Queue.EXCLUSIVE, _exclusivityPolicy);
@@ -243,11 +277,10 @@ public abstract class AbstractQueue
 
         _noLocal = MapValueConverter.getBooleanAttribute(Queue.NO_LOCAL, attributes, false);
 
-        _asyncDelivery = ReferenceCountingExecutorService.getInstance().acquireExecutorService();
 
         _logSubject = new QueueLogSubject(this);
 
-        virtualHost.getSecurityManager().authoriseCreateQueue(this);
+        _virtualHost.getSecurityManager().authoriseCreateQueue(this);
 
         Subject activeSubject = Subject.getSubject(AccessController.getContext());
         Set<SessionPrincipal> sessionPrincipals = activeSubject == null ? Collections.<SessionPrincipal>emptySet() : activeSubject.getPrincipals(SessionPrincipal.class);
@@ -338,15 +371,13 @@ public abstract class AbstractQueue
         }
 
 
-
-
         if (attributes.containsKey(Queue.ALERT_THRESHOLD_MESSAGE_AGE))
         {
             setMaximumMessageAge(MapValueConverter.getLongAttribute(Queue.ALERT_THRESHOLD_MESSAGE_AGE, attributes));
         }
         else
         {
-            setMaximumMessageAge(virtualHost.getDefaultAlertThresholdMessageAge());
+            setMaximumMessageAge(_virtualHost.getDefaultAlertThresholdMessageAge());
         }
         if (attributes.containsKey(Queue.ALERT_THRESHOLD_MESSAGE_SIZE))
         {
@@ -354,7 +385,7 @@ public abstract class AbstractQueue
         }
         else
         {
-            setMaximumMessageSize(virtualHost.getDefaultAlertThresholdMessageSize());
+            setMaximumMessageSize(_virtualHost.getDefaultAlertThresholdMessageSize());
         }
         if (attributes.containsKey(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES))
         {
@@ -363,7 +394,7 @@ public abstract class AbstractQueue
         }
         else
         {
-            setMaximumMessageCount(virtualHost.getDefaultAlertThresholdQueueDepthMessages());
+            setMaximumMessageCount(_virtualHost.getDefaultAlertThresholdQueueDepthMessages());
         }
         if (attributes.containsKey(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_BYTES))
         {
@@ -372,7 +403,7 @@ public abstract class AbstractQueue
         }
         else
         {
-            setMaximumQueueDepth(virtualHost.getDefaultAlertThresholdQueueDepthBytes());
+            setMaximumQueueDepth(_virtualHost.getDefaultAlertThresholdQueueDepthBytes());
         }
         if (attributes.containsKey(Queue.ALERT_REPEAT_GAP))
         {
@@ -380,7 +411,7 @@ public abstract class AbstractQueue
         }
         else
         {
-            setMinimumAlertRepeatGap(virtualHost.getDefaultAlertRepeatGap());
+            setMinimumAlertRepeatGap(_virtualHost.getDefaultAlertRepeatGap());
         }
         if (attributes.containsKey(Queue.QUEUE_FLOW_CONTROL_SIZE_BYTES))
         {
@@ -388,7 +419,7 @@ public abstract class AbstractQueue
         }
         else
         {
-            setCapacity(virtualHost.getDefaultQueueFlowControlSizeBytes());
+            setCapacity(_virtualHost.getDefaultQueueFlowControlSizeBytes());
         }
         if (attributes.containsKey(Queue.QUEUE_FLOW_RESUME_SIZE_BYTES))
         {
@@ -396,7 +427,7 @@ public abstract class AbstractQueue
         }
         else
         {
-            setFlowResumeCapacity(virtualHost.getDefaultQueueFlowResumeSizeBytes());
+            setFlowResumeCapacity(_virtualHost.getDefaultQueueFlowResumeSizeBytes());
         }
         if (attributes.containsKey(Queue.MAXIMUM_DELIVERY_ATTEMPTS))
         {
@@ -404,7 +435,7 @@ public abstract class AbstractQueue
         }
         else
         {
-            setMaximumDeliveryCount(virtualHost.getDefaultMaximumDeliveryAttempts());
+            setMaximumDeliveryCount(_virtualHost.getDefaultMaximumDeliveryAttempts());
         }
 
         final String ownerString = getOwner();
@@ -443,7 +474,6 @@ public abstract class AbstractQueue
         }
 
         resetNotifications();
-
     }
 
     private void addLifetimeConstraint(final Deletable<? extends Deletable> lifetimeObject)
@@ -670,7 +700,7 @@ public abstract class AbstractQueue
         return null;
     }
 
-    public VirtualHost getVirtualHost()
+    public VirtualHostImpl getVirtualHost()
     {
         return _virtualHost;
     }
@@ -2854,16 +2884,6 @@ public abstract class AbstractQueue
     }
 
     @Override
-    public <T extends ConfiguredObject> T getParent(final Class<T> clazz)
-    {
-        if(clazz == org.apache.qpid.server.model.VirtualHost.class)
-        {
-            return (T) _virtualHost.getModel();
-        }
-        return super.getParent(clazz);
-    }
-
-    @Override
     protected <C extends ConfiguredObject> C addChild(final Class<C> childClass,
                                                       final Map<String, Object> attributes,
                                                       final ConfiguredObject... otherParents)

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/ConflationQueue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/ConflationQueue.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/ConflationQueue.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/ConflationQueue.java Wed Apr  9 14:13:13 2014
@@ -24,16 +24,15 @@ package org.apache.qpid.server.queue;
 import java.util.Map;
 
 import org.apache.qpid.server.model.Queue;
-import org.apache.qpid.server.protocol.AMQSessionModel;
 import org.apache.qpid.server.util.MapValueConverter;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 public class ConflationQueue extends AbstractQueue
 {
     public static final String DEFAULT_LVQ_KEY = "qpid.LVQ_key";
 
 
-    protected ConflationQueue(VirtualHost virtualHost,
+    protected ConflationQueue(VirtualHostImpl virtualHost,
                               Map<String, Object> attributes)
     {
         super(virtualHost, attributes, entryList(attributes));

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/DefaultQueueRegistry.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/DefaultQueueRegistry.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/DefaultQueueRegistry.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/DefaultQueueRegistry.java Wed Apr  9 14:13:13 2014
@@ -26,22 +26,22 @@ import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 public class DefaultQueueRegistry implements QueueRegistry
 {
     private ConcurrentMap<String, AMQQueue<?>> _queueMap = new ConcurrentHashMap<String, AMQQueue<?>>();
 
-    private final VirtualHost _virtualHost;
+    private final VirtualHostImpl _virtualHost;
     private final Collection<RegistryChangeListener> _listeners =
             new ArrayList<RegistryChangeListener>();
 
-    public DefaultQueueRegistry(VirtualHost virtualHost)
+    public DefaultQueueRegistry(VirtualHostImpl virtualHost)
     {
         _virtualHost = virtualHost;
     }
 
-    public VirtualHost getVirtualHost()
+    public VirtualHostImpl getVirtualHost()
     {
         return _virtualHost;
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java Wed Apr  9 14:13:13 2014
@@ -20,14 +20,14 @@
  */
 package org.apache.qpid.server.queue;
 
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 import java.util.Map;
 
 public abstract class OutOfOrderQueue extends AbstractQueue
 {
 
-    protected OutOfOrderQueue(VirtualHost virtualHost,
+    protected OutOfOrderQueue(VirtualHostImpl virtualHost,
                               Map<String, Object> attributes,
                               QueueEntryListFactory entryListFactory)
     {

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueue.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueue.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueue.java Wed Apr  9 14:13:13 2014
@@ -21,9 +21,8 @@
 package org.apache.qpid.server.queue;
 
 import org.apache.qpid.server.model.Queue;
-import org.apache.qpid.server.protocol.AMQSessionModel;
 import org.apache.qpid.server.util.MapValueConverter;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 import java.util.Map;
 
@@ -32,7 +31,7 @@ public class PriorityQueue extends OutOf
 
     public static final int DEFAULT_PRIORITY_LEVELS = 10;
 
-    protected PriorityQueue(VirtualHost virtualHost,
+    protected PriorityQueue(VirtualHostImpl virtualHost,
                             Map<String, Object> attributes)
     {
         super(virtualHost, attributes, entryList(attributes));

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java Wed Apr  9 14:13:13 2014
@@ -20,7 +20,26 @@
  */
 package org.apache.qpid.server.queue;
 
+import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.SUBSCRIPTION_FORMAT;
+
+import java.security.AccessControlException;
+import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
 import org.apache.log4j.Logger;
+
+import org.apache.qpid.server.consumer.ConsumerTarget;
 import org.apache.qpid.server.filter.FilterManager;
 import org.apache.qpid.server.filter.JMSSelectorFilter;
 import org.apache.qpid.server.filter.MessageFilter;
@@ -31,26 +50,15 @@ import org.apache.qpid.server.logging.su
 import org.apache.qpid.server.message.MessageInstance;
 import org.apache.qpid.server.message.MessageSource;
 import org.apache.qpid.server.message.ServerMessage;
+import org.apache.qpid.server.model.AbstractConfiguredObject;
 import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.LifetimePolicy;
 import org.apache.qpid.server.model.ManagedAttributeField;
 import org.apache.qpid.server.model.State;
-import org.apache.qpid.server.model.AbstractConfiguredObject;
 import org.apache.qpid.server.protocol.AMQSessionModel;
 import org.apache.qpid.server.protocol.MessageConverterRegistry;
-import org.apache.qpid.server.consumer.ConsumerTarget;
 import org.apache.qpid.server.util.StateChangeListener;
 
-import java.security.AccessControlException;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.SUBSCRIPTION_FORMAT;
-
 class QueueConsumerImpl
     extends AbstractConfiguredObject<QueueConsumerImpl>
         implements QueueConsumer<QueueConsumerImpl>, LogSubject
@@ -125,11 +133,13 @@ class QueueConsumerImpl
         _isTransient = optionSet.contains(Option.TRANSIENT);
         _target = target;
         _queue = queue;
-        setupLogging();
 
         // Access control
         _queue.getVirtualHost().getSecurityManager().authoriseCreateConsumer(this);
 
+        open();
+
+        setupLogging();
 
         _target.setStateListener(
                 new StateChangeListener<ConsumerTarget, ConsumerTarget.State>()

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRegistry.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRegistry.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRegistry.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRegistry.java Wed Apr  9 14:13:13 2014
@@ -23,11 +23,11 @@ package org.apache.qpid.server.queue;
 import java.util.Collection;
 import java.util.UUID;
 
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 public interface QueueRegistry
 {
-    VirtualHost getVirtualHost();
+    VirtualHostImpl getVirtualHost();
 
     void registerQueue(AMQQueue<?> queue);
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java Wed Apr  9 14:13:13 2014
@@ -24,7 +24,7 @@ import org.apache.qpid.server.message.Se
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.util.Action;
 import org.apache.qpid.server.util.MapValueConverter;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 import java.util.Map;
 
@@ -36,7 +36,7 @@ public class SortedQueue extends OutOfOr
     private final Object _sortedQueueLock = new Object();
     private final String _sortedPropertyName;
 
-    protected SortedQueue(VirtualHost virtualHost,
+    protected SortedQueue(VirtualHostImpl virtualHost,
                           Map<String, Object> attributes,
                           QueueEntryListFactory factory)
     {
@@ -45,7 +45,7 @@ public class SortedQueue extends OutOfOr
     }
 
 
-    protected SortedQueue(VirtualHost virtualHost,
+    protected SortedQueue(VirtualHostImpl virtualHost,
                           Map<String, Object> attributes)
     {
         this(virtualHost,
@@ -69,4 +69,4 @@ public class SortedQueue extends OutOfOr
             super.enqueue(message, action);
         }
     }
-}
\ No newline at end of file
+}

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/StandardQueue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/StandardQueue.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/StandardQueue.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/StandardQueue.java Wed Apr  9 14:13:13 2014
@@ -20,14 +20,13 @@
  */
 package org.apache.qpid.server.queue;
 
-import org.apache.qpid.server.protocol.AMQSessionModel;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
 import java.util.Map;
 
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
+
 public class StandardQueue extends AbstractQueue
 {
-    public StandardQueue(final VirtualHost virtualHost,
+    public StandardQueue(final VirtualHostImpl virtualHost,
                          final Map<String, Object> arguments)
     {
         super(virtualHost, arguments, new StandardQueueEntryList.Factory());

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java Wed Apr  9 14:13:13 2014
@@ -80,6 +80,7 @@ public class ApplicationRegistry impleme
         _broker = upgrader.upgrade(_store);
 
         _broker.setEventLogger(startupLogger);
+        _broker.open();
 
         // starting the broker
         _broker.setDesiredState(State.INITIALISING, State.ACTIVE);

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java Wed Apr  9 14:13:13 2014
@@ -87,12 +87,16 @@ public class FileKeyStore extends Abstra
     {
         super(id, broker, DEFAULTS, attributes);
         _broker = broker;
+    }
 
+    @Override
+    public void validate()
+    {
+        super.validate();
         validateKeyStoreAttributes(_keyStoreType, _path, getPassword(),
                                    _certificateAlias, _keyManagerFactoryAlgorithm);
     }
 
-
     @Override
     public Collection<String> getAttributeNames()
     {
@@ -110,12 +114,12 @@ public class FileKeyStore extends Abstra
             Collection<Port> ports = new ArrayList<Port>(_broker.getPorts());
             for (Port port : ports)
             {
-                if (storeName.equals(port.getAttribute(Port.KEY_STORE)))
+                if (port.getKeyStore() == this)
                 {
                     throw new IntegrityViolationException("Key store '" + storeName + "' can't be deleted as it is in use by a port:" + port.getName());
                 }
             }
-
+            deleted();
             return true;
         }
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java Wed Apr  9 14:13:13 2014
@@ -83,7 +83,12 @@ public class FileTrustStore extends Abst
     {
         super(id, broker, DEFAULTS, attributes);
         _broker = broker;
+    }
 
+    @Override
+    public void validate()
+    {
+        super.validate();
         validateTrustStoreAttributes(_trustStoreType, _path, getPassword(), _trustManagerFactoryAlgorithm);
     }
 
@@ -105,11 +110,17 @@ public class FileTrustStore extends Abst
             for (Port port : ports)
             {
                 Collection<TrustStore> trustStores = port.getTrustStores();
-                for(TrustStore store : trustStores)
+                if(trustStores != null)
                 {
-                    if (storeName.equals(store.getAttribute(TrustStore.NAME)))
+                    for (TrustStore store : trustStores)
                     {
-                        throw new IntegrityViolationException("Trust store '" + storeName + "' can't be deleted as it is in use by a port: " + port.getName());
+                        if (storeName.equals(store.getAttribute(TrustStore.NAME)))
+                        {
+                            throw new IntegrityViolationException("Trust store '"
+                                                                  + storeName
+                                                                  + "' can't be deleted as it is in use by a port: "
+                                                                  + port.getName());
+                        }
                     }
                 }
             }
@@ -125,7 +136,7 @@ public class FileTrustStore extends Abst
                     throw new IntegrityViolationException("Trust store '" + storeName + "' can't be deleted as it is in use by an authentication manager: " + authProvider.getName());
                 }
             }
-
+            deleted();
             return true;
         }
         return false;

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java Wed Apr  9 14:13:13 2014
@@ -20,16 +20,6 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
-import org.apache.log4j.Logger;
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
-import org.apache.qpid.server.model.*;
-import org.apache.qpid.server.model.AbstractConfiguredObject;
-import org.apache.qpid.server.plugin.ConfiguredObjectTypeFactory;
-import org.apache.qpid.server.plugin.PreferencesProviderFactory;
-import org.apache.qpid.server.security.SubjectCreator;
-import org.apache.qpid.server.security.access.Operation;
-import org.apache.qpid.server.util.MapValueConverter;
-
 import java.security.AccessControlException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -39,6 +29,27 @@ import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicReference;
 
+import org.apache.log4j.Logger;
+
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.model.AbstractConfiguredObject;
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.model.ConfiguredObjectFactory;
+import org.apache.qpid.server.model.IllegalStateTransitionException;
+import org.apache.qpid.server.model.IntegrityViolationException;
+import org.apache.qpid.server.model.LifetimePolicy;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.PreferencesProvider;
+import org.apache.qpid.server.model.State;
+import org.apache.qpid.server.model.User;
+import org.apache.qpid.server.model.VirtualHostAlias;
+import org.apache.qpid.server.model.port.PortWithAuthProvider;
+import org.apache.qpid.server.plugin.ConfiguredObjectTypeFactory;
+import org.apache.qpid.server.security.SubjectCreator;
+import org.apache.qpid.server.security.access.Operation;
+
 public abstract class AbstractAuthenticationManager<T extends AbstractAuthenticationManager<T>>
     extends AbstractConfiguredObject<T>
     implements AuthenticationProvider<T>, AuthenticationManager
@@ -58,12 +69,34 @@ public abstract class AbstractAuthentica
         _broker = broker;
     }
 
+    @Override
+    public void validate()
+    {
+        super.validate();
+        Collection<PreferencesProvider> prefsProviders = getChildren(PreferencesProvider.class);
+        if(prefsProviders != null && prefsProviders.size() > 1)
+        {
+            throw new IllegalConfigurationException("Only one preference provider can be configured for an authentication provider");
+        }
+    }
+
     protected final Broker getBroker()
     {
         return _broker;
     }
 
     @Override
+    protected void onOpen()
+    {
+        super.onOpen();
+        Collection<PreferencesProvider> prefsProviders = getChildren(PreferencesProvider.class);
+        if(prefsProviders != null && !prefsProviders.isEmpty())
+        {
+            _preferencesProvider = prefsProviders.iterator().next();
+        }
+    }
+
+    @Override
     public Collection<VirtualHostAlias> getVirtualHostPortBindings()
     {
         return null;
@@ -188,17 +221,6 @@ public abstract class AbstractAuthentica
         }
     }
 
-    @SuppressWarnings("unchecked")
-    @Override
-    public <C extends ConfiguredObject> Collection<C> getChildren(Class<C> clazz)
-    {
-        if (clazz == PreferencesProvider.class && _preferencesProvider != null)
-        {
-            return (Collection<C>) Collections.<PreferencesProvider>singleton(_preferencesProvider);
-        }
-        return Collections.emptySet();
-    }
-
     @Override
     public boolean setState(State currentState, State desiredState)
             throws IllegalStateTransitionException, AccessControlException
@@ -212,7 +234,7 @@ public abstract class AbstractAuthentica
             Collection<Port> ports = new ArrayList<Port>(_broker.getPorts());
             for (Port port : ports)
             {
-                if (providerName.equals(port.getAttribute(Port.AUTHENTICATION_PROVIDER)))
+                if(port instanceof PortWithAuthProvider && ((PortWithAuthProvider<?>)port).getAuthenticationProvider() == this)
                 {
                     throw new IntegrityViolationException("Authentication provider '" + providerName + "' is set on port " + port.getName());
                 }
@@ -227,6 +249,7 @@ public abstract class AbstractAuthentica
                 {
                     _preferencesProvider.setDesiredState(_preferencesProvider.getState(), State.DELETED);
                 }
+                deleted();
                 return true;
             }
             else

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java Wed Apr  9 14:13:13 2014
@@ -54,7 +54,7 @@ public abstract class PrincipalDatabaseA
     private static final Logger LOGGER = Logger.getLogger(PrincipalDatabaseAuthenticationManager.class);
 
 
-    private final PrincipalDatabase _principalDatabase;
+    private PrincipalDatabase _principalDatabase;
     @ManagedAttributeField
     private String _path;
 
@@ -64,26 +64,34 @@ public abstract class PrincipalDatabaseA
                                                      boolean recovering)
     {
         super(broker, defaults, attributes);
+    }
 
-        if(!recovering)
+    @Override
+    protected void onCreate()
+    {
+        super.onCreate();
+        try
         {
-            try
+            File passwordFile = new File(_path);
+            if (!passwordFile.exists())
             {
-                File passwordFile = new File(_path);
-                if (!passwordFile.exists())
-                {
-                    passwordFile.createNewFile();
-                }
-                else if (!passwordFile.canRead())
-                {
-                    throw new IllegalConfigurationException("Cannot read password file" + _path + ". Check permissions.");
-                }
+                passwordFile.createNewFile();
             }
-            catch (IOException e)
+            else if (!passwordFile.canRead())
             {
-                throw new IllegalConfigurationException("Cannot use password database at :" + _path, e);
+                throw new IllegalConfigurationException("Cannot read password file" + _path + ". Check permissions.");
             }
         }
+        catch (IOException e)
+        {
+            throw new IllegalConfigurationException("Cannot use password database at :" + _path, e);
+        }
+    }
+
+    @Override
+    protected void onOpen()
+    {
+        super.onOpen();
         _principalDatabase = createDatabase();
     }
 
@@ -271,7 +279,8 @@ public abstract class PrincipalDatabaseA
     {
         if(clazz == User.class)
         {
-            List<Principal> users = getPrincipalDatabase().getUsers();
+            PrincipalDatabase principalDatabase = getPrincipalDatabase();
+            List<Principal> users = principalDatabase == null ? Collections.<Principal>emptyList() : principalDatabase.getUsers();
             Collection<User> principals = new ArrayList<User>(users.size());
             for(Principal user : users)
             {

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java Wed Apr  9 14:13:13 2014
@@ -36,7 +36,7 @@ import javax.security.sasl.SaslException
 import javax.security.sasl.SaslServer;
 
 import org.apache.log4j.Logger;
-import org.apache.qpid.server.configuration.updater.TaskExecutor;
+
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ManagedObject;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
@@ -55,8 +55,8 @@ public class SimpleAuthenticationManager
     private final Map<String, String> _users = Collections.synchronizedMap(new HashMap<String, String>());
 
     public SimpleAuthenticationManager(final Broker broker,
-                                          final Map<String, Object> defaults,
-                                          final Map<String, Object> attributes)
+                                       final Map<String, Object> defaults,
+                                       final Map<String, Object> attributes)
     {
         super(broker, defaults, attributes);
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordRecoveverAndUpgrader.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordRecoveverAndUpgrader.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordRecoveverAndUpgrader.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordRecoveverAndUpgrader.java Wed Apr  9 14:13:13 2014
@@ -24,14 +24,14 @@ import java.util.Map;
 
 import org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler;
 import org.apache.qpid.server.virtualhost.DefaultUpgraderProvider;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 
 public class ConfiguredObjectRecordRecoveverAndUpgrader implements ConfiguredObjectRecordHandler
 {
     private DurableConfigurationRecoverer _configRecoverer;
     private DurableConfigurationStore _store;
 
-    public ConfiguredObjectRecordRecoveverAndUpgrader(VirtualHost virtualHost, Map<String, DurableConfiguredObjectRecoverer> recoverers)
+    public ConfiguredObjectRecordRecoveverAndUpgrader(VirtualHostImpl virtualHost, Map<String, DurableConfiguredObjectRecoverer> recoverers)
     {
         DefaultUpgraderProvider upgraderProvider = new DefaultUpgraderProvider(virtualHost);
         _configRecoverer = new DurableConfigurationRecoverer(virtualHost.getName(), recoverers, upgraderProvider, virtualHost.getEventLogger());

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DistributedTransaction.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DistributedTransaction.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DistributedTransaction.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DistributedTransaction.java Wed Apr  9 14:13:13 2014
@@ -25,14 +25,12 @@ import org.apache.qpid.server.message.En
 import org.apache.qpid.server.message.MessageInstance;
 import org.apache.qpid.server.protocol.AMQSessionModel;
 import org.apache.qpid.server.queue.BaseQueue;
-import org.apache.qpid.server.queue.QueueEntry;
 import org.apache.qpid.server.store.MessageStore;
 import org.apache.qpid.server.store.TransactionLogResource;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 import org.apache.qpid.transport.Xid;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
 public class DistributedTransaction implements ServerTransaction
@@ -42,10 +40,10 @@ public class DistributedTransaction impl
 
     private DtxBranch _branch;
     private AMQSessionModel _session;
-    private VirtualHost _vhost;
+    private VirtualHostImpl _vhost;
 
 
-    public DistributedTransaction(AMQSessionModel session, MessageStore store, VirtualHost vhost)
+    public DistributedTransaction(AMQSessionModel session, MessageStore store, VirtualHostImpl vhost)
     {
         _session = session;
         _vhost = vhost;

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java Wed Apr  9 14:13:13 2014
@@ -34,7 +34,7 @@ import org.apache.qpid.server.protocol.A
 import org.apache.qpid.server.store.MessageStore;
 import org.apache.qpid.server.store.Transaction;
 import org.apache.qpid.server.store.TransactionLogResource;
-import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.VirtualHostImpl;
 import org.apache.qpid.transport.Xid;
 
 public class DtxBranch
@@ -51,7 +51,7 @@ public class DtxBranch
 
     private Transaction _transaction;
     private long _expiration;
-    private VirtualHost _vhost;
+    private VirtualHostImpl _vhost;
     private ScheduledFuture<?> _timeoutFuture;
     private MessageStore _store;
 
@@ -69,7 +69,7 @@ public class DtxBranch
     }
 
 
-    public DtxBranch(Xid xid, MessageStore store, VirtualHost vhost)
+    public DtxBranch(Xid xid, MessageStore store, VirtualHostImpl vhost)
     {
         _xid = xid;
         _store = store;

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java Wed Apr  9 14:13:13 2014
@@ -22,6 +22,7 @@ package org.apache.qpid.server.virtualho
 
 import java.lang.reflect.Type;
 import java.security.AccessControlException;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -37,6 +38,8 @@ import java.util.concurrent.ScheduledThr
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import javax.security.auth.Subject;
+
 import org.apache.log4j.Logger;
 
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
@@ -58,20 +61,7 @@ import org.apache.qpid.server.message.Me
 import org.apache.qpid.server.message.MessageNode;
 import org.apache.qpid.server.message.MessageSource;
 import org.apache.qpid.server.message.ServerMessage;
-import org.apache.qpid.server.model.AbstractConfiguredObject;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.ConfiguredObject;
-import org.apache.qpid.server.model.Connection;
-import org.apache.qpid.server.model.Exchange;
-import org.apache.qpid.server.model.IntegrityViolationException;
-import org.apache.qpid.server.model.LifetimePolicy;
-import org.apache.qpid.server.model.Port;
-import org.apache.qpid.server.model.Protocol;
-import org.apache.qpid.server.model.Queue;
-import org.apache.qpid.server.model.QueueType;
-import org.apache.qpid.server.model.State;
-import org.apache.qpid.server.model.UUIDGenerator;
-import org.apache.qpid.server.model.VirtualHostAlias;
+import org.apache.qpid.server.model.*;
 import org.apache.qpid.server.model.adapter.ConnectionAdapter;
 import org.apache.qpid.server.model.adapter.VirtualHostAliasAdapter;
 import org.apache.qpid.server.plugin.ExchangeType;
@@ -102,8 +92,8 @@ import org.apache.qpid.server.util.MapVa
 import org.apache.qpid.server.util.ParameterizedTypeImpl;
 
 public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> extends AbstractConfiguredObject<X>
-        implements VirtualHost<AMQQueue<?>, ExchangeImpl<?>>, IConnectionRegistry.RegistryChangeListener, EventListener,
-                   org.apache.qpid.server.model.VirtualHost<X,AMQQueue<?>, ExchangeImpl<?>>
+        implements VirtualHostImpl<X, AMQQueue<?>, ExchangeImpl<?>>, IConnectionRegistry.RegistryChangeListener, EventListener,
+                   VirtualHost<X,AMQQueue<?>, ExchangeImpl<?>>
 {
     private static final Logger _logger = Logger.getLogger(AbstractVirtualHost.class);
 
@@ -181,6 +171,12 @@ public abstract class AbstractVirtualHos
     private final List<VirtualHostAlias> _aliases = new ArrayList<VirtualHostAlias>();
     private final AtomicBoolean _deleted = new AtomicBoolean();
 
+    @ManagedAttributeField
+    private Map<String, Object> _messageStoreSettings;
+
+    @ManagedAttributeField
+    private Map<String, Object> _configurationStoreSettings;
+
 
     public AbstractVirtualHost(final Map<String, Object> attributes, Broker<?> broker)
     {
@@ -206,7 +202,6 @@ public abstract class AbstractVirtualHos
 
         _exchangeRegistry = new DefaultExchangeRegistry(this, _queueRegistry);
 
-        validateAttributes();
     }
 
     private static Map<String, Object> enhanceWithId(Map<String, Object> attributes)
@@ -226,8 +221,9 @@ public abstract class AbstractVirtualHos
         return parentsMap;
     }
 
-    protected void validateAttributes()
+    public void validate()
     {
+        super.validate();
         String name = getName();
         if (name == null || "".equals(name.trim()))
         {
@@ -240,13 +236,23 @@ public abstract class AbstractVirtualHos
         }
     }
 
-    public void onOpen()
+    protected void onOpen()
     {
+        super.onOpen();
+
         registerSystemNodes();
 
         initialiseStatistics();
 
-        initialiseStorage(this);
+        Subject.doAs(getSecurityManager().getSubjectWithAddedSystemRights(), new PrivilegedAction<Object>()
+        {
+            @Override
+            public Object run()
+            {
+                initialiseStorage(AbstractVirtualHost.this);
+                return null;
+            }
+        });
 
         getMessageStore().addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_OVERFULL);
         getMessageStore().addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_UNDERFULL);
@@ -581,7 +587,15 @@ public abstract class AbstractVirtualHos
 
     protected void initialiseModel()
     {
-        _exchangeRegistry.initialise(_exchangeFactory);
+        Subject.doAs(getSecurityManager().getSubjectWithAddedSystemRights(), new PrivilegedAction<Object>()
+                     {
+                         @Override
+                         public Object run()
+                         {
+                             _exchangeRegistry.initialise(_exchangeFactory);
+                             return null;
+                         }
+                     });
     }
 
 
@@ -1346,7 +1360,7 @@ public abstract class AbstractVirtualHos
         }
 
         @Override
-        public VirtualHost getVirtualHost()
+        public VirtualHostImpl getVirtualHost()
         {
             return AbstractVirtualHost.this;
         }
@@ -1717,14 +1731,14 @@ public abstract class AbstractVirtualHos
     @Override
     public Map<String, Object> getMessageStoreSettings()
     {
-        return (Map<String, Object>)getAttribute(org.apache.qpid.server.model.VirtualHost.MESSAGE_STORE_SETTINGS);
+        return _messageStoreSettings;
     }
 
     @SuppressWarnings("unchecked")
     @Override
     public Map<String, Object> getConfigurationStoreSettings()
     {
-        return (Map<String, Object>)getAttribute(org.apache.qpid.server.model.VirtualHost.CONFIGURATION_STORE_SETTINGS);
+        return _configurationStoreSettings;
     }
 
     @Override
@@ -1788,6 +1802,7 @@ public abstract class AbstractVirtualHos
     {
         if (desiredState == State.ACTIVE)
         {
+/*
             try
             {
                 onOpen();
@@ -1804,6 +1819,7 @@ public abstract class AbstractVirtualHos
                     throw e;
                 }
             }
+*/
             return true;
         }
         else if (desiredState == State.STOPPED)
@@ -1848,7 +1864,9 @@ public abstract class AbstractVirtualHos
                     }
                 }
                 setAttribute(org.apache.qpid.server.model.VirtualHost.STATE, getState(), State.DELETED);
+                deleted();
             }
+
             return true;
         }
         return false;

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java Wed Apr  9 14:13:13 2014
@@ -41,9 +41,9 @@ public class BindingRecoverer extends Ab
     private static final Logger _logger = Logger.getLogger(BindingRecoverer.class);
 
     private final ExchangeRegistry _exchangeRegistry;
-    private final VirtualHost _virtualHost;
+    private final VirtualHostImpl _virtualHost;
 
-    public BindingRecoverer(final VirtualHost virtualHost,
+    public BindingRecoverer(final VirtualHostImpl virtualHost,
                             final ExchangeRegistry exchangeRegistry)
     {
         _exchangeRegistry = exchangeRegistry;

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/DefaultUpgraderProvider.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/DefaultUpgraderProvider.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/DefaultUpgraderProvider.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/DefaultUpgraderProvider.java Wed Apr  9 14:13:13 2014
@@ -51,7 +51,7 @@ public class DefaultUpgraderProvider imp
 
     public static final String EXCLUSIVE = "exclusive";
     public static final String NAME = "name";
-    private final VirtualHost _virtualHost;
+    private final VirtualHostImpl _virtualHost;
 
     @SuppressWarnings("serial")
     private static final Map<String, String> DEFAULT_EXCHANGES = Collections.unmodifiableMap(new HashMap<String, String>()
@@ -64,7 +64,7 @@ public class DefaultUpgraderProvider imp
 
     private final Map<String, UUID> _defaultExchangeIds;
 
-    public DefaultUpgraderProvider(final VirtualHost virtualHost)
+    public DefaultUpgraderProvider(final VirtualHostImpl virtualHost)
     {
         _virtualHost = virtualHost;
         Map<String, UUID> defaultExchangeIds = new HashMap<String, UUID>();

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java Wed Apr  9 14:13:13 2014
@@ -22,25 +22,22 @@ package org.apache.qpid.server.virtualho
 
 import org.apache.log4j.Logger;
 
-import org.apache.qpid.server.security.*;
 import org.apache.qpid.server.security.SecurityManager;
-import org.apache.qpid.server.security.auth.TaskPrincipal;
 
 import javax.security.auth.Subject;
 import java.security.PrivilegedAction;
-import java.util.Collections;
 
 public abstract class HouseKeepingTask implements Runnable
 {
     private Logger _logger = Logger.getLogger(this.getClass());
 
-    private VirtualHost _virtualHost;
+    private VirtualHostImpl _virtualHost;
 
     private String _name;
 
     private final Subject _subject;
 
-    public HouseKeepingTask(VirtualHost vhost)
+    public HouseKeepingTask(VirtualHostImpl vhost)
     {
         _virtualHost = vhost;
         _name = _virtualHost.getName() + ":" + this.getClass().getSimpleName();
@@ -78,7 +75,7 @@ public abstract class HouseKeepingTask i
         }
     }
 
-    public VirtualHost getVirtualHost()
+    public VirtualHostImpl getVirtualHost()
     {
         return _virtualHost;
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/MessageStoreRecoverer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/MessageStoreRecoverer.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/MessageStoreRecoverer.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/MessageStoreRecoverer.java Wed Apr  9 14:13:13 2014
@@ -55,7 +55,7 @@ public class MessageStoreRecoverer
 {
     private static final Logger _logger = Logger.getLogger(MessageStoreRecoverer.class);
 
-    private final VirtualHost _virtualHost;
+    private final VirtualHostImpl _virtualHost;
 
     private final Map<String, Integer> _queueRecoveries = new TreeMap<String, Integer>();
     private final Map<Long, ServerMessage<?>> _recoveredMessages = new HashMap<Long, ServerMessage<?>>();
@@ -66,7 +66,7 @@ public class MessageStoreRecoverer
     private final MessageStore _store;
 
 
-    public MessageStoreRecoverer(VirtualHost virtualHost, MessageStoreLogSubject logSubject)
+    public MessageStoreRecoverer(VirtualHostImpl virtualHost, MessageStoreLogSubject logSubject)
     {
         super();
         _virtualHost = virtualHost;

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java Wed Apr  9 14:13:13 2014
@@ -39,11 +39,11 @@ import org.apache.qpid.server.store.Unre
 public class QueueRecoverer extends AbstractDurableConfiguredObjectRecoverer<AMQQueue>
 {
     private static final Logger _logger = Logger.getLogger(QueueRecoverer.class);
-    private final VirtualHost _virtualHost;
+    private final VirtualHostImpl _virtualHost;
     private final ExchangeRegistry _exchangeRegistry;
     private final QueueFactory _queueFactory;
 
-    public QueueRecoverer(final VirtualHost virtualHost,
+    public QueueRecoverer(final VirtualHostImpl virtualHost,
                           final ExchangeRegistry exchangeRegistry,
                           final QueueFactory queueFactory)
     {

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java Wed Apr  9 14:13:13 2014
@@ -55,11 +55,11 @@ public class StandardVirtualHost extends
     }
 
     @Override
-    protected void validateAttributes()
+    public void validate()
     {
-        super.validateAttributes();
+        super.validate();
         Map<String,Object> attributes = getActualAttributes();
-        Map<String, Object> messageStoreSettings = (Map<String, Object>)attributes.get(org.apache.qpid.server.model.VirtualHost.MESSAGE_STORE_SETTINGS);
+        Map<String, Object> messageStoreSettings = getMessageStoreSettings();
         if (messageStoreSettings == null)
         {
             throw new IllegalArgumentException("Attribute '"+ org.apache.qpid.server.model.VirtualHost.MESSAGE_STORE_SETTINGS + "' is required.");

Copied: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java (from r1585968, qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java)
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java?p2=qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java&p1=qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java&r1=1585968&r2=1585979&rev=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java Wed Apr  9 14:13:13 2014
@@ -34,6 +34,7 @@ import org.apache.qpid.server.logging.Ev
 import org.apache.qpid.server.logging.EventLoggerProvider;
 import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.message.MessageSource;
+import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.plugin.ExchangeType;
 import org.apache.qpid.server.protocol.LinkRegistry;
 import org.apache.qpid.server.queue.AMQQueue;
@@ -43,8 +44,11 @@ import org.apache.qpid.server.store.Dura
 import org.apache.qpid.server.store.MessageStore;
 import org.apache.qpid.server.txn.DtxRegistry;
 
-public interface VirtualHost< Q extends AMQQueue<?>, E extends ExchangeImpl<?> > extends DurableConfigurationStore.Source, Closeable, StatisticsGatherer,
-                                     EventLoggerProvider
+public interface VirtualHostImpl< X extends VirtualHostImpl<X,Q,E>, Q extends AMQQueue<?>, E extends ExchangeImpl<?> >
+        extends DurableConfigurationStore.Source,
+                Closeable, StatisticsGatherer,
+                EventLoggerProvider,
+                VirtualHost<X,Q,E>
 {
     IConnectionRegistry getConnectionRegistry();
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java?rev=1585979&r1=1585978&r2=1585979&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java Wed Apr  9 14:13:13 2014
@@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentHa
 
 public class VirtualHostRegistry implements Closeable
 {
-    private final Map<String, VirtualHost> _registry = new ConcurrentHashMap<String, VirtualHost>();
+    private final Map<String, VirtualHostImpl> _registry = new ConcurrentHashMap<String, VirtualHostImpl>();
     private String _defaultVirtualHostName;
     private final EventLogger _eventLogger;
 
@@ -41,7 +41,7 @@ public class VirtualHostRegistry impleme
         _eventLogger = eventLogger;
     }
 
-    public synchronized void registerVirtualHost(VirtualHost host)
+    public synchronized void registerVirtualHost(VirtualHostImpl host)
     {
         if(_registry.containsKey(host.getName()))
         {
@@ -50,12 +50,12 @@ public class VirtualHostRegistry impleme
         _registry.put(host.getName(),host);
     }
 
-    public synchronized void unregisterVirtualHost(VirtualHost host)
+    public synchronized void unregisterVirtualHost(VirtualHostImpl host)
     {
         _registry.remove(host.getName());
     }
 
-    public VirtualHost getVirtualHost(String name)
+    public VirtualHostImpl getVirtualHost(String name)
     {
         if(name == null || name.trim().length() == 0 || "/".equals(name.trim()))
         {
@@ -65,7 +65,7 @@ public class VirtualHostRegistry impleme
         return _registry.get(name);
     }
 
-    public VirtualHost getDefaultVirtualHost()
+    public VirtualHostImpl getDefaultVirtualHost()
     {
         return getVirtualHost(getDefaultVirtualHostName());
     }
@@ -81,14 +81,14 @@ public class VirtualHostRegistry impleme
     }
 
 
-    public Collection<VirtualHost> getVirtualHosts()
+    public Collection<VirtualHostImpl> getVirtualHosts()
     {
-        return new ArrayList<VirtualHost>(_registry.values());
+        return new ArrayList<VirtualHostImpl>(_registry.values());
     }
 
     public void close()
     {
-        for (VirtualHost virtualHost : getVirtualHosts())
+        for (VirtualHostImpl virtualHost : getVirtualHosts())
         {
             virtualHost.close();
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message