qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1608311 - in /qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server: configuration/ConfigurationEntryStore.java store/JsonFileConfigStore.java
Date Sun, 06 Jul 2014 23:10:05 GMT
Author: rgodfrey
Date: Sun Jul  6 23:10:04 2014
New Revision: 1608311

URL: http://svn.apache.org/r1608311
Log:
QPID-5879 : [Java Broker] JsonConfigStore should take deep copy of ConfiguredObjectRecord
objects

Modified:
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java?rev=1608311&r1=1608310&r2=1608311&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java
(original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/ConfigurationEntryStore.java
Sun Jul  6 23:10:04 2014
@@ -26,14 +26,6 @@ public interface ConfigurationEntryStore
 {
 
     /**
-     * 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

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java?rev=1608311&r1=1608310&r2=1608311&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
(original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
Sun Jul  6 23:10:04 2014
@@ -356,7 +356,7 @@ public class JsonFileConfigStore impleme
         }
         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 impleme
         }
         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 impleme
         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 impleme
 
     }
 
+    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;
+    }
+
 
 }



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


Mime
View raw message