diff options
Diffstat (limited to 'qpid/java/broker-plugins')
2 files changed, 24 insertions, 30 deletions
diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java index 31089356a8..85960cd25b 100644 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java +++ b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java @@ -47,7 +47,6 @@ public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore private final ProvidedMessageStore _providedMessageStore = new ProvidedMessageStore(); private String _connectionURL; - private String _storeLocation; private ConfiguredObject<?> _parent; private final Class<? extends ConfiguredObject> _rootClass; @@ -68,9 +67,7 @@ public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore _parent = parent; DerbyUtils.loadDerbyDriver(); - final FileBasedSettings settings = (FileBasedSettings)parent; - _storeLocation = settings.getStorePath(); - _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), _storeLocation); + _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), ((FileBasedSettings)_parent).getStorePath()); createOrOpenConfigurationStoreDatabase(overwrite); @@ -148,24 +145,25 @@ public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore throw new IllegalStateException("Cannot delete the store as the provided message store is still open"); } - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Deleting store " + _storeLocation); - } - - FileBasedSettings fileBasedSettings = (FileBasedSettings)parent; + FileBasedSettings fileBasedSettings = (FileBasedSettings) parent; String storePath = fileBasedSettings.getStorePath(); - if (storePath != null) + if (!DerbyUtils.MEMORY_STORE_LOCATION.equals(storePath)) { - File configFile = new File(storePath); - if (!FileUtils.delete(configFile, true)) + if (storePath != null) { - LOGGER.info("Failed to delete the store at location " + storePath); + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Deleting store " + storePath); + } + + File configFile = new File(storePath); + if (!FileUtils.delete(configFile, true)) + { + LOGGER.info("Failed to delete the store at location " + storePath); + } } } - - _storeLocation = null; } @Override @@ -219,7 +217,7 @@ public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore @Override public String getStoreLocation() { - return DerbyConfigurationStore.this._storeLocation; + return ((FileBasedSettings)_parent).getStorePath(); } @Override diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java index 9c6baa52ba..8ba5af9130 100644 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java +++ b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java @@ -41,15 +41,13 @@ public class DerbyMessageStore extends AbstractDerbyMessageStore private static final Logger LOGGER = Logger.getLogger(DerbyMessageStore.class); private String _connectionURL; - private String _storeLocation; + private ConfiguredObject<?> _parent; @Override protected void doOpen(final ConfiguredObject<?> parent) { - final FileBasedSettings settings = (FileBasedSettings)parent; - _storeLocation = settings.getStorePath(); - - _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), _storeLocation); + _parent = parent; + _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), ((FileBasedSettings)_parent).getStorePath()); } @Override @@ -80,24 +78,22 @@ public class DerbyMessageStore extends AbstractDerbyMessageStore throw new IllegalStateException("Cannot delete the store as the provided message store is still open"); } - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Deleting store " + _storeLocation); - } - FileBasedSettings fileBasedSettings = (FileBasedSettings)parent; String storePath = fileBasedSettings.getStorePath(); if (storePath != null) { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Deleting store " + storePath); + } + File configFile = new File(storePath); if (!FileUtils.delete(configFile, true)) { LOGGER.info("Failed to delete the store at location " + storePath); } } - - _storeLocation = null; } @Override @@ -110,7 +106,7 @@ public class DerbyMessageStore extends AbstractDerbyMessageStore @Override public String getStoreLocation() { - return _storeLocation; + return ((FileBasedSettings)_parent).getStorePath(); } |
