qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject svn commit: r1752316 - in /qpid/java/trunk: bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/ bd...
Date Tue, 12 Jul 2016 17:07:59 GMT
Author: orudyy
Date: Tue Jul 12 17:07:58 2016
New Revision: 1752316

URL: http://svn.apache.org/viewvc?rev=1752316&view=rev
Log:
QPID-7332: [Java Broker] Implement BDB PreferenceStore backend

Added:
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreFactoryService.java
      - copied, changed from r1752293, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/ProvidedPreferenceStoreFactoryService.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9.java
    qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreTest.java
    qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9Test.java
    qpid/java/trunk/bdbstore/src/test/resources/upgrade/bdbstore-v8/
    qpid/java/trunk/bdbstore/src/test/resources/upgrade/bdbstore-v8/test-store/
    qpid/java/trunk/bdbstore/src/test/resources/upgrade/bdbstore-v8/test-store/00000000.jdb
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRoot.java
      - copied, changed from r1752293, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceStoreProvider.java
Modified:
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfig.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfigImpl.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNode.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNode.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNodeImpl.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostNode.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceStoreProvider.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRecoverer.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/ProvidedPreferenceStoreFactoryService.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
    qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfig.java
    qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java
    qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCSystemConfig.java
    qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java

Added: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java?rev=1752316&view=auto
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java (added)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java Tue Jul 12 17:07:58 2016
@@ -0,0 +1,356 @@
+/*
+ * 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.store.berkeleydb;
+
+import static org.apache.qpid.server.store.berkeleydb.BDBUtils.DEFAULT_DATABASE_CONFIG;
+import static org.apache.qpid.server.store.berkeleydb.BDBUtils.abortTransactionSafely;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.sleepycat.bind.tuple.LongBinding;
+import com.sleepycat.bind.tuple.StringBinding;
+import com.sleepycat.je.Cursor;
+import com.sleepycat.je.Database;
+import com.sleepycat.je.DatabaseConfig;
+import com.sleepycat.je.DatabaseEntry;
+import com.sleepycat.je.DatabaseException;
+import com.sleepycat.je.DatabaseNotFoundException;
+import com.sleepycat.je.LockMode;
+import com.sleepycat.je.OperationStatus;
+import com.sleepycat.je.Transaction;
+import org.slf4j.Logger;
+
+import org.apache.qpid.server.model.BrokerModel;
+import org.apache.qpid.server.model.ModelVersion;
+import org.apache.qpid.server.store.StoreException;
+import org.apache.qpid.server.store.berkeleydb.tuple.MapBinding;
+import org.apache.qpid.server.store.berkeleydb.tuple.UUIDTupleBinding;
+import org.apache.qpid.server.store.preferences.PreferenceRecord;
+import org.apache.qpid.server.store.preferences.PreferenceRecordImpl;
+import org.apache.qpid.server.store.preferences.PreferenceStore;
+import org.apache.qpid.server.store.preferences.PreferenceStoreUpdater;
+
+abstract class AbstractBDBPreferenceStore implements PreferenceStore
+{
+    private static final String PREFERENCES_DB_NAME = "USER_PREFERENCES";
+    private static final String PREFERENCES_VERSION_DB_NAME = "USER_PREFERENCES_VERSION";
+    private AtomicReference<StoreState> _storeState = new AtomicReference<>(StoreState.CLOSED);
+
+    @Override
+    public Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater) throws StoreException
+    {
+        if (!_storeState.compareAndSet(StoreState.CLOSED, StoreState.OPENING))
+        {
+            throw new IllegalStateException(String.format("PreferenceStore cannot be opened when in state '%s'",
+                                                          getStoreState()));
+        }
+
+        EnvironmentFacade environmentFacade = getEnvironmentFacade();
+
+        try
+        {
+            Collection<PreferenceRecord> records = new LinkedHashSet<>();
+
+            Cursor cursor = null;
+
+            try
+            {
+                cursor = getPreferencesDb().openCursor(null, null);
+                DatabaseEntry key = new DatabaseEntry();
+                DatabaseEntry value = new DatabaseEntry();
+                UUIDTupleBinding keyBinding = UUIDTupleBinding.getInstance();
+                MapBinding valueBinding = MapBinding.getInstance();
+
+                while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS)
+                {
+                    UUID preferenceId = keyBinding.entryToObject(key);
+                    Map<String, Object> preferenceAttributes = valueBinding.entryToObject(value);
+                    PreferenceRecord record = new PreferenceRecordImpl(preferenceId, preferenceAttributes);
+                    records.add(record);
+                }
+            }
+            catch (RuntimeException e)
+            {
+                throw environmentFacade.handleDatabaseException("Cannot visit messages", e);
+            }
+            finally
+            {
+                if (cursor != null)
+                {
+                    try
+                    {
+                        cursor.close();
+                    }
+                    catch (RuntimeException e)
+                    {
+                        throw environmentFacade.handleDatabaseException("Cannot close cursor", e);
+                    }
+                }
+            }
+
+            ModelVersion currentVersion =
+                    new ModelVersion(BrokerModel.MODEL_MAJOR_VERSION, BrokerModel.MODEL_MINOR_VERSION);
+            ModelVersion storedVersion = getStoredVersion();
+            if (storedVersion.lessThan(currentVersion))
+            {
+                final Collection<UUID> ids = new HashSet<>();
+                for (PreferenceRecord record : records)
+                {
+                    ids.add(record.getId());
+                }
+
+                records = updater.updatePreferences(storedVersion.toString(), records);
+                replace(ids, records);
+            }
+
+            _storeState.set(StoreState.OPENED);
+            return records;
+        }
+        catch (Exception e)
+        {
+            close();
+            throw e;
+        }
+    }
+
+    @Override
+    public void updateOrCreate(final Collection<PreferenceRecord> preferenceRecords)
+    {
+        if (!getStoreState().equals(StoreState.OPENED))
+        {
+            throw new IllegalStateException("PreferenceStore is not opened");
+        }
+
+        if (preferenceRecords.isEmpty())
+        {
+            return;
+        }
+
+        EnvironmentFacade environmentFacade = getEnvironmentFacade();
+        Transaction txn = null;
+        try
+        {
+            txn = environmentFacade.beginTransaction(null);
+            updateOrCreateInternal(txn, preferenceRecords);
+            txn.commit();
+            txn = null;
+        }
+        catch (RuntimeException e)
+        {
+            throw environmentFacade.handleDatabaseException("Error on preferences updateOrCreate: " + e.getMessage(),
+                                                            e);
+        }
+        finally
+        {
+            if (txn != null)
+            {
+                abortTransactionSafely(txn, environmentFacade);
+            }
+        }
+    }
+
+    @Override
+    public void replace(final Collection<UUID> preferenceRecordsToRemove,
+                        final Collection<PreferenceRecord> preferenceRecordsToAdd)
+    {
+        if (!getStoreState().equals(StoreState.OPENED))
+        {
+            throw new IllegalStateException("PreferenceStore is not opened");
+        }
+
+        if (preferenceRecordsToRemove.isEmpty() && preferenceRecordsToAdd.isEmpty())
+        {
+            return;
+        }
+
+        EnvironmentFacade environmentFacade = getEnvironmentFacade();
+        Transaction txn = null;
+        try
+        {
+            txn = environmentFacade.beginTransaction(null);
+            Database preferencesDb = getPreferencesDb();
+            DatabaseEntry key = new DatabaseEntry();
+            UUIDTupleBinding keyBinding = UUIDTupleBinding.getInstance();
+            for (UUID id : preferenceRecordsToRemove)
+            {
+                getLogger().debug("Removing preference {}", id);
+                keyBinding.objectToEntry(id, key);
+                OperationStatus status = preferencesDb.delete(txn, key);
+                if (status == OperationStatus.NOTFOUND)
+                {
+                    getLogger().debug("Preference {} not found", id);
+                }
+            }
+            updateOrCreateInternal(txn, preferenceRecordsToAdd);
+            txn.commit();
+            txn = null;
+        }
+        catch (RuntimeException e)
+        {
+            throw environmentFacade.handleDatabaseException("Error on replacing of preferences: " + e.getMessage(), e);
+        }
+        finally
+        {
+            if (txn != null)
+            {
+                abortTransactionSafely(txn, environmentFacade);
+            }
+        }
+    }
+
+    protected abstract EnvironmentFacade getEnvironmentFacade();
+
+    protected abstract Logger getLogger();
+
+    boolean closeInternal()
+    {
+        while (true)
+        {
+            StoreState storeState = getStoreState();
+            if (storeState.equals(StoreState.OPENED) || storeState.equals(StoreState.OPENING))
+            {
+                if (_storeState.compareAndSet(storeState, StoreState.CLOSING))
+                {
+                    break;
+                }
+            }
+            else if (storeState.equals(StoreState.CLOSED) || storeState.equals(StoreState.CLOSING))
+            {
+                return false;
+            }
+        }
+
+        getEnvironmentFacade().closeDatabase(PREFERENCES_DB_NAME);
+
+        _storeState.set(StoreState.CLOSED);
+        return true;
+    }
+
+    StoreState getStoreState()
+    {
+        return _storeState.get();
+    }
+
+    private void updateOrCreateInternal(final Transaction txn,
+                                        final Collection<PreferenceRecord> preferenceRecords)
+    {
+        Database preferencesDb = getPreferencesDb();
+        DatabaseEntry key = new DatabaseEntry();
+        DatabaseEntry value = new DatabaseEntry();
+        UUIDTupleBinding keyBinding = UUIDTupleBinding.getInstance();
+        MapBinding valueBinding = MapBinding.getInstance();
+        for (PreferenceRecord record : preferenceRecords)
+        {
+            keyBinding.objectToEntry(record.getId(), key);
+            valueBinding.objectToEntry(record.getAttributes(), value);
+            OperationStatus status = preferencesDb.put(txn, key, value);
+            if (status != OperationStatus.SUCCESS)
+            {
+                throw new StoreException(String.format("Error writing preference with id '%s' (status %s)",
+                                                       record.getId(),
+                                                       status.name()));
+            }
+        }
+    }
+
+    private Database getPreferencesDb()
+    {
+        return getEnvironmentFacade().openDatabase(PREFERENCES_DB_NAME, DEFAULT_DATABASE_CONFIG);
+    }
+
+    private Database getPreferencesVersionDb()
+    {
+        Database preferencesVersionDb;
+        try
+        {
+            DatabaseConfig config = new DatabaseConfig().setTransactional(true).setAllowCreate(false);
+            preferencesVersionDb = getEnvironmentFacade().openDatabase(PREFERENCES_VERSION_DB_NAME, config);
+        }
+        catch (DatabaseNotFoundException e)
+        {
+            preferencesVersionDb = getEnvironmentFacade().openDatabase(PREFERENCES_VERSION_DB_NAME, DEFAULT_DATABASE_CONFIG);
+            DatabaseEntry key = new DatabaseEntry();
+            DatabaseEntry value = new DatabaseEntry();
+            StringBinding.stringToEntry(BrokerModel.MODEL_VERSION, key);
+            LongBinding.longToEntry(System.currentTimeMillis(), value);
+            preferencesVersionDb.put(null, key, value);
+        }
+
+        return preferencesVersionDb;
+    }
+
+    private ModelVersion getStoredVersion() throws RuntimeException
+    {
+        Cursor cursor = null;
+
+        try
+        {
+            cursor = getPreferencesVersionDb().openCursor(null, null);
+
+            DatabaseEntry key = new DatabaseEntry();
+            DatabaseEntry value = new DatabaseEntry();
+
+            ModelVersion storedVersion = null;
+            while (cursor.getNext(key, value, null) == OperationStatus.SUCCESS)
+            {
+                String versionString = StringBinding.entryToString(key);
+                ModelVersion version = ModelVersion.fromString(versionString);
+                if (storedVersion == null || storedVersion.lessThan(version))
+                {
+                    storedVersion = version;
+                }
+            }
+            if (storedVersion == null)
+            {
+                throw new StoreException("No preference version information.");
+            }
+            return storedVersion;
+        }
+        catch (RuntimeException e)
+        {
+            throw getEnvironmentFacade().handleDatabaseException("Cannot visit preference version", e);
+        }
+        finally
+        {
+            if (cursor != null)
+            {
+                try
+                {
+                    cursor.close();
+                    getEnvironmentFacade().closeDatabase(PREFERENCES_VERSION_DB_NAME);
+                }
+                catch (RuntimeException e)
+                {
+                    throw getEnvironmentFacade().handleDatabaseException("Cannot close cursor", e);
+                }
+            }
+        }
+    }
+
+    enum StoreState
+    {
+        CLOSED, OPENING, OPENED, CLOSING;
+    }
+}

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java Tue Jul 12 17:07:58 2016
@@ -53,8 +53,10 @@ import org.apache.qpid.server.store.berk
 import org.apache.qpid.server.store.berkeleydb.tuple.ConfiguredObjectBinding;
 import org.apache.qpid.server.store.berkeleydb.tuple.HierarchyKeyBinding;
 import org.apache.qpid.server.store.berkeleydb.tuple.UUIDTupleBinding;
-import org.apache.qpid.server.store.berkeleydb.upgrade.Upgrader;
 import org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler;
+import org.apache.qpid.server.store.preferences.PreferenceRecord;
+import org.apache.qpid.server.store.preferences.PreferenceStore;
+import org.apache.qpid.server.store.preferences.PreferenceStoreUpdater;
 import org.apache.qpid.util.FileUtils;
 
 /**
@@ -65,7 +67,7 @@ public class BDBConfigurationStore imple
 {
     private static final Logger LOGGER = LoggerFactory.getLogger(BDBConfigurationStore.class);
 
-    public static final int VERSION = 8;
+    public static final int VERSION = 9;
     private static final String CONFIGURED_OBJECTS_DB_NAME = "CONFIGURED_OBJECTS";
     private static final String CONFIGURED_OBJECT_HIERARCHY_DB_NAME = "CONFIGURED_OBJECT_HIERARCHY";
 
@@ -74,6 +76,7 @@ public class BDBConfigurationStore imple
     private final EnvironmentFacadeFactory _environmentFacadeFactory;
 
     private final ProvidedBDBMessageStore _providedMessageStore = new ProvidedBDBMessageStore();
+    private final ProvidedBDBPreferenceStore _providedPreferenceStore = new ProvidedBDBPreferenceStore();
 
     private EnvironmentFacade _environmentFacade;
 
@@ -469,6 +472,11 @@ public class BDBConfigurationStore imple
         return _providedMessageStore;
     }
 
+    public PreferenceStore getPreferenceStore()
+    {
+        return _providedPreferenceStore;
+    }
+
     private void checkConfigurationStoreOpen()
     {
         if (!isConfigurationStoreOpen())
@@ -609,4 +617,30 @@ public class BDBConfigurationStore imple
         }
     }
 
+    private class ProvidedBDBPreferenceStore extends AbstractBDBPreferenceStore
+    {
+        @Override
+        public Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater) throws StoreException
+        {
+            return super.openAndLoad(updater);
+        }
+
+        @Override
+        public void close()
+        {
+            closeInternal();
+        }
+
+        @Override
+        protected EnvironmentFacade getEnvironmentFacade()
+        {
+            return _environmentFacade;
+        }
+
+        @Override
+        protected Logger getLogger()
+        {
+            return LOGGER;
+        }
+    }
 }

Added: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java?rev=1752316&view=auto
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java (added)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java Tue Jul 12 17:07:58 2016
@@ -0,0 +1,125 @@
+/*
+ * 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.store.berkeleydb;
+
+import java.util.Collection;
+import java.util.Map;
+
+import com.sleepycat.je.CacheMode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.store.StoreException;
+import org.apache.qpid.server.store.preferences.PreferenceRecord;
+import org.apache.qpid.server.store.preferences.PreferenceStoreUpdater;
+
+public class BDBPreferenceStore extends AbstractBDBPreferenceStore
+{
+    private static final Logger LOGGER = LoggerFactory.getLogger(BDBPreferenceStore.class);
+
+    private final EnvironmentFacadeFactory _environmentFactory;
+    private volatile EnvironmentFacade _environmentFacade;
+
+    public BDBPreferenceStore(final ConfiguredObject<?> parent, final String storePath)
+    {
+        _environmentFactory = new EnvironmentFacadeFactory()
+        {
+            @Override
+            public EnvironmentFacade createEnvironmentFacade(final ConfiguredObject<?> object)
+            {
+                return new StandardEnvironmentFacade(new StandardEnvironmentConfiguration()
+                {
+                    @Override
+                    public String getName()
+                    {
+                        return parent.getName();
+                    }
+
+                    @Override
+                    public String getStorePath()
+                    {
+                        return storePath;
+                    }
+
+                    @Override
+                    public CacheMode getCacheMode()
+                    {
+                        return BDBUtils.getCacheMode(parent);
+                    }
+
+                    @Override
+                    public Map<String, String> getParameters()
+                    {
+                        return BDBUtils.getEnvironmentConfigurationParameters(parent);
+                    }
+
+                    @Override
+                    public int getFacadeParameter(final String parameterName, final int defaultValue)
+                    {
+                        return BDBUtils.getContextValue(parent, Integer.class, parameterName, defaultValue);
+                    }
+                });
+            }
+        };
+    }
+
+    @Override
+    public Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater) throws StoreException
+    {
+        StoreState storeState = getStoreState();
+        if (StoreState.OPENED.equals(storeState) || StoreState.OPENING.equals(storeState))
+        {
+            throw new IllegalStateException("PreferenceStore is already opened");
+        }
+
+        _environmentFacade = _environmentFactory.createEnvironmentFacade(null);
+        return super.openAndLoad(updater);
+    }
+
+    @Override
+    public void close()
+    {
+        if (closeInternal())
+        {
+            try
+            {
+                _environmentFacade.close();
+                _environmentFacade = null;
+            }
+            catch (RuntimeException e)
+            {
+                throw new StoreException("Exception occurred on preference store close", e);
+            }
+        }
+    }
+
+    @Override
+    protected EnvironmentFacade getEnvironmentFacade()
+    {
+        return _environmentFacade;
+    }
+
+    @Override
+    protected Logger getLogger()
+    {
+        return LOGGER;
+    }
+}

Copied: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreFactoryService.java (from r1752293, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/ProvidedPreferenceStoreFactoryService.java)
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreFactoryService.java?p2=qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreFactoryService.java&p1=qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/ProvidedPreferenceStoreFactoryService.java&r1=1752293&r2=1752316&rev=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/ProvidedPreferenceStoreFactoryService.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreFactoryService.java Tue Jul 12 17:07:58 2016
@@ -17,55 +17,36 @@
  * under the License.
  */
 
-package org.apache.qpid.server.store.preferences;
+package org.apache.qpid.server.store.berkeleydb;
+
 
-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.ConfiguredObject;
 import org.apache.qpid.server.plugin.PluggableService;
+import org.apache.qpid.server.store.preferences.PreferenceStore;
+import org.apache.qpid.server.store.preferences.PreferenceStoreFactoryService;
 
 @SuppressWarnings("unused")
 @PluggableService
-public class ProvidedPreferenceStoreFactoryService implements PreferenceStoreFactoryService
+public class BDBPreferenceStoreFactoryService implements PreferenceStoreFactoryService
 {
-
-    public static final String TYPE = "Provided";
+    private static final String TYPE = "BDB";
+    private static final String PATH = "path";
 
     @Override
     public PreferenceStore createInstance(final ConfiguredObject<?> parent,
                                           final Map<String, Object> preferenceStoreAttributes)
     {
-        // TODO: Implement real ProvidedPreferenceStore
-        return new PreferenceStore()
+        final Object path = preferenceStoreAttributes.get(PATH);
+        if (path == null || !(path instanceof String))
         {
-            @Override
-            public Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater)
-            {
-                return Collections.emptyList();
-            }
-
-            @Override
-            public void close()
-            {
-
-            }
-
-            @Override
-            public void updateOrCreate(final Collection<PreferenceRecord> preferenceRecords)
-            {
-
-            }
-
-            @Override
-            public void replace(final Collection<UUID> preferenceRecordsToRemove,
-                                final Collection<PreferenceRecord> preferenceRecordsToAdd)
-            {
+            throw new IllegalConfigurationException("BDBPreferenceStore requires path");
+        }
 
-            }
-        };
+        final String storePath = (String)path;
+        return new BDBPreferenceStore(parent, storePath);
     }
 
     @Override

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfig.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfig.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfig.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfig.java Tue Jul 12 17:07:58 2016
@@ -25,9 +25,10 @@ import org.apache.qpid.server.model.Syst
 import org.apache.qpid.server.store.FileBasedSettings;
 import org.apache.qpid.server.store.SizeMonitoringSettings;
 import org.apache.qpid.server.store.preferences.PreferenceStoreAttributes;
+import org.apache.qpid.server.store.preferences.PreferenceStoreProvider;
 
 public interface BDBSystemConfig<X extends BDBSystemConfig<X>> extends SystemConfig<X>, FileBasedSettings,
-                                                                       SizeMonitoringSettings
+                                                                       SizeMonitoringSettings, PreferenceStoreProvider
 {
     @ManagedAttribute(mandatory = true)
     String getStorePath();

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfigImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfigImpl.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfigImpl.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBSystemConfigImpl.java Tue Jul 12 17:07:58 2016
@@ -31,6 +31,7 @@ import org.apache.qpid.server.model.Mana
 import org.apache.qpid.server.model.ManagedObject;
 import org.apache.qpid.server.model.SystemConfigFactoryConstructor;
 import org.apache.qpid.server.store.DurableConfigurationStore;
+import org.apache.qpid.server.store.preferences.PreferenceStore;
 
 @ManagedObject(category = false, type = BDBSystemConfigImpl.SYSTEM_CONFIG_TYPE)
 public class BDBSystemConfigImpl extends AbstractSystemConfig<BDBSystemConfigImpl> implements BDBSystemConfig<BDBSystemConfigImpl>
@@ -77,4 +78,10 @@ public class BDBSystemConfigImpl extends
     {
         return _storeOverfullSize;
     }
+
+    @Override
+    public PreferenceStore getPreferenceStore()
+    {
+        return ((BDBConfigurationStore) getConfigurationStore()).getPreferenceStore();
+    }
 }

Added: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java?rev=1752316&view=auto
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java (added)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/MapBinding.java Tue Jul 12 17:07:58 2016
@@ -0,0 +1,74 @@
+/*
+ * 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.store.berkeleydb.tuple;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.sleepycat.bind.tuple.TupleBinding;
+import com.sleepycat.bind.tuple.TupleInput;
+import com.sleepycat.bind.tuple.TupleOutput;
+
+import org.apache.qpid.server.store.StoreException;
+
+public class MapBinding extends TupleBinding<Map<String, Object>>
+{
+    private static final MapBinding INSTANCE = new MapBinding();
+
+    public static MapBinding getInstance()
+    {
+        return INSTANCE;
+    }
+
+    @Override
+    public Map<String, Object> entryToObject(final TupleInput input)
+    {
+        String json = input.readString();
+        ObjectMapper mapper = new ObjectMapper();
+        try
+        {
+            Map<String, Object> value = mapper.readValue(json, Map.class);
+            return value;
+        }
+        catch (IOException e)
+        {
+            //should never happen
+            throw new StoreException(e);
+        }
+    }
+
+    @Override
+    public void objectToEntry(final Map<String, Object> map, final TupleOutput output)
+    {
+        try
+        {
+            StringWriter writer = new StringWriter();
+            final ObjectMapper objectMapper = new ObjectMapper();
+            objectMapper.writeValue(writer, map);
+            output.writeString(writer.toString());
+        }
+        catch (IOException e)
+        {
+            throw new StoreException(e);
+        }
+    }
+}

Added: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9.java?rev=1752316&view=auto
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9.java (added)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9.java Tue Jul 12 17:07:58 2016
@@ -0,0 +1,93 @@
+/*
+ * 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.store.berkeleydb.upgrade;
+
+import com.sleepycat.bind.tuple.LongBinding;
+import com.sleepycat.bind.tuple.StringBinding;
+import com.sleepycat.je.Database;
+import com.sleepycat.je.DatabaseConfig;
+import com.sleepycat.je.DatabaseEntry;
+import com.sleepycat.je.Environment;
+import com.sleepycat.je.OperationStatus;
+import com.sleepycat.je.Transaction;
+
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.store.StoreException;
+
+@SuppressWarnings("unused")
+public class UpgradeFrom8To9 extends AbstractStoreUpgrade
+{
+
+    private static final String DEFAULT_VERSION = "6.1";
+
+    @Override
+    public void performUpgrade(final Environment environment,
+                               final UpgradeInteractionHandler handler,
+                               final ConfiguredObject<?> parent)
+    {
+        reportStarting(environment, 8);
+
+        DatabaseConfig dbConfig = new DatabaseConfig();
+        dbConfig.setTransactional(true);
+        dbConfig.setAllowCreate(true);
+
+        final Transaction transaction = environment.beginTransaction(null, null);
+        try
+        {
+            Database userPreferencesDb = environment.openDatabase(transaction, "USER_PREFERENCES", dbConfig);
+            userPreferencesDb.close();
+
+            try (Database userPreferencesVersionDb = environment.openDatabase(transaction,
+                                                                              "USER_PREFERENCES_VERSION",
+                                                                              dbConfig))
+            {
+                if (userPreferencesVersionDb.count() == 0L)
+                {
+                    DatabaseEntry key = new DatabaseEntry();
+                    DatabaseEntry value = new DatabaseEntry();
+                    StringBinding.stringToEntry(DEFAULT_VERSION, key);
+                    LongBinding.longToEntry(System.currentTimeMillis(), value);
+                    OperationStatus status = userPreferencesVersionDb.put(transaction, key, value);
+                    if (status != OperationStatus.SUCCESS)
+                    {
+                        throw new StoreException("Error initialising user preference version: " + status);
+                    }
+                }
+            }
+
+            transaction.commit();
+            reportFinished(environment, 9);
+        }
+        catch (RuntimeException e)
+        {
+            try
+            {
+                if (transaction.isValid())
+                {
+                    transaction.abort();
+                }
+            }
+            finally
+            {
+                throw e;
+            }
+        }
+    }
+}

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNode.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNode.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNode.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNode.java Tue Jul 12 17:07:58 2016
@@ -26,9 +26,11 @@ import org.apache.qpid.server.model.Deri
 import org.apache.qpid.server.model.ManagedAttribute;
 import org.apache.qpid.server.store.berkeleydb.HASettings;
 import org.apache.qpid.server.store.berkeleydb.BDBEnvironmentContainer;
+import org.apache.qpid.server.store.preferences.PreferenceStoreProvider;
 
 
-public interface BDBHAVirtualHostNode<X extends BDBHAVirtualHostNode<X>> extends BDBVirtualHostNode<X>, HASettings
+public interface BDBHAVirtualHostNode<X extends BDBHAVirtualHostNode<X>> extends BDBVirtualHostNode<X>, HASettings,
+                                                                                 PreferenceStoreProvider
 {
     public static final String GROUP_NAME = "groupName";
     public static final String ADDRESS = "address";

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java Tue Jul 12 17:07:58 2016
@@ -90,6 +90,7 @@ import org.apache.qpid.server.store.berk
 import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacadeFactory;
 import org.apache.qpid.server.store.berkeleydb.replication.ReplicationGroupListener;
 import org.apache.qpid.server.store.StoreException;
+import org.apache.qpid.server.store.preferences.PreferenceStore;
 import org.apache.qpid.server.store.preferences.PreferenceStoreAttributes;
 import org.apache.qpid.server.store.preferences.ProvidedPreferenceStoreFactoryService;
 import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
@@ -772,6 +773,12 @@ public class BDBHAVirtualHostNodeImpl ex
         }
     }
 
+    @Override
+    public PreferenceStore getPreferenceStore()
+    {
+        return getConfigurationStore().getPreferenceStore();
+    }
+
     private class EnvironmentStateChangeListener implements StateChangeListener
     {
         @Override

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNode.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNode.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNode.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNode.java Tue Jul 12 17:07:58 2016
@@ -21,10 +21,14 @@
 package org.apache.qpid.server.virtualhostnode.berkeleydb;
 
 import org.apache.qpid.server.model.ManagedAttribute;
+import org.apache.qpid.server.model.VirtualHostNode;
+import org.apache.qpid.server.store.FileBasedSettings;
 import org.apache.qpid.server.store.berkeleydb.BDBEnvironmentContainer;
 import org.apache.qpid.server.store.preferences.PreferenceStoreAttributes;
+import org.apache.qpid.server.store.preferences.PreferenceStoreProvider;
 
-public interface BDBVirtualHostNode<X extends BDBVirtualHostNode<X>> extends org.apache.qpid.server.model.VirtualHostNode<X>, org.apache.qpid.server.store.FileBasedSettings, BDBEnvironmentContainer<X>
+public interface BDBVirtualHostNode<X extends BDBVirtualHostNode<X>>
+        extends VirtualHostNode<X>, FileBasedSettings, BDBEnvironmentContainer<X>, PreferenceStoreProvider
 {
     String STORE_PATH = "storePath";
 

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNodeImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNodeImpl.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNodeImpl.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNodeImpl.java Tue Jul 12 17:07:58 2016
@@ -36,6 +36,7 @@ import org.apache.qpid.server.store.berk
 import org.apache.qpid.server.store.berkeleydb.BDBMessageStore;
 import org.apache.qpid.server.store.berkeleydb.EnvironmentFacade;
 import org.apache.qpid.server.store.berkeleydb.BDBCacheSizeSetter;
+import org.apache.qpid.server.store.preferences.PreferenceStore;
 import org.apache.qpid.server.virtualhostnode.AbstractStandardVirtualHostNode;
 
 @ManagedObject(type = BDBVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE, category = false,
@@ -187,4 +188,10 @@ public class BDBVirtualHostNodeImpl exte
         }
         return Collections.emptyMap();
     }
+
+    @Override
+    public PreferenceStore getPreferenceStore()
+    {
+        return ((BDBConfigurationStore) getConfigurationStore()).getPreferenceStore();
+    }
 }

Added: qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreTest.java?rev=1752316&view=auto
==============================================================================
--- qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreTest.java (added)
+++ qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStoreTest.java Tue Jul 12 17:07:58 2016
@@ -0,0 +1,236 @@
+/*
+ * 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.store.berkeleydb;
+
+
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.UUID;
+
+
+import com.sleepycat.bind.tuple.ByteBinding;
+import com.sleepycat.bind.tuple.StringBinding;
+import com.sleepycat.je.Database;
+import com.sleepycat.je.DatabaseConfig;
+import com.sleepycat.je.DatabaseEntry;
+import com.sleepycat.je.Environment;
+import com.sleepycat.je.EnvironmentConfig;
+
+import org.apache.qpid.server.model.BrokerModel;
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.store.berkeleydb.tuple.MapBinding;
+import org.apache.qpid.server.store.berkeleydb.tuple.UUIDTupleBinding;
+import org.apache.qpid.server.store.preferences.PreferenceRecord;
+import org.apache.qpid.server.store.preferences.PreferenceRecordImpl;
+import org.apache.qpid.server.store.preferences.PreferenceStoreUpdater;
+import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.util.FileUtils;
+
+public class BDBPreferenceStoreTest extends QpidTestCase
+{
+    private File _storeFile;
+    private PreferenceStoreUpdater _updater;
+    private BDBPreferenceStore _preferenceStore;
+    private List<PreferenceRecord> _testInitialRecords;
+
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+
+        _storeFile = new File(TMP_FOLDER, getTestName() + System.currentTimeMillis() + ".preferences.bdb");
+        boolean result = _storeFile.mkdirs();
+        assertTrue(String.format("Test folder '%s' was not created", _storeFile.getAbsolutePath()), result);
+        _updater = mock(PreferenceStoreUpdater.class);
+        when(_updater.getLatestVersion()).thenReturn(BrokerModel.MODEL_VERSION);
+
+        final ConfiguredObject<?> parent = mock(ConfiguredObject.class);
+        when(parent.getContext()).thenReturn(Collections.<String, String>emptyMap());
+        when(parent.getContextKeys(anyBoolean())).thenReturn(Collections.<String>emptySet());
+
+        _preferenceStore = new BDBPreferenceStore(parent, _storeFile.getPath());
+
+        _testInitialRecords = Arrays.<PreferenceRecord>asList(
+                new PreferenceRecordImpl(UUID.randomUUID(), Collections.<String, Object>singletonMap("name", "test")),
+                new PreferenceRecordImpl(UUID.randomUUID(), Collections.<String, Object>singletonMap("name", "test1")));
+        populateTestData(_testInitialRecords);
+    }
+
+    @Override
+    public void tearDown() throws Exception
+    {
+        try
+        {
+            _preferenceStore.close();
+            FileUtils.delete(_storeFile, true);
+        }
+        finally
+        {
+            super.tearDown();
+        }
+    }
+
+    public void testOpenAndLoad() throws Exception
+    {
+        Collection<PreferenceRecord> recovered = _preferenceStore.openAndLoad(_updater);
+        assertEquals("Unexpected store state",
+                     AbstractBDBPreferenceStore.StoreState.OPENED,
+                     _preferenceStore.getStoreState());
+        assertNotNull("Store was not properly opened", _preferenceStore.getEnvironmentFacade());
+        assertRecords(_testInitialRecords, recovered);
+    }
+
+    public void testClose() throws Exception
+    {
+        _preferenceStore.openAndLoad(_updater);
+        _preferenceStore.close();
+        assertEquals("Unexpected store state",
+                     AbstractBDBPreferenceStore.StoreState.CLOSED,
+                     _preferenceStore.getStoreState());
+        assertNull("Store was not properly closed", _preferenceStore.getEnvironmentFacade());
+    }
+
+    public void testUpdateOrCreate() throws Exception
+    {
+        _preferenceStore.openAndLoad(_updater);
+
+        PreferenceRecord oldRecord = _testInitialRecords.get(0);
+
+        Collection<PreferenceRecord> records = Arrays.<PreferenceRecord>asList(
+                new PreferenceRecordImpl(oldRecord.getId(), Collections.<String, Object>singletonMap("name", "test2")),
+                new PreferenceRecordImpl(UUID.randomUUID(), Collections.<String, Object>singletonMap("name", "test3")));
+        _preferenceStore.updateOrCreate(records);
+
+        _preferenceStore.close();
+        Collection<PreferenceRecord> recovered = _preferenceStore.openAndLoad(_updater);
+        List<PreferenceRecord> expected = new ArrayList<>(records);
+        expected.add(_testInitialRecords.get(1));
+        assertRecords(expected, recovered);
+    }
+
+    public void testReplace() throws Exception
+    {
+        _preferenceStore.openAndLoad(_updater);
+
+        PreferenceRecord oldRecord1 = _testInitialRecords.get(0);
+        PreferenceRecord oldRecord2 = _testInitialRecords.get(1);
+
+        Collection<UUID> recordsToRemove = Collections.singleton(oldRecord1.getId());
+        Collection<PreferenceRecord> recordsToAddUpdate = Arrays.<PreferenceRecord>asList(
+                new PreferenceRecordImpl(oldRecord2.getId(), Collections.<String, Object>singletonMap("name", "test2")),
+                new PreferenceRecordImpl(UUID.randomUUID(), Collections.<String, Object>singletonMap("name", "test3")));
+        _preferenceStore.replace(recordsToRemove, recordsToAddUpdate);
+
+        _preferenceStore.close();
+        Collection<PreferenceRecord> recovered = _preferenceStore.openAndLoad(_updater);
+        assertRecords(recordsToAddUpdate, recovered);
+    }
+
+    public void testUpdateFailIfNotOpened() throws Exception
+    {
+        try
+        {
+            _preferenceStore.updateOrCreate(Collections.<PreferenceRecord>emptyList());
+            fail("Should not be able to update or create");
+        }
+        catch (IllegalStateException e)
+        {
+            // pass
+        }
+    }
+
+    public void testReplaceFailIfNotOpened() throws Exception
+    {
+        try
+        {
+            _preferenceStore.replace(Collections.<UUID>emptyList(), Collections.<PreferenceRecord>emptyList());
+            fail("Should not be able to replace");
+        }
+        catch (IllegalStateException e)
+        {
+            // pass
+        }
+    }
+
+    private void assertRecords(final Collection<PreferenceRecord> expected, final Collection<PreferenceRecord> actual)
+    {
+        assertEquals("Unexpected number of records", expected.size(), actual.size());
+
+        for (PreferenceRecord expectedRecord : expected)
+        {
+            PreferenceRecord actualRecord = null;
+            for (PreferenceRecord record : actual)
+            {
+                if (record.getId().equals(expectedRecord.getId()))
+                {
+                    actualRecord = record;
+                    break;
+                }
+            }
+            assertNotNull(String.format("No actual record found for expected record '%s'", expectedRecord.getId()),
+                          actualRecord);
+            assertEquals(String.format("Expected attributes are different from actual: %s vs %s",
+                                       expectedRecord.getAttributes().toString(),
+                                       actualRecord.getAttributes().toString()),
+                         new HashMap<>(expectedRecord.getAttributes()),
+                         new HashMap<>(actualRecord.getAttributes()));
+        }
+    }
+
+
+    private void populateTestData(final List<PreferenceRecord> records)
+    {
+        EnvironmentConfig envConfig = new EnvironmentConfig();
+        envConfig.setAllowCreate(true);
+        envConfig.setTransactional(false);
+        try (Environment environment = new Environment(_storeFile, envConfig))
+        {
+            DatabaseConfig dbConfig = new DatabaseConfig();
+            dbConfig.setAllowCreate(true);
+            try (Database versionDb = environment.openDatabase(null, "USER_PREFERENCES_VERSION", dbConfig);
+                 Database preferencesDb = environment.openDatabase(null, "USER_PREFERENCES", dbConfig))
+            {
+                DatabaseEntry key = new DatabaseEntry();
+                DatabaseEntry value = new DatabaseEntry();
+                UUIDTupleBinding keyBinding = UUIDTupleBinding.getInstance();
+                MapBinding valueBinding = MapBinding.getInstance();
+                for (PreferenceRecord record : records)
+                {
+                    keyBinding.objectToEntry(record.getId(), key);
+                    valueBinding.objectToEntry(record.getAttributes(), value);
+                    preferencesDb.put(null, key, value);
+                }
+
+                ByteBinding.byteToEntry((byte) 0, value);
+                StringBinding.stringToEntry(BrokerModel.MODEL_VERSION, key);
+                versionDb.put(null, key, value);
+            }
+        }
+    }
+}

Added: qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9Test.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9Test.java?rev=1752316&view=auto
==============================================================================
--- qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9Test.java (added)
+++ qpid/java/trunk/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom8To9Test.java Tue Jul 12 17:07:58 2016
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.store.berkeleydb.upgrade;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sleepycat.bind.tuple.StringBinding;
+import com.sleepycat.je.Database;
+import com.sleepycat.je.DatabaseEntry;
+import com.sleepycat.je.Transaction;
+
+public class UpgradeFrom8To9Test extends AbstractUpgradeTestCase
+{
+    private static final String PREFERENCES_DB_NAME = "USER_PREFERENCES";
+    private static final String PREFERENCES_VERSION_DB_NAME = "USER_PREFERENCES_VERSION";
+
+    @Override
+    protected String getStoreDirectoryName()
+    {
+        return "bdbstore-v8";
+    }
+
+    public void testPerformUpgrade() throws Exception
+    {
+        UpgradeFrom8To9 upgrade = new UpgradeFrom8To9();
+        upgrade.performUpgrade(_environment, UpgradeInteractionHandler.DEFAULT_HANDLER, getVirtualHost());
+
+        assertDatabaseRecordCount(PREFERENCES_DB_NAME, 0);
+        assertDatabaseRecordCount(PREFERENCES_VERSION_DB_NAME, 1);
+
+        List<String> versions = loadVersions();
+        assertEquals("Unexpected number of versions loaded", 1, versions.size());
+        assertEquals("Unexpected version", "6.1", versions.get(0));
+    }
+
+    private List<String> loadVersions()
+    {
+        final List<String> versions = new ArrayList<>();
+        CursorOperation configuredObjectsCursor = new CursorOperation()
+        {
+            @Override
+            public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction,
+                                     DatabaseEntry key, DatabaseEntry value)
+            {
+                String version = StringBinding.entryToString(key);
+                versions.add(version);
+            }
+        };
+        new DatabaseTemplate(_environment, PREFERENCES_VERSION_DB_NAME, null).run(configuredObjectsCursor);
+        return versions;
+    }
+}

Added: qpid/java/trunk/bdbstore/src/test/resources/upgrade/bdbstore-v8/test-store/00000000.jdb
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/test/resources/upgrade/bdbstore-v8/test-store/00000000.jdb?rev=1752316&view=auto
==============================================================================
Binary files qpid/java/trunk/bdbstore/src/test/resources/upgrade/bdbstore-v8/test-store/00000000.jdb (added) and qpid/java/trunk/bdbstore/src/test/resources/upgrade/bdbstore-v8/test-store/00000000.jdb Tue Jul 12 17:07:58 2016 differ

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java Tue Jul 12 17:07:58 2016
@@ -23,12 +23,11 @@ package org.apache.qpid.server.model;
 import org.apache.qpid.server.configuration.BrokerProperties;
 import org.apache.qpid.server.logging.EventLogger;
 import org.apache.qpid.server.store.DurableConfigurationStore;
-import org.apache.qpid.server.store.preferences.PreferenceStore;
 import org.apache.qpid.server.store.preferences.PreferenceStoreAttributes;
-import org.apache.qpid.server.store.preferences.PreferenceStoreProvider;
+import org.apache.qpid.server.store.preferences.PreferencesRoot;
 
 @ManagedObject (creatable = false)
-public interface SystemConfig<X extends SystemConfig<X>> extends ConfiguredObject<X>, ModelRoot, PreferenceStoreProvider
+public interface SystemConfig<X extends SystemConfig<X>> extends ConfiguredObject<X>, ModelRoot, PreferencesRoot
 {
     String MANAGEMENT_MODE = "managementMode";
     

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostNode.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostNode.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostNode.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostNode.java Tue Jul 12 17:07:58 2016
@@ -23,12 +23,11 @@ package org.apache.qpid.server.model;
 import java.util.Collection;
 
 import org.apache.qpid.server.store.DurableConfigurationStore;
-import org.apache.qpid.server.store.preferences.PreferenceStore;
 import org.apache.qpid.server.store.preferences.PreferenceStoreAttributes;
-import org.apache.qpid.server.store.preferences.PreferenceStoreProvider;
+import org.apache.qpid.server.store.preferences.PreferencesRoot;
 
 @ManagedObject(category=true, managesChildren=true)
-public interface VirtualHostNode<X extends VirtualHostNode<X>> extends ConfiguredObject<X>, PreferenceStoreProvider
+public interface VirtualHostNode<X extends VirtualHostNode<X>> extends ConfiguredObject<X>, PreferencesRoot
 {
     String QPID_INITIAL_CONFIG_VIRTUALHOST_CONFIG_VAR = "qpid.initial_config_virtualhost_config";
     @ManagedContextDefault(name = QPID_INITIAL_CONFIG_VIRTUALHOST_CONFIG_VAR)

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java Tue Jul 12 17:07:58 2016
@@ -70,7 +70,7 @@ import org.apache.qpid.server.security.S
 import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.store.preferences.PreferenceRecord;
 import org.apache.qpid.server.store.preferences.PreferenceStore;
-import org.apache.qpid.server.store.preferences.PreferenceStoreProvider;
+import org.apache.qpid.server.store.preferences.PreferencesRoot;
 import org.apache.qpid.server.store.preferences.PreferenceStoreUpdaterImpl;
 import org.apache.qpid.server.store.preferences.PreferencesRecoverer;
 import org.apache.qpid.server.util.HousekeepingExecutor;
@@ -668,8 +668,8 @@ public class BrokerAdapter extends Abstr
     {
         super.onOpen();
 
-        PreferenceStoreProvider preferenceStoreProvider = getParent(SystemConfig.class);
-        _preferenceStore = preferenceStoreProvider.createPreferenceStore();
+        PreferencesRoot preferencesRoot = getParent(SystemConfig.class);
+        _preferenceStore = preferencesRoot.createPreferenceStore();
 
         getEventLogger().message(BrokerMessages.STARTUP(CommonProperties.getReleaseVersion(),
                                                         CommonProperties.getBuildVersion()));

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceStoreProvider.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceStoreProvider.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceStoreProvider.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceStoreProvider.java Tue Jul 12 17:07:58 2016
@@ -21,5 +21,5 @@ package org.apache.qpid.server.store.pre
 
 public interface PreferenceStoreProvider
 {
-    PreferenceStore createPreferenceStore();
+    PreferenceStore getPreferenceStore();
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRecoverer.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRecoverer.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRecoverer.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRecoverer.java Tue Jul 12 17:07:58 2016
@@ -32,7 +32,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.qpid.server.model.ConfiguredObject;
-import org.apache.qpid.server.model.Model;
 import org.apache.qpid.server.model.preferences.Preference;
 import org.apache.qpid.server.model.preferences.PreferenceFactory;
 import org.apache.qpid.server.model.preferences.UserPreferencesImpl;
@@ -114,7 +113,7 @@ public class PreferencesRecoverer
         }
         associatedObject.setUserPreferences(new UserPreferencesImpl(preferenceStore, recoveredPreferences));
 
-        if (!(associatedObject instanceof PreferenceStoreProvider))
+        if (!(associatedObject instanceof PreferencesRoot))
         {
             Collection<Class<? extends ConfiguredObject>> childrenCategories =
                     associatedObject.getModel().getChildTypes(associatedObject.getCategoryClass());

Copied: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRoot.java (from r1752293, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceStoreProvider.java)
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRoot.java?p2=qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRoot.java&p1=qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceStoreProvider.java&r1=1752293&r2=1752316&rev=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceStoreProvider.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferencesRoot.java Tue Jul 12 17:07:58 2016
@@ -19,7 +19,7 @@
 
 package org.apache.qpid.server.store.preferences;
 
-public interface PreferenceStoreProvider
+public interface PreferencesRoot
 {
     PreferenceStore createPreferenceStore();
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/ProvidedPreferenceStoreFactoryService.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/ProvidedPreferenceStoreFactoryService.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/ProvidedPreferenceStoreFactoryService.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/ProvidedPreferenceStoreFactoryService.java Tue Jul 12 17:07:58 2016
@@ -19,11 +19,9 @@
 
 package org.apache.qpid.server.store.preferences;
 
-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.ConfiguredObject;
 import org.apache.qpid.server.plugin.PluggableService;
 
@@ -38,34 +36,13 @@ public class ProvidedPreferenceStoreFact
     public PreferenceStore createInstance(final ConfiguredObject<?> parent,
                                           final Map<String, Object> preferenceStoreAttributes)
     {
-        // TODO: Implement real ProvidedPreferenceStore
-        return new PreferenceStore()
+        if (!(parent instanceof PreferenceStoreProvider))
         {
-            @Override
-            public Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater)
-            {
-                return Collections.emptyList();
-            }
-
-            @Override
-            public void close()
-            {
-
-            }
-
-            @Override
-            public void updateOrCreate(final Collection<PreferenceRecord> preferenceRecords)
-            {
-
-            }
-
-            @Override
-            public void replace(final Collection<UUID> preferenceRecordsToRemove,
-                                final Collection<PreferenceRecord> preferenceRecordsToAdd)
-            {
+            throw new IllegalConfigurationException(
+                    "Cannot create provided preference store on non PreferenceStoreProvider");
+        }
 
-            }
-        };
+        return ((PreferenceStoreProvider) parent).getPreferenceStore();
     }
 
     @Override

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java Tue Jul 12 17:07:58 2016
@@ -97,7 +97,7 @@ import org.apache.qpid.server.store.Stor
 import org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler;
 import org.apache.qpid.server.store.preferences.PreferenceRecord;
 import org.apache.qpid.server.store.preferences.PreferenceStore;
-import org.apache.qpid.server.store.preferences.PreferenceStoreProvider;
+import org.apache.qpid.server.store.preferences.PreferencesRoot;
 import org.apache.qpid.server.store.preferences.PreferenceStoreUpdater;
 import org.apache.qpid.server.store.preferences.PreferenceStoreUpdaterImpl;
 import org.apache.qpid.server.store.preferences.PreferencesRecoverer;
@@ -576,8 +576,8 @@ public abstract class AbstractVirtualHos
 
         }
 
-        PreferenceStoreProvider preferenceStoreProvider = getParent(VirtualHostNode.class);
-        _preferenceStore = preferenceStoreProvider.createPreferenceStore();
+        PreferencesRoot preferencesRoot = getParent(VirtualHostNode.class);
+        _preferenceStore = preferencesRoot.createPreferenceStore();
     }
 
     private void checkVHostStateIsActive()
@@ -1660,6 +1660,7 @@ public abstract class AbstractVirtualHos
                 shutdownHouseKeeping();
                 closeNetworkConnectionScheduler();
                 closeMessageStore();
+                _preferenceStore.close();
                 setState(State.STOPPED);
 
                 stopLogging(loggers);

Modified: qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfig.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfig.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfig.java (original)
+++ qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbySystemConfig.java Tue Jul 12 17:07:58 2016
@@ -39,6 +39,6 @@ public interface DerbySystemConfig<X ext
     Long getStoreOverfullSize();
 
     @ManagedAttribute( description = "Configuration for the preference store, e.g. type, path, etc.",
-            defaultValue = "{\"type\": \"Provided\"}")
+            defaultValue = "{\"type\": \"Noop\"}")
     PreferenceStoreAttributes getPreferenceStoreAttributes();
 }

Modified: qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java (original)
+++ qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/virtualhostnode/derby/DerbyVirtualHostNode.java Tue Jul 12 17:07:58 2016
@@ -29,8 +29,4 @@ public interface DerbyVirtualHostNode<X
 
     @ManagedAttribute(mandatory = true, defaultValue = "${qpid.work_dir}${file.separator}${this:name}${file.separator}config")
     String getStorePath();
-
-    @ManagedAttribute( description = "Configuration for the preference store, e.g. type, path, etc.",
-            defaultValue = "{\"type\": \"Provided\"}")
-    PreferenceStoreAttributes getPreferenceStoreAttributes();
 }

Modified: qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCSystemConfig.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCSystemConfig.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCSystemConfig.java (original)
+++ qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCSystemConfig.java Tue Jul 12 17:07:58 2016
@@ -39,6 +39,6 @@ public interface JDBCSystemConfig<X exte
     String getPassword();
 
     @ManagedAttribute( description = "Configuration for the preference store, e.g. type, path, etc.",
-            defaultValue = "{\"type\": \"Provided\"}")
+            defaultValue = "{\"type\": \"Noop\"}")
     PreferenceStoreAttributes getPreferenceStoreAttributes();
 }

Modified: qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java?rev=1752316&r1=1752315&r2=1752316&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java (original)
+++ qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java Tue Jul 12 17:07:58 2016
@@ -41,7 +41,4 @@ public interface JDBCVirtualHostNode<X e
     @ManagedAttribute(secure=true)
     String getPassword();
 
-    @ManagedAttribute( description = "Configuration for the preference store, e.g. type, path, etc.",
-            defaultValue = "{\"type\": \"Provided\"}")
-    PreferenceStoreAttributes getPreferenceStoreAttributes();
 }



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


Mime
View raw message