qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1584365 [7/15] - in /qpid/branches/java-broker-config-store-changes/qpid/java: ./ bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/ bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ bdbstore/src/main/jav...
Date Thu, 03 Apr 2014 19:59:01 GMT
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/PreferencesProviderFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/PreferencesProviderFactory.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/PreferencesProviderFactory.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/PreferencesProviderFactory.java Thu Apr  3 19:58:53 2014
@@ -26,7 +26,7 @@ import org.apache.qpid.server.model.Pref
 
 public interface PreferencesProviderFactory extends Pluggable
 {
-    PluggableFactoryLoader<PreferencesProviderFactory> FACTORIES = new PluggableFactoryLoader<PreferencesProviderFactory>(PreferencesProviderFactory.class);
+    PluggableFactoryLoader<PreferencesProviderFactory> FACTORY_LOADER = new PluggableFactoryLoader<PreferencesProviderFactory>(PreferencesProviderFactory.class);
 
     PreferencesProvider createInstance(UUID id, Map<String, Object> attributes, AuthenticationProvider<? extends AuthenticationProvider> authenticationProvider);
 

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java Thu Apr  3 19:58:53 2014
@@ -25,9 +25,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.configuration.Configuration;
-import org.apache.qpid.server.configuration.VirtualHostConfiguration;
-import org.apache.qpid.server.model.adapter.VirtualHostAdapter;
+
 import org.apache.qpid.server.security.SecurityManager;
 import org.apache.qpid.server.stats.StatisticsGatherer;
 import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -40,15 +38,10 @@ public interface VirtualHostFactory exte
     VirtualHost createVirtualHost(VirtualHostRegistry virtualHostRegistry,
                                   StatisticsGatherer brokerStatisticsGatherer,
                                   SecurityManager parentSecurityManager,
-                                  VirtualHostConfiguration hostConfig,
                                   org.apache.qpid.server.model.VirtualHost virtualHost);
 
     void validateAttributes(Map<String, Object> attributes);
 
-    Map<String, Object> createVirtualHostConfiguration(VirtualHostAdapter virtualHostAdapter);
-
-    Map<String,Object> convertVirtualHostConfiguration(Configuration configuration);
-
     static final class TYPES
     {
         private TYPES()

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java Thu Apr  3 19:58:53 2014
@@ -26,11 +26,9 @@ import java.util.UUID;
 
 import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
 import org.apache.qpid.server.exchange.ExchangeImpl;
-import org.apache.qpid.server.model.ExclusivityPolicy;
 import org.apache.qpid.server.model.LifetimePolicy;
 import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.server.configuration.BrokerProperties;
-import org.apache.qpid.server.configuration.QueueConfiguration;
 import org.apache.qpid.server.exchange.DefaultExchangeFactory;
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.model.UUIDGenerator;
@@ -59,7 +57,7 @@ public class AMQQueueFactory implements 
     {
         _virtualHost = virtualHost;
         _queueRegistry = queueRegistry;
-    }   
+    }
 
     @Override
     public AMQQueue restoreQueue(Map<String, Object> attributes)
@@ -74,50 +72,10 @@ public class AMQQueueFactory implements 
         return createOrRestoreQueue(attributes, true);
     }
 
-    private AMQQueue createOrRestoreQueue(Map<String, Object> attributes,
-                                          boolean createInStore)
+    private AMQQueue createOrRestoreQueue(Map<String, Object> attributes, boolean createInStore)
     {
-
-
         String queueName = MapValueConverter.getStringAttribute(Queue.NAME,attributes);
-
-        QueueConfiguration config = _virtualHost.getConfiguration().getQueueConfiguration(queueName);
-
-        if (!attributes.containsKey(Queue.ALERT_THRESHOLD_MESSAGE_AGE) && config.getMaximumMessageAge() != 0)
-        {
-            attributes.put(Queue.ALERT_THRESHOLD_MESSAGE_AGE, config.getMaximumMessageAge());
-        }
-        if (!attributes.containsKey(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_BYTES) && config.getMaximumQueueDepth() != 0)
-        {
-            attributes.put(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, config.getMaximumQueueDepth());
-        }
-        if (!attributes.containsKey(Queue.ALERT_THRESHOLD_MESSAGE_SIZE) && config.getMaximumMessageSize() != 0)
-        {
-            attributes.put(Queue.ALERT_THRESHOLD_MESSAGE_SIZE, config.getMaximumMessageSize());
-        }
-        if (!attributes.containsKey(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES) && config.getMaximumMessageCount() != 0)
-        {
-            attributes.put(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, config.getMaximumMessageCount());
-        }
-        if (!attributes.containsKey(Queue.ALERT_REPEAT_GAP) && config.getMinimumAlertRepeatGap() != 0)
-        {
-            attributes.put(Queue.ALERT_REPEAT_GAP, config.getMinimumAlertRepeatGap());
-        }
-        if (config.getMaxDeliveryCount() != 0 && !attributes.containsKey(Queue.MAXIMUM_DELIVERY_ATTEMPTS))
-        {
-            attributes.put(Queue.MAXIMUM_DELIVERY_ATTEMPTS, config.getMaxDeliveryCount());
-        }
-        if (!attributes.containsKey(Queue.QUEUE_FLOW_CONTROL_SIZE_BYTES) && config.getCapacity() != 0)
-        {
-            attributes.put(Queue.QUEUE_FLOW_CONTROL_SIZE_BYTES, config.getCapacity());
-        }
-        if (!attributes.containsKey(Queue.QUEUE_FLOW_RESUME_SIZE_BYTES) && config.getFlowResumeCapacity() != 0)
-        {
-            attributes.put(Queue.QUEUE_FLOW_RESUME_SIZE_BYTES, config.getFlowResumeCapacity());
-        }
-
-
-        boolean createDLQ = createDLQ(attributes, config);
+        boolean createDLQ = createInStore && shouldCreateDLQ(attributes, _virtualHost.getDefaultDeadLetterQueueEnabled());
         if (createDLQ)
         {
             validateDLNames(queueName);
@@ -259,30 +217,7 @@ public class AMQQueueFactory implements 
         queue.setAlternateExchange(dlExchange);
     }
 
-    public AMQQueue createAMQQueueImpl(QueueConfiguration config)
-    {
-
-        Map<String, Object> arguments = createQueueAttributesFromConfig(_virtualHost, config);
-        
-        AMQQueue q = createOrRestoreQueue(arguments, false);
-        return q;
-    }
-
-    /**
-     * Validates DLQ and DLE names
-     * <p>
-     * DLQ name and DLQ exchange name need to be validated in order to keep
-     * integrity in cases when queue name passes validation check but DLQ name
-     * or DL exchange name fails to pass it. Otherwise, we might have situations
-     * when queue is created but DL exchange or/and DLQ creation fail.
-     * <p>
-     *
-     * @param name
-     *            queue name
-     * @throws IllegalArgumentException
-     *             thrown if length of queue name or exchange name exceed 255
-     */
-    protected static void validateDLNames(String name)
+    private static void validateDLNames(String name)
     {
         // check if DLQ name and DLQ exchange name do not exceed 255
         String exchangeName = getDeadLetterExchangeName(name);
@@ -299,16 +234,7 @@ public class AMQQueueFactory implements 
         }
     }
 
-    /**
-     * Checks if DLQ is enabled for the queue.
-     *
-     * @param arguments
-     *            queue arguments
-     * @param qConfig
-     *            queue configuration
-     * @return true if DLQ enabled
-     */
-    protected static boolean createDLQ(Map<String, Object> arguments, QueueConfiguration qConfig)
+    private static boolean shouldCreateDLQ(Map<String, Object> arguments, boolean virtualHostDefaultDeadLetterQueueEnabled)
     {
         boolean autoDelete = MapValueConverter.getEnumAttribute(LifetimePolicy.class,
                                                                 Queue.LIFETIME_POLICY,
@@ -320,7 +246,7 @@ public class AMQQueueFactory implements 
         {
             boolean dlqArgumentPresent = arguments != null
                                          && arguments.containsKey(Queue.CREATE_DLQ_ON_CREATION);
-            if (dlqArgumentPresent || qConfig.isDeadLetterQueueEnabled())
+            if (dlqArgumentPresent)
             {
                 boolean dlqEnabled = true;
                 if (dlqArgumentPresent)
@@ -329,89 +255,21 @@ public class AMQQueueFactory implements 
                     dlqEnabled = (argument instanceof Boolean && ((Boolean)argument).booleanValue())
                                 || (argument instanceof String && Boolean.parseBoolean(argument.toString()));
                 }
-                return dlqEnabled ;
+                return dlqEnabled;
             }
+            return virtualHostDefaultDeadLetterQueueEnabled;
         }
         return false;
     }
 
-    /**
-     * Generates a dead letter queue name for a given queue name
-     *
-     * @param name
-     *            queue name
-     * @return DLQ name
-     */
-    protected static String getDeadLetterQueueName(String name)
+    private static String getDeadLetterQueueName(String name)
     {
         return name + System.getProperty(BrokerProperties.PROPERTY_DEAD_LETTER_QUEUE_SUFFIX, DEFAULT_DLQ_NAME_SUFFIX);
     }
 
-    /**
-     * Generates a dead letter exchange name for a given queue name
-     *
-     * @param name
-     *            queue name
-     * @return DL exchange name
-     */
-    protected static String getDeadLetterExchangeName(String name)
+    private static String getDeadLetterExchangeName(String name)
     {
         return name + System.getProperty(BrokerProperties.PROPERTY_DEAD_LETTER_EXCHANGE_SUFFIX, DefaultExchangeFactory.DEFAULT_DLE_NAME_SUFFIX);
     }
 
-    private static Map<String, Object> createQueueAttributesFromConfig(final VirtualHost virtualHost,
-                                                                       QueueConfiguration config)
-    {
-        Map<String,Object> attributes = new HashMap<String,Object>();
-
-        if(config.getArguments() != null && !config.getArguments().isEmpty())
-        {
-            attributes.putAll(QueueArgumentsConverter.convertWireArgsToModel(new HashMap<String, Object>(config.getArguments())));
-        }
-
-        if(config.isLVQ() || config.getLVQKey() != null)
-        {
-            attributes.put(Queue.LVQ_KEY,
-                          config.getLVQKey() == null ? ConflationQueue.DEFAULT_LVQ_KEY : config.getLVQKey());
-        }
-        else if (config.getPriority() || config.getPriorities() > 0)
-        {
-            attributes.put(Queue.PRIORITIES, config.getPriorities() < 0 ? 10 : config.getPriorities());
-        }
-        else if (config.getQueueSortKey() != null && !"".equals(config.getQueueSortKey()))
-        {
-            attributes.put(Queue.SORT_KEY, config.getQueueSortKey());
-        }
-
-        if (!config.getAutoDelete() && config.isDeadLetterQueueEnabled())
-        {
-            attributes.put(Queue.CREATE_DLQ_ON_CREATION, true);
-        }
-
-        if (config.getDescription() != null && !"".equals(config.getDescription()))
-        {
-            attributes.put(Queue.DESCRIPTION, config.getDescription());
-        }
-
-        attributes.put(Queue.DURABLE, config.getDurable());
-        attributes.put(Queue.LIFETIME_POLICY,
-                      config.getAutoDelete() ? LifetimePolicy.DELETE_ON_NO_OUTBOUND_LINKS : LifetimePolicy.PERMANENT);
-        if(config.getExclusive())
-        {
-            attributes.put(Queue.EXCLUSIVE, ExclusivityPolicy.CONTAINER);
-        }
-        if(config.getOwner() != null)
-        {
-            attributes.put(Queue.OWNER, config.getOwner());
-        }
-        
-        attributes.put(Queue.NAME, config.getName());
-        
-        // we need queues that are defined in config to have deterministic ids.
-        attributes.put(Queue.ID, UUIDGenerator.generateQueueUUID(config.getName(), virtualHost.getName()));
-
-
-        return attributes;
-    }
-
 }

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java Thu Apr  3 19:58:53 2014
@@ -42,7 +42,7 @@ import org.apache.qpid.server.logging.Ev
 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.adapter.AbstractConfiguredObject;
+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;

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java Thu Apr  3 19:58:53 2014
@@ -35,7 +35,7 @@ import org.apache.qpid.server.model.Conf
 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.adapter.AbstractConfiguredObject;
+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;

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java Thu Apr  3 19:58:53 2014
@@ -20,37 +20,21 @@
  */
 package org.apache.qpid.server.registry;
 
-import java.security.PrivilegedAction;
-import java.util.Collection;
-import java.util.Timer;
-import java.util.TimerTask;
-
 import org.apache.log4j.Logger;
-import org.apache.qpid.common.Closeable;
 import org.apache.qpid.common.QpidProperties;
 import org.apache.qpid.server.BrokerOptions;
 import org.apache.qpid.server.configuration.BrokerProperties;
 import org.apache.qpid.server.configuration.ConfigurationEntryStore;
-import org.apache.qpid.server.configuration.ConfiguredObjectRecoverer;
-import org.apache.qpid.server.configuration.RecovererProvider;
-import org.apache.qpid.server.configuration.startup.DefaultRecovererProvider;
-import org.apache.qpid.server.configuration.store.StoreConfigurationChangeListener;
+import org.apache.qpid.server.configuration.startup.BrokerStoreUpgrader;
 import org.apache.qpid.server.logging.*;
 import org.apache.qpid.server.logging.messages.BrokerMessages;
-import org.apache.qpid.server.logging.messages.VirtualHostMessages;
 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.State;
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
-import org.apache.qpid.server.security.SecurityManager;
-import org.apache.qpid.server.stats.StatisticsCounter;
-import org.apache.qpid.server.stats.StatisticsGatherer;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
+import org.apache.qpid.server.model.SystemContext;
 import org.apache.qpid.util.SystemUtils;
 
-import javax.security.auth.Subject;
-
 
 /**
  * An abstract application registry that provides access to configuration information and handles the
@@ -62,169 +46,45 @@ public class ApplicationRegistry impleme
 {
     private static final Logger _logger = Logger.getLogger(ApplicationRegistry.class);
 
-    private final EventLogger _eventLogger;
-
-    private final VirtualHostRegistry _virtualHostRegistry;
-
-    private volatile MessageLogger _messageLogger;
+    private final SystemContext _systemContext;
 
     private Broker _broker;
 
-    private Timer _reportingTimer;
-    private StatisticsCounter _messagesDelivered, _dataDelivered, _messagesReceived, _dataReceived;
-
-    private LogRecorder _logRecorder;
-
     private ConfigurationEntryStore _store;
-    private TaskExecutor _taskExecutor;
 
-    public ApplicationRegistry(ConfigurationEntryStore store, EventLogger eventLogger)
+    public ApplicationRegistry(ConfigurationEntryStore store, SystemContext systemContext)
     {
         _store = store;
-        _eventLogger = eventLogger;
-        _virtualHostRegistry = new VirtualHostRegistry(_eventLogger);
-        initialiseStatistics();
+        _systemContext = systemContext;
     }
 
     public void initialise(BrokerOptions brokerOptions) throws Exception
     {
         // Create the RootLogger to be used during broker operation
         boolean statusUpdatesEnabled = Boolean.parseBoolean(System.getProperty(BrokerProperties.PROPERTY_STATUS_UPDATES, "true"));
-        _messageLogger = new Log4jMessageLogger(statusUpdatesEnabled);
-        _eventLogger.setMessageLogger(_messageLogger);
-        _logRecorder = new LogRecorder();
+        MessageLogger messageLogger = new Log4jMessageLogger(statusUpdatesEnabled);
+        final EventLogger eventLogger = _systemContext.getEventLogger();
+        eventLogger.setMessageLogger(messageLogger);
 
         //Create the composite (log4j+SystemOut MessageLogger to be used during startup
-        MessageLogger[] messageLoggers = {new SystemOutMessageLogger(), _messageLogger};
+        MessageLogger[] messageLoggers = {new SystemOutMessageLogger(), messageLogger};
 
         CompositeStartupMessageLogger startupMessageLogger = new CompositeStartupMessageLogger(messageLoggers);
         EventLogger startupLogger = new EventLogger(startupMessageLogger);
 
-
         logStartupMessages(startupLogger);
 
-        _taskExecutor = new TaskExecutor();
-        _taskExecutor.start();
+        BrokerStoreUpgrader upgrader = new BrokerStoreUpgrader(_systemContext);
+        _broker = upgrader.upgrade(_store);
 
-        StoreConfigurationChangeListener storeChangeListener = new StoreConfigurationChangeListener(_store);
-        RecovererProvider provider = new DefaultRecovererProvider((StatisticsGatherer)this, _virtualHostRegistry, _logRecorder,
-                                                                  _taskExecutor, brokerOptions, storeChangeListener);
-        ConfiguredObjectRecoverer<? extends ConfiguredObject> brokerRecoverer =  provider.getRecoverer(Broker.class.getSimpleName());
-        _broker = (Broker) brokerRecoverer.create(provider, _store.getRootEntry());
         _broker.setEventLogger(startupLogger);
-        _virtualHostRegistry.setDefaultVirtualHostName((String)_broker.getAttribute(Broker.DEFAULT_VIRTUAL_HOST));
-
-        initialiseStatisticsReporting();
 
         // starting the broker
         _broker.setDesiredState(State.INITIALISING, State.ACTIVE);
 
         startupLogger.message(BrokerMessages.READY());
-        _broker.setEventLogger(_eventLogger);
-
-    }
-
-    private void initialiseStatisticsReporting()
-    {
-        long report = ((Number)_broker.getAttribute(Broker.STATISTICS_REPORTING_PERIOD)).intValue() * 1000; // convert to ms
-        final boolean reset = (Boolean)_broker.getAttribute(Broker.STATISTICS_REPORTING_RESET_ENABLED);
-
-        /* add a timer task to report statistics if generation is enabled for broker or virtualhosts */
-        if (report > 0L)
-        {
-            _reportingTimer = new Timer("Statistics-Reporting", true);
-            StatisticsReportingTask task = new StatisticsReportingTask(reset, _messageLogger);
-            _reportingTimer.scheduleAtFixedRate(task, report / 2, report);
-        }
-    }
-
-    private class StatisticsReportingTask extends TimerTask
-    {
-        private final int DELIVERED = 0;
-        private final int RECEIVED = 1;
-
-        private final boolean _reset;
-        private final MessageLogger _logger;
-        private final Subject _subject;
-
-        public StatisticsReportingTask(boolean reset, MessageLogger logger)
-        {
-            _reset = reset;
-            _logger = logger;
-            _subject = SecurityManager.getSystemTaskSubject("Statistics");
-        }
-
-        public void run()
-        {
-            Subject.doAs(_subject, new PrivilegedAction<Object>()
-            {
-                @Override
-                public Object run()
-                {
-                    reportStatistics();
-                    return null;
-                }
-            });
-        }
-
-        protected void reportStatistics()
-        {
-            try
-            {
-                _eventLogger.message(BrokerMessages.STATS_DATA(DELIVERED, _dataDelivered.getPeak() / 1024.0, _dataDelivered.getTotal()));
-                _eventLogger.message(BrokerMessages.STATS_MSGS(DELIVERED, _messagesDelivered.getPeak(), _messagesDelivered.getTotal()));
-                _eventLogger.message(BrokerMessages.STATS_DATA(RECEIVED, _dataReceived.getPeak() / 1024.0, _dataReceived.getTotal()));
-                _eventLogger.message(BrokerMessages.STATS_MSGS(RECEIVED,
-                                                               _messagesReceived.getPeak(),
-                                                               _messagesReceived.getTotal()));
-                Collection<VirtualHost> hosts = _virtualHostRegistry.getVirtualHosts();
-
-                if (hosts.size() > 1)
-                {
-                    for (VirtualHost vhost : hosts)
-                    {
-                        String name = vhost.getName();
-                        StatisticsCounter dataDelivered = vhost.getDataDeliveryStatistics();
-                        StatisticsCounter messagesDelivered = vhost.getMessageDeliveryStatistics();
-                        StatisticsCounter dataReceived = vhost.getDataReceiptStatistics();
-                        StatisticsCounter messagesReceived = vhost.getMessageReceiptStatistics();
-                        EventLogger logger = vhost.getEventLogger();
-                        logger.message(VirtualHostMessages.STATS_DATA(name, DELIVERED, dataDelivered.getPeak() / 1024.0, dataDelivered.getTotal()));
-                        logger.message(VirtualHostMessages.STATS_MSGS(name, DELIVERED, messagesDelivered.getPeak(), messagesDelivered.getTotal()));
-                        logger.message(VirtualHostMessages.STATS_DATA(name, RECEIVED, dataReceived.getPeak() / 1024.0, dataReceived.getTotal()));
-                        logger.message(VirtualHostMessages.STATS_MSGS(name, RECEIVED, messagesReceived.getPeak(), messagesReceived.getTotal()));
-                    }
-                }
-
-                if (_reset)
-                {
-                    resetStatistics();
-                }
-            }
-            catch(Exception e)
-            {
-                ApplicationRegistry._logger.warn("Unexpected exception occurred while reporting the statistics", e);
-            }
-        }
-    }
+        _broker.setEventLogger(eventLogger);
 
-    /**
-     * Close non-null Closeable items and log any errors
-     * @param close
-     */
-    private void close(Closeable close)
-    {
-        try
-        {
-            if (close != null)
-            {
-                close.close();
-            }
-        }
-        catch (Throwable e)
-        {
-            _logger.error("Error thrown whilst closing " + close.getClass().getSimpleName(), e);
-        }
     }
 
     public void close()
@@ -236,93 +96,19 @@ public class ApplicationRegistry impleme
 
         try
         {
-            //Stop Statistics Reporting
-            if (_reportingTimer != null)
-            {
-                _reportingTimer.cancel();
-            }
-
             if (_broker != null)
             {
                 _broker.setDesiredState(_broker.getState(), State.STOPPED);
             }
-
-            //Shutdown virtualhosts
-            close(_virtualHostRegistry);
-
-            if (_taskExecutor != null)
-            {
-                _taskExecutor.stop();
-            }
-
-            _eventLogger.message(BrokerMessages.STOPPED());
-
-            _logRecorder.closeLogRecorder();
-
         }
         finally
         {
-            if (_taskExecutor != null)
-            {
-                _taskExecutor.stopImmediately();
-            }
+            _systemContext.close();
         }
         _store = null;
         _broker = null;
     }
 
-    public void registerMessageDelivered(long messageSize)
-    {
-        _messagesDelivered.registerEvent(1L);
-        _dataDelivered.registerEvent(messageSize);
-    }
-
-    public void registerMessageReceived(long messageSize, long timestamp)
-    {
-        _messagesReceived.registerEvent(1L, timestamp);
-        _dataReceived.registerEvent(messageSize, timestamp);
-    }
-
-    public StatisticsCounter getMessageReceiptStatistics()
-    {
-        return _messagesReceived;
-    }
-
-    public StatisticsCounter getDataReceiptStatistics()
-    {
-        return _dataReceived;
-    }
-
-    public StatisticsCounter getMessageDeliveryStatistics()
-    {
-        return _messagesDelivered;
-    }
-
-    public StatisticsCounter getDataDeliveryStatistics()
-    {
-        return _dataDelivered;
-    }
-
-    public void resetStatistics()
-    {
-        _messagesDelivered.reset();
-        _dataDelivered.reset();
-        _messagesReceived.reset();
-        _dataReceived.reset();
-
-        for (VirtualHost vhost : _virtualHostRegistry.getVirtualHosts())
-        {
-            vhost.resetStatistics();
-        }
-    }
-
-    public void initialiseStatistics()
-    {
-        _messagesDelivered = new StatisticsCounter("messages-delivered");
-        _dataDelivered = new StatisticsCounter("bytes-delivered");
-        _messagesReceived = new StatisticsCounter("messages-received");
-        _dataReceived = new StatisticsCounter("bytes-received");
-    }
 
     private void logStartupMessages(EventLogger eventLogger)
     {

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java Thu Apr  3 19:58:53 2014
@@ -24,7 +24,7 @@ import org.apache.qpid.server.BrokerOpti
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.stats.StatisticsGatherer;
 
-public interface IApplicationRegistry extends StatisticsGatherer
+public interface IApplicationRegistry
 {
 
     void initialise(BrokerOptions brokerOptions) throws Exception;

Copied: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/AbstractKeyStoreAdapter.java (from r1582544, qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractKeyStoreAdapter.java)
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/AbstractKeyStoreAdapter.java?p2=qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/AbstractKeyStoreAdapter.java&p1=qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractKeyStoreAdapter.java&r1=1582544&r2=1584365&rev=1584365&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractKeyStoreAdapter.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/AbstractKeyStoreAdapter.java Thu Apr  3 19:58:53 2014
@@ -18,28 +18,23 @@
  * under the License.
  *
  */
-package org.apache.qpid.server.model.adapter;
+package org.apache.qpid.server.security;
 
 import java.security.AccessControlException;
-import java.security.AccessController;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.KeyStore;
 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.TrustStore;
-import org.apache.qpid.server.security.SecurityManager;
+import org.apache.qpid.server.model.AbstractConfiguredObject;
 import org.apache.qpid.server.util.MapValueConverter;
 
-import javax.security.auth.Subject;
-
 public abstract class AbstractKeyStoreAdapter<X extends ConfiguredObject<X>> extends AbstractConfiguredObject<X>
 {
     public static final String DUMMY_PASSWORD_MASK = "********";
@@ -52,9 +47,10 @@ public abstract class AbstractKeyStoreAd
     protected AbstractKeyStoreAdapter(UUID id, Broker broker, Map<String, Object> defaults,
                                       Map<String, Object> attributes)
     {
-        super(id, defaults, attributes, broker.getTaskExecutor());
-
-        addParent(Broker.class, broker);
+        super(Collections.<Class<? extends ConfiguredObject>,ConfiguredObject<?>>singletonMap(Broker.class, broker),
+              defaults,
+              combineIdWithAttributes(id, attributes),
+              broker.getTaskExecutor());
 
         MapValueConverter.assertMandatoryAttribute(KeyStore.PATH, attributes);
     }
@@ -104,12 +100,6 @@ public abstract class AbstractKeyStoreAd
     }
 
     @Override
-    public <C extends ConfiguredObject> C createChild(Class<C> childClass, Map<String, Object> attributes, ConfiguredObject... otherParents)
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
     public Object getAttribute(String name)
     {
         if(KeyStore.STATE.equals(name))

Copied: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java (from r1582544, qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java)
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java?p2=qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java&p1=qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java&r1=1582544&r2=1584365&rev=1584365&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java Thu Apr  3 19:58:53 2014
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.server.model.adapter;
+package org.apache.qpid.server.security;
 
 import java.io.IOException;
 import java.lang.reflect.Type;
@@ -26,7 +26,6 @@ import java.security.AccessControlExcept
 import java.security.GeneralSecurityException;
 import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
-import java.security.PrivilegedAction;
 import java.security.cert.Certificate;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -37,23 +36,23 @@ import java.util.UUID;
 
 import javax.net.ssl.KeyManager;
 import javax.net.ssl.KeyManagerFactory;
-import javax.security.auth.Subject;
 
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.IntegrityViolationException;
 import org.apache.qpid.server.model.KeyStore;
 import org.apache.qpid.server.model.ManagedAttributeField;
+import org.apache.qpid.server.model.ManagedObject;
 import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.State;
-import org.apache.qpid.server.security.SecurityManager;
 import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.util.MapValueConverter;
 import org.apache.qpid.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.transport.network.security.ssl.QpidClientX509KeyManager;
 import org.apache.qpid.transport.network.security.ssl.SSLUtil;
 
-public class KeyStoreAdapter extends AbstractKeyStoreAdapter<KeyStoreAdapter> implements KeyStore<KeyStoreAdapter>
+@ManagedObject( category = false )
+public class FileKeyStore extends AbstractKeyStoreAdapter<FileKeyStore> implements KeyStore<FileKeyStore>
 {
     @SuppressWarnings("serial")
     public static final Map<String, Type> ATTRIBUTE_TYPES = Collections.unmodifiableMap(new HashMap<String, Type>(){{
@@ -66,6 +65,8 @@ public class KeyStoreAdapter extends Abs
     }});
 
     @ManagedAttributeField
+    private String _type;
+    @ManagedAttributeField
     private String _keyStoreType;
     @ManagedAttributeField
     private String _certificateAlias;
@@ -82,7 +83,7 @@ public class KeyStoreAdapter extends Abs
 
     private Broker<?> _broker;
 
-    public KeyStoreAdapter(UUID id, Broker<?> broker, Map<String, Object> attributes)
+    public FileKeyStore(UUID id, Broker<?> broker, Map<String, Object> attributes)
     {
         super(id, broker, DEFAULTS, attributes);
         _broker = broker;

Added: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStoreFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStoreFactory.java?rev=1584365&view=auto
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStoreFactory.java (added)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStoreFactory.java Thu Apr  3 19:58:53 2014
@@ -0,0 +1,48 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.security;
+
+import org.apache.qpid.server.model.AbstractConfiguredObjectTypeFactory;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+public class FileKeyStoreFactory extends AbstractConfiguredObjectTypeFactory<FileKeyStore>
+{
+    public FileKeyStoreFactory()
+    {
+        super(FileKeyStore.class);
+    }
+
+
+    @Override
+    public FileKeyStore createInstance(final Map<String, Object> attributes, final ConfiguredObject<?>... parents)
+    {
+        HashMap<String, Object> attributesWithoutId = new HashMap<String, Object>(attributes);
+        Object idObj = attributesWithoutId.remove(ConfiguredObject.ID);
+        UUID id = idObj == null ? UUID.randomUUID() : idObj instanceof UUID ? (UUID) idObj : UUID.fromString(idObj.toString());
+        return new FileKeyStore(id, getParent(Broker.class, parents), attributesWithoutId);
+    }
+
+}

Copied: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java (from r1582544, qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/TrustStoreAdapter.java)
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java?p2=qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java&p1=qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/TrustStoreAdapter.java&r1=1582544&r2=1584365&rev=1584365&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/TrustStoreAdapter.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java Thu Apr  3 19:58:53 2014
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.server.model.adapter;
+package org.apache.qpid.server.security;
 
 import java.io.IOException;
 import java.lang.reflect.Type;
@@ -26,7 +26,6 @@ import java.security.AccessControlExcept
 import java.security.GeneralSecurityException;
 import java.security.KeyStore;
 import java.security.NoSuchAlgorithmException;
-import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -38,17 +37,9 @@ import javax.net.ssl.TrustManager;
 import javax.net.ssl.TrustManagerFactory;
 
 import javax.net.ssl.X509TrustManager;
-import javax.security.auth.Subject;
 
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
-import org.apache.qpid.server.model.AuthenticationProvider;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.IntegrityViolationException;
-import org.apache.qpid.server.model.ManagedAttributeField;
-import org.apache.qpid.server.model.Port;
-import org.apache.qpid.server.model.State;
-import org.apache.qpid.server.model.TrustStore;
-import org.apache.qpid.server.security.SecurityManager;
+import org.apache.qpid.server.model.*;
 import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.security.auth.manager.SimpleLDAPAuthenticationManagerFactory;
 import org.apache.qpid.server.util.MapValueConverter;
@@ -56,7 +47,8 @@ import org.apache.qpid.transport.network
 import org.apache.qpid.transport.network.security.ssl.QpidPeersOnlyTrustManager;
 import org.apache.qpid.transport.network.security.ssl.SSLUtil;
 
-public class TrustStoreAdapter extends AbstractKeyStoreAdapter<TrustStoreAdapter> implements TrustStore<TrustStoreAdapter>
+@ManagedObject( category = false )
+public class FileTrustStore extends AbstractKeyStoreAdapter<FileTrustStore> implements TrustStore<FileTrustStore>
 {
     @SuppressWarnings("serial")
     public static final Map<String, Type> ATTRIBUTE_TYPES = Collections.unmodifiableMap(new HashMap<String, Type>(){{
@@ -87,7 +79,7 @@ public class TrustStoreAdapter extends A
 
     private Broker<?> _broker;
 
-    public TrustStoreAdapter(UUID id, Broker<?> broker, Map<String, Object> attributes)
+    public FileTrustStore(UUID id, Broker<?> broker, Map<String, Object> attributes)
     {
         super(id, broker, DEFAULTS, attributes);
         _broker = broker;

Added: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStoreFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStoreFactory.java?rev=1584365&view=auto
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStoreFactory.java (added)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStoreFactory.java Thu Apr  3 19:58:53 2014
@@ -0,0 +1,56 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.security;
+
+import org.apache.qpid.server.model.AbstractConfiguredObjectTypeFactory;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+public class FileTrustStoreFactory extends AbstractConfiguredObjectTypeFactory<FileTrustStore>
+{
+    public FileTrustStoreFactory()
+    {
+        super(FileTrustStore.class);
+    }
+
+    protected final Broker getBroker(ConfiguredObject<?>... parents)
+    {
+        if(parents.length != 1 && !(parents[0] instanceof Broker))
+        {
+            throw new IllegalArgumentException("Should have exactly one parent of type broker");
+        }
+        return (Broker) parents[0];
+    }
+
+    @Override
+    public FileTrustStore createInstance(final Map<String, Object> attributes, final ConfiguredObject<?>... parents)
+    {
+        HashMap<String, Object> attributesWithoutId = new HashMap<String, Object>(attributes);
+        Object idObj = attributesWithoutId.remove(ConfiguredObject.ID);
+        UUID id = idObj == null ? UUID.randomUUID() : idObj instanceof UUID ? (UUID) idObj : UUID.fromString(idObj.toString());
+        return new FileTrustStore(id, getParent(Broker.class, parents), attributesWithoutId);
+    }
+
+}

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java Thu Apr  3 19:58:53 2014
@@ -22,9 +22,9 @@ package org.apache.qpid.server.security.
 
 import org.apache.log4j.Logger;
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
-import org.apache.qpid.server.configuration.updater.TaskExecutor;
 import org.apache.qpid.server.model.*;
-import org.apache.qpid.server.model.adapter.AbstractConfiguredObject;
+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;
@@ -34,6 +34,7 @@ import java.security.AccessControlExcept
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicReference;
@@ -92,6 +93,11 @@ public abstract class AbstractAuthentica
         throw new IllegalConfigurationException("Cannot associate  " + user + " with authentication provider " + this);
     }
 
+    public void instantiatePreferencesProvider(final PreferencesProvider preferencesProvider)
+    {
+        _preferencesProvider = preferencesProvider;
+    }
+
     @Override
     public String setName(final String currentName, final String desiredName)
             throws IllegalStateException, AccessControlException
@@ -137,11 +143,13 @@ public abstract class AbstractAuthentica
     {
         if(childClass == PreferencesProvider.class)
         {
-            String name = MapValueConverter.getStringAttribute(PreferencesProvider.NAME, attributes);
-            String type = MapValueConverter.getStringAttribute(PreferencesProvider.TYPE, attributes);
-            PreferencesProviderFactory factory = PreferencesProviderFactory.FACTORIES.get(type);
-            UUID id = UUIDGenerator.generatePreferencesProviderUUID(name, getName());
-            PreferencesProvider pp = factory.createInstance(id, attributes, this);
+            // TODO RG - get the configured object factory from parents
+            ConfiguredObjectFactory factory = new ConfiguredObjectFactory();
+            attributes = new HashMap<String, Object>(attributes);
+            attributes.put(ConfiguredObject.ID, UUID.randomUUID());
+            final ConfiguredObjectTypeFactory preferencesFactory =
+                    factory.getConfiguredObjectTypeFactory(PreferencesProvider.class, attributes);
+            PreferencesProvider pp = (PreferencesProvider) preferencesFactory.create(attributes, this);
             pp.setDesiredState(State.INITIALISING, State.ACTIVE);
             _preferencesProvider = pp;
             return (C)pp;

Added: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManagerFactory.java?rev=1584365&view=auto
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManagerFactory.java (added)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManagerFactory.java Thu Apr  3 19:58:53 2014
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.security.auth.manager;
+
+import org.apache.qpid.server.model.AbstractConfiguredObjectTypeFactory;
+import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
+
+public abstract class AbstractAuthenticationManagerFactory<X extends AbstractAuthenticationManager<X>>
+        extends AbstractConfiguredObjectTypeFactory<X> implements AuthenticationManagerFactory<X>
+{
+    protected AbstractAuthenticationManagerFactory(final Class<X> clazz)
+    {
+        super(clazz);
+    }
+
+}

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManager.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManager.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManager.java Thu Apr  3 19:58:53 2014
@@ -27,12 +27,13 @@ import javax.security.auth.Subject;
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 
-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;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.server.security.auth.sasl.anonymous.AnonymousSaslServer;
 
+@ManagedObject( category = false, type= "Anonymous" )
 public class AnonymousAuthenticationManager extends AbstractAuthenticationManager<AnonymousAuthenticationManager>
 {
     private static final String ANONYMOUS = "ANONYMOUS";

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerFactory.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerFactory.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerFactory.java Thu Apr  3 19:58:53 2014
@@ -19,45 +19,43 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
+import org.apache.qpid.server.model.AbstractConfiguredObjectTypeFactory;
 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.plugin.AuthenticationManagerFactory;
 
-public class AnonymousAuthenticationManagerFactory implements AuthenticationManagerFactory
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+public class AnonymousAuthenticationManagerFactory extends AbstractConfiguredObjectTypeFactory<AnonymousAuthenticationManager> implements AuthenticationManagerFactory<AnonymousAuthenticationManager>
 {
     public static final String PROVIDER_TYPE = "Anonymous";
 
-    @Override
-    public AnonymousAuthenticationManager createInstance(Broker broker,
-                                                         Map<String, Object> attributes,
-                                                         final boolean recovering)
+    public AnonymousAuthenticationManagerFactory()
     {
-        if (attributes != null && PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
-        {
-            return new AnonymousAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes);
-        }
-        return null;
+        super(AnonymousAuthenticationManager.class);
     }
 
     @Override
     public Collection<String> getAttributeNames()
     {
-        return Collections.<String>singletonList(AuthenticationProvider.TYPE);
+        return Collections.singletonList(AuthenticationProvider.TYPE);
     }
 
+
     @Override
-    public String getType()
+    public Map<String, String> getAttributeDescriptions()
     {
-        return PROVIDER_TYPE;
+        return Collections.emptyMap();
     }
 
-    @Override
-    public Map<String, String> getAttributeDescriptions()
+    public AnonymousAuthenticationManager createInstance(final Map<String, Object> attributes,
+                                                         final ConfiguredObject<?>... parents)
     {
-        return null;
+        return new AnonymousAuthenticationManager(getParent(Broker.class,parents), Collections.<String,Object>emptyMap(),attributes);
     }
+
+
 }

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordDatabaseAuthenticationManager.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordDatabaseAuthenticationManager.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordDatabaseAuthenticationManager.java Thu Apr  3 19:58:53 2014
@@ -22,6 +22,7 @@ package org.apache.qpid.server.security.
 
 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.database.Base64MD5PasswordFilePrincipalDatabase;
 import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
 import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
@@ -31,6 +32,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
+@ManagedObject( category = false, type = "Base64MD5PasswordFile" )
 public class Base64MD5PasswordDatabaseAuthenticationManager
         extends PrincipalDatabaseAuthenticationManager<Base64MD5PasswordDatabaseAuthenticationManager>
 {

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactory.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactory.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactory.java Thu Apr  3 19:58:53 2014
@@ -20,17 +20,21 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
+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.store.ConfiguredObjectRecord;
+import org.apache.qpid.server.store.ResolvedObject;
+import org.apache.qpid.server.store.UnresolvedConfiguredObject;
+import org.apache.qpid.server.util.ResourceBundleLoader;
+
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.qpid.server.model.AuthenticationProvider;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
-import org.apache.qpid.server.util.ResourceBundleLoader;
-
-public class Base64MD5PasswordFileAuthenticationManagerFactory implements AuthenticationManagerFactory
+public class Base64MD5PasswordFileAuthenticationManagerFactory extends AbstractAuthenticationManagerFactory<Base64MD5PasswordDatabaseAuthenticationManager>
 {
     public static final String PROVIDER_TYPE = "Base64MD5PasswordFile";
     public static final String RESOURCE_BUNDLE = "org.apache.qpid.server.security.auth.manager.PasswordFileAuthenticationProviderAttributeDescriptions";
@@ -41,10 +45,9 @@ public class Base64MD5PasswordFileAuthen
             AuthenticationProvider.TYPE,
             ATTRIBUTE_PATH));
 
-    @Override
-    public String getType()
+    public Base64MD5PasswordFileAuthenticationManagerFactory()
     {
-        return PROVIDER_TYPE;
+        super(Base64MD5PasswordDatabaseAuthenticationManager.class);
     }
 
     @Override
@@ -53,24 +56,31 @@ public class Base64MD5PasswordFileAuthen
         return ResourceBundleLoader.getResources(RESOURCE_BUNDLE);
     }
 
-
     @Override
-    public AbstractAuthenticationManager createInstance(final Broker broker,
-                                                        final Map<String, Object> attributes,
-                                                        final boolean recovering)
+    public Collection<String> getAttributeNames()
     {
-        if (attributes == null || !getType().equals(attributes.get(AuthenticationProvider.TYPE)))
-        {
-            return null;
-        }
-
-        return new Base64MD5PasswordDatabaseAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes,recovering);
+        return ATTRIBUTES;
     }
 
     @Override
-    public Collection<String> getAttributeNames()
+    public Base64MD5PasswordDatabaseAuthenticationManager createInstance(final Map<String, Object> attributes,
+                                                                         final ConfiguredObject<?>... parents)
     {
-        return ATTRIBUTES;
+        return new Base64MD5PasswordDatabaseAuthenticationManager(getParent(Broker.class, parents), Collections.<String,Object>emptyMap(),attributes,false);
     }
 
+    @Override
+    public UnresolvedConfiguredObject<Base64MD5PasswordDatabaseAuthenticationManager> recover(final ConfiguredObjectRecord record,
+                                                                                              final ConfiguredObject<?>... parents)
+    {
+
+        Map<String, Object> attributes = new HashMap<String, Object>(record.getAttributes());
+        attributes.put(ConfiguredObject.ID, record.getId());
+        final Base64MD5PasswordDatabaseAuthenticationManager authenticationManager =
+                new Base64MD5PasswordDatabaseAuthenticationManager(getParent(Broker.class, parents),
+                                                                   Collections.<String, Object>emptyMap(),
+                                                                   attributes,
+                                                                   true);
+        return ResolvedObject.newInstance(authenticationManager);
+    }
 }

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java Thu Apr  3 19:58:53 2014
@@ -28,10 +28,12 @@ import org.apache.qpid.server.configurat
 import org.apache.qpid.server.model.Broker;
 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.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.server.security.auth.sasl.external.ExternalSaslServer;
 
+@ManagedObject( category = false, type = "External" )
 public class ExternalAuthenticationManager extends AbstractAuthenticationManager<ExternalAuthenticationManager>
 {
     private static final String EXTERNAL = "EXTERNAL";

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerFactory.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerFactory.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerFactory.java Thu Apr  3 19:58:53 2014
@@ -19,17 +19,17 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
+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.util.ResourceBundleLoader;
+
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
-import org.apache.qpid.server.model.AuthenticationProvider;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
-import org.apache.qpid.server.util.ResourceBundleLoader;
-
-public class ExternalAuthenticationManagerFactory implements AuthenticationManagerFactory
+public class ExternalAuthenticationManagerFactory extends AbstractAuthenticationManagerFactory<ExternalAuthenticationManager>
 {
     public static final String RESOURCE_BUNDLE = "org.apache.qpid.server.security.auth.manager.ExternalAuthenticationProviderAttributeDescriptions";
     public static final String PROVIDER_TYPE = "External";
@@ -39,16 +39,9 @@ public class ExternalAuthenticationManag
             AuthenticationProvider.TYPE,
             ATTRIBUTE_USE_FULL_DN));
 
-    @Override
-    public ExternalAuthenticationManager createInstance(Broker broker,
-                                                        Map<String, Object> attributes,
-                                                        final boolean recovering)
+    public ExternalAuthenticationManagerFactory()
     {
-        if (attributes != null && PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
-        {
-            return new ExternalAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes);
-        }
-        return null;
+        super(ExternalAuthenticationManager.class);
     }
 
     @Override
@@ -58,15 +51,16 @@ public class ExternalAuthenticationManag
     }
 
     @Override
-    public String getType()
+    public Map<String, String> getAttributeDescriptions()
     {
-        return PROVIDER_TYPE;
+        return ResourceBundleLoader.getResources(RESOURCE_BUNDLE);
     }
 
     @Override
-    public Map<String, String> getAttributeDescriptions()
+    public ExternalAuthenticationManager createInstance(final Map<String, Object> attributes,
+                                                        final ConfiguredObject<?>... parents)
     {
-        return ResourceBundleLoader.getResources(RESOURCE_BUNDLE);
+        return new ExternalAuthenticationManager(getParent(Broker.class, parents), Collections.<String,Object>emptyMap(),attributes);
     }
 
 }

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManager.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManager.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManager.java Thu Apr  3 19:58:53 2014
@@ -32,9 +32,11 @@ import javax.security.sasl.SaslServer;
 
 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;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 
+@ManagedObject( category = false, type = "Kerberos" )
 public class KerberosAuthenticationManager extends AbstractAuthenticationManager<KerberosAuthenticationManager>
 {
     private static final String GSSAPI_MECHANISM = "GSSAPI";

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerFactory.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerFactory.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerFactory.java Thu Apr  3 19:58:53 2014
@@ -19,28 +19,21 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
+
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
-import org.apache.qpid.server.model.AuthenticationProvider;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
-
-public class KerberosAuthenticationManagerFactory implements AuthenticationManagerFactory
+public class KerberosAuthenticationManagerFactory extends AbstractAuthenticationManagerFactory<KerberosAuthenticationManager>
 {
     public static final String PROVIDER_TYPE = "Kerberos";
 
-    @Override
-    public KerberosAuthenticationManager createInstance(Broker broker,
-                                                        Map<String, Object> attributes,
-                                                        final boolean recovering)
+    public KerberosAuthenticationManagerFactory()
     {
-        if (attributes != null && PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
-        {
-            return new KerberosAuthenticationManager(broker, Collections.<String,Object>emptyMap(), attributes);
-        }
-        return null;
+        super(KerberosAuthenticationManager.class);
     }
 
     @Override
@@ -50,14 +43,16 @@ public class KerberosAuthenticationManag
     }
 
     @Override
-    public String getType()
+    public Map<String, String> getAttributeDescriptions()
     {
-        return PROVIDER_TYPE;
+        return Collections.emptyMap();
     }
 
     @Override
-    public Map<String, String> getAttributeDescriptions()
+    public KerberosAuthenticationManager createInstance(final Map<String, Object> attributes,
+                                                        final ConfiguredObject<?>... parents)
     {
-        return null;
+        return new KerberosAuthenticationManager(getParent(Broker.class, parents), Collections.<String,Object>emptyMap(), attributes);
     }
+
 }

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java Thu Apr  3 19:58:53 2014
@@ -21,11 +21,13 @@
 package org.apache.qpid.server.security.auth.manager;
 
 import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ManagedObject;
 import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
 import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
 
 import java.util.Map;
 
+@ManagedObject( category = false, type = "PlainPasswordFile" )
 public class PlainPasswordDatabaseAuthenticationManager extends PrincipalDatabaseAuthenticationManager<PlainPasswordDatabaseAuthenticationManager>
 {
     protected PlainPasswordDatabaseAuthenticationManager(final Broker broker,

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java Thu Apr  3 19:58:53 2014
@@ -20,17 +20,21 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
+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.store.ConfiguredObjectRecord;
+import org.apache.qpid.server.store.ResolvedObject;
+import org.apache.qpid.server.store.UnresolvedConfiguredObject;
+import org.apache.qpid.server.util.ResourceBundleLoader;
+
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.qpid.server.model.AuthenticationProvider;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
-import org.apache.qpid.server.util.ResourceBundleLoader;
-
-public class PlainPasswordFileAuthenticationManagerFactory implements AuthenticationManagerFactory
+public class PlainPasswordFileAuthenticationManagerFactory extends AbstractAuthenticationManagerFactory<PlainPasswordDatabaseAuthenticationManager>
 {
     public static final String RESOURCE_BUNDLE = "org.apache.qpid.server.security.auth.manager.PasswordFileAuthenticationProviderAttributeDescriptions";
     public static final String ATTRIBUTE_PATH = "path";
@@ -42,23 +46,9 @@ public class PlainPasswordFileAuthentica
 
     public static final String PROVIDER_TYPE = "PlainPasswordFile";
 
-    @Override
-    public String getType()
-    {
-        return PROVIDER_TYPE;
-    }
-
-    @Override
-    public AbstractAuthenticationManager createInstance(final Broker broker,
-                                                        final Map<String, Object> attributes,
-                                                        final boolean recovering)
+    public PlainPasswordFileAuthenticationManagerFactory()
     {
-        if (attributes == null || !getType().equals(attributes.get(AuthenticationProvider.TYPE)))
-        {
-            return null;
-        }
-
-        return new PlainPasswordDatabaseAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes,recovering);
+        super(PlainPasswordDatabaseAuthenticationManager.class);
     }
 
     @Override
@@ -73,4 +63,27 @@ public class PlainPasswordFileAuthentica
     {
         return ATTRIBUTES;
     }
+
+    @Override
+    public PlainPasswordDatabaseAuthenticationManager createInstance(final Map<String, Object> attributes,
+                                                                     final ConfiguredObject<?>... parents)
+    {
+        return new PlainPasswordDatabaseAuthenticationManager(getParent(Broker.class, parents), Collections.<String,Object>emptyMap(),attributes,false);
+    }
+
+    @Override
+    public UnresolvedConfiguredObject<PlainPasswordDatabaseAuthenticationManager> recover(final ConfiguredObjectRecord record,
+                                                                                          final ConfiguredObject<?>... parents)
+    {
+
+        Map<String, Object> attributes = new HashMap<String, Object>(record.getAttributes());
+        attributes.put(ConfiguredObject.ID, record.getId());
+        PlainPasswordDatabaseAuthenticationManager authManager = new PlainPasswordDatabaseAuthenticationManager(
+                getParent(Broker.class, parents),
+                Collections.<String, Object>emptyMap(),
+                attributes,
+                true);
+
+        return ResolvedObject.newInstance(authManager);
+    }
 }

Modified: qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java?rev=1584365&r1=1584364&r2=1584365&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java Thu Apr  3 19:58:53 2014
@@ -39,8 +39,7 @@ import javax.security.sasl.SaslServer;
 import org.apache.log4j.Logger;
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.model.*;
-import org.apache.qpid.server.model.adapter.AbstractConfiguredObject;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
+import org.apache.qpid.server.model.AbstractConfiguredObject;
 import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
@@ -420,14 +419,6 @@ public abstract class PrincipalDatabaseA
         }
 
         @Override
-        public <C extends ConfiguredObject> C createChild(Class<C> childClass,
-                                                          Map<String, Object> attributes,
-                                                          ConfiguredObject... otherParents)
-        {
-            return null;
-        }
-
-        @Override
         public Collection<String> getAttributeNames()
         {
             return getAttributeNames(User.class);



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


Mime
View raw message