Make sure transaction applies whole removal list
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / impl / HashMapDataStore.xtend
index e7445e6965582c90a9401279d37aab18f704f17e..9600881e505abdeb8c4d5022d4f1c91c94907e80 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.controller.sal.dom.broker.impl
 
 import org.opendaylight.controller.md.sal.common.api.data.DataModification
@@ -9,23 +16,41 @@ import org.opendaylight.controller.sal.common.util.Rpcs
 import java.util.Collections
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
 import org.opendaylight.yangtools.yang.data.api.CompositeNode
-import static extension org.opendaylight.controller.sal.dom.broker.impl.DataUtils.*;
 import org.opendaylight.controller.sal.core.api.data.DataStore
 import java.util.HashSet
 
 class HashMapDataStore implements DataStore, AutoCloseable {
 
+
     val Map<InstanceIdentifier, CompositeNode> configuration = new ConcurrentHashMap();
     val Map<InstanceIdentifier, CompositeNode> operational = new ConcurrentHashMap();
+    
+    
+    
+    override containsConfigurationPath(InstanceIdentifier path) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+        
+    }
+    
+    override containsOperationalPath(InstanceIdentifier path) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+    override getStoredConfigurationPaths() {
+        configuration.keySet
+    }
+    
+    override getStoredOperationalPaths() {
+        operational.keySet
+    }
 
     override readConfigurationData(InstanceIdentifier path) {
-        configuration.read(path);
+        configuration.get(path);
     }
 
     override readOperationalData(InstanceIdentifier path) {
-        operational.read(path);
+        operational.get(path);
     }
-    
 
 
 
@@ -39,15 +64,15 @@ class HashMapDataStore implements DataStore, AutoCloseable {
 
     def RpcResult<Void> finish(HashMapDataStoreTransaction transaction) {
         val modification = transaction.modification;
-        configuration.putAll(modification.updatedConfigurationData);
-        operational.putAll(modification.updatedOperationalData);
-
         for (removal : modification.removedConfigurationData) {
             remove(configuration,removal);
         }
         for (removal : modification.removedOperationalData) {
             remove(operational,removal);
         }
+        configuration.putAll(modification.updatedConfigurationData);
+        operational.putAll(modification.updatedOperationalData);
+
         return Rpcs.getRpcResult(true, null, Collections.emptySet);
     }