summaryrefslogtreecommitdiff
path: root/java/broker-core/src
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2014-07-06 23:10:04 +0000
committerRobert Godfrey <rgodfrey@apache.org>2014-07-06 23:10:04 +0000
commita583dadecf9ce473fc778d5870a299a5a1261449 (patch)
tree6969f772e4d0b0c09858099f437f3df5df7b6560 /java/broker-core/src
parent33c44bd0d25c4fb082a48820e5b2ced20e29c0b2 (diff)
downloadqpid-python-a583dadecf9ce473fc778d5870a299a5a1261449.tar.gz
QPID-5879 : [Java Broker] JsonConfigStore should take deep copy of ConfiguredObjectRecord objects
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1608311 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker-core/src')
-rw-r--r--java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java8
-rw-r--r--java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java22
2 files changed, 21 insertions, 9 deletions
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java b/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java
index 11e92fcff9..d5f7b3a317 100644
--- a/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java
+++ b/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java
@@ -26,14 +26,6 @@ public interface ConfigurationEntryStore extends DurableConfigurationStore
{
/**
- * Copies the store into the given location
- *
- * @param target location to copy store into
- * @throws IllegalConfigurationException if store cannot be copied into given location
- */
- void copyTo(String copyLocation);
-
- /**
* Return the store location for the opened store or null if store has not been opened.
*
* @return store location for the opened store or null if store has not been opened
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java b/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
index d733c351c4..7a0f57bd33 100644
--- a/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
+++ b/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
@@ -356,7 +356,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
else
{
-
+ record = new ConfiguredObjectRecordImpl(record);
_objectsById.put(record.getId(), record);
List<UUID> idsForType = _idsByType.get(record.getType());
if(idsForType == null)
@@ -537,6 +537,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
for(ConfiguredObjectRecord record : records)
{
+ record = new ConfiguredObjectRecordImpl(record);
final UUID id = record.getId();
final String type = record.getType();
if(_objectsById.put(id, record) == null)
@@ -623,6 +624,11 @@ public class JsonFileConfigStore implements DurableConfigurationStore
private final Map<String, Object> _attributes;
private final Map<String, UUID> _parents;
+ private ConfiguredObjectRecordImpl(ConfiguredObjectRecord record)
+ {
+ this(record.getId(), record.getType(), record.getAttributes(), convertParents(record.getParents()));
+ }
+
private ConfiguredObjectRecordImpl(final UUID id, final String type, final Map<String, Object> attributes,
final Map<String, UUID> parents)
{
@@ -678,5 +684,19 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
+ private static Map<String, UUID> convertParents(final Map<String, ConfiguredObjectRecord> parents)
+ {
+ if(parents == null || parents.isEmpty())
+ {
+ return Collections.emptyMap();
+ }
+ Map<String,UUID> parentMap = new HashMap<>();
+ for(Map.Entry<String,ConfiguredObjectRecord> entry : parents.entrySet())
+ {
+ parentMap.put(entry.getKey(), entry.getValue().getId());
+ }
+ return parentMap;
+ }
+
}