summaryrefslogtreecommitdiff
path: root/qpid/java/bdbstore/src
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2014-03-17 17:04:05 +0000
committerKeith Wall <kwall@apache.org>2014-03-17 17:04:05 +0000
commit8ad99bd6b07efe9f91ed9cde2b2121028005c317 (patch)
tree8a9b33c0294fe1745b617ca1399fccd654de1759 /qpid/java/bdbstore/src
parentec486999608568e37a55dc9c81d9be133d95ebc3 (diff)
downloadqpid-python-8ad99bd6b07efe9f91ed9cde2b2121028005c317.tar.gz
QPID-5624: Introduce configurationStoreSettings VH attributes
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/java-broker-bdb-ha2@1578463 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/bdbstore/src')
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java11
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java29
2 files changed, 24 insertions, 16 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
index e2b30f6740..ef749f2472 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
@@ -54,7 +54,7 @@ public class BDBMessageStoreFactory implements MessageStoreFactory, DurableConfi
{
@SuppressWarnings("unchecked")
Map<String, Object> messageStoreSettings = (Map<String, Object>) attributes.get(VirtualHost.MESSAGE_STORE_SETTINGS);
- if(getType().equals(messageStoreSettings.get(MessageStore.STORE_TYPE)))
+ if(messageStoreSettings != null && getType().equals(messageStoreSettings.get(MessageStore.STORE_TYPE)))
{
Object storePath = messageStoreSettings.get(MessageStore.STORE_PATH);
if(!(storePath instanceof String))
@@ -64,12 +64,15 @@ public class BDBMessageStoreFactory implements MessageStoreFactory, DurableConfi
}
}
- if(getType().equals(attributes.get(VirtualHost.CONFIG_STORE_TYPE)))
+
+ @SuppressWarnings("unchecked")
+ Map<String, Object> configurationStoreSettings = (Map<String, Object>) attributes.get(VirtualHost.CONFIGURATION_STORE_SETTINGS);
+ if(configurationStoreSettings != null && getType().equals(configurationStoreSettings.get(DurableConfigurationStore.STORE_TYPE)))
{
- Object storePath = attributes.get(VirtualHost.CONFIG_STORE_PATH);
+ Object storePath = configurationStoreSettings.get(DurableConfigurationStore.STORE_PATH);
if(!(storePath instanceof String))
{
- throw new IllegalArgumentException("Attribute '"+ VirtualHost.CONFIG_STORE_PATH
+ throw new IllegalArgumentException("Setting '"+ DurableConfigurationStore.STORE_PATH
+"' is required and must be of type String.");
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java
index 7fdae6b3ee..75e14a70c7 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java
@@ -26,6 +26,7 @@ import java.util.Map;
import org.apache.qpid.server.configuration.BrokerProperties;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.store.DurableConfigurationStore;
import org.apache.qpid.server.store.MessageStore;
public class StandardEnvironmentFacadeFactory implements EnvironmentFacadeFactory
@@ -40,30 +41,34 @@ public class StandardEnvironmentFacadeFactory implements EnvironmentFacadeFactor
Map<String, String> envConfigMap = new HashMap<String, String>();
envConfigMap.putAll(EnvironmentFacade.ENVCONFIG_DEFAULTS);
- Object environmentConfigurationAttributes = messageStoreSettings.get(ENVIRONMENT_CONFIGURATION);
- if (environmentConfigurationAttributes instanceof Map)
- {
- envConfigMap.putAll((Map<String, String>) environmentConfigurationAttributes);
- }
-
final String defaultPath = System.getProperty(BrokerProperties.PROPERTY_QPID_WORK) + File.separator + "bdbstore" + File.separator + name;
String storeLocation;
if(isMessageStore)
{
- storeLocation = (String) messageStoreSettings.get(MessageStore.STORE_PATH);
- if(storeLocation == null)
+ Object environmentConfigurationAttributes = messageStoreSettings.get(ENVIRONMENT_CONFIGURATION);
+ if (environmentConfigurationAttributes instanceof Map)
{
- storeLocation = defaultPath;
+ envConfigMap.putAll((Map<String, String>) environmentConfigurationAttributes);
}
+
+ storeLocation = (String) messageStoreSettings.get(MessageStore.STORE_PATH);
}
else // we are acting only as the durable config store
{
- storeLocation = (String) virtualHost.getAttribute(VirtualHost.CONFIG_STORE_PATH);
- if(storeLocation == null)
+ Map<String, Object> configurationStoreSettings = virtualHost.getConfigurationStoreSettings();
+
+ Object environmentConfigurationAttributes = configurationStoreSettings.get(ENVIRONMENT_CONFIGURATION);
+ if (environmentConfigurationAttributes instanceof Map)
{
- storeLocation = defaultPath;
+ envConfigMap.putAll((Map<String, String>) environmentConfigurationAttributes);
}
+
+ storeLocation = (String) configurationStoreSettings.get(DurableConfigurationStore.STORE_PATH);
+ }
+ if(storeLocation == null)
+ {
+ storeLocation = defaultPath;
}
return new StandardEnvironmentFacade(storeLocation, envConfigMap);