Remove CompositeModification field in ShardWriteTransaction
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardWriteTransaction.java
index 365f97dd3f8f7797ceb953f2b9b71606b4ba099b..e1b342a982c89b42955d95ac1007b4486813e810 100644 (file)
@@ -1,11 +1,10 @@
 /*
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *  Copyright (c) 2015 Brocade Communications 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
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2015 Brocade Communications 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.cluster.datastore;
@@ -25,12 +24,7 @@ import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.WriteData;
 import org.opendaylight.controller.cluster.datastore.messages.WriteDataReply;
-import org.opendaylight.controller.cluster.datastore.modification.CompositeModification;
-import org.opendaylight.controller.cluster.datastore.modification.DeleteModification;
-import org.opendaylight.controller.cluster.datastore.modification.MergeModification;
 import org.opendaylight.controller.cluster.datastore.modification.Modification;
-import org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification;
-import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
 
 /**
  * @author: syedbahm
@@ -38,7 +32,6 @@ import org.opendaylight.controller.cluster.datastore.modification.WriteModificat
  */
 public class ShardWriteTransaction extends ShardTransaction {
 
-    private final MutableCompositeModification compositeModification = new MutableCompositeModification();
     private int totalBatchedModificationsReceived;
     private Exception lastBatchedModificationsException;
     private final ReadWriteShardDataTreeTransaction transaction;
@@ -71,10 +64,6 @@ public class ShardWriteTransaction extends ShardTransaction {
 
         } else if(DeleteData.isSerializedType(message)) {
             deleteData(DeleteData.fromSerializable(message), SERIALIZED_REPLY);
-
-        } else if (message instanceof GetCompositedModification) {
-            // This is here for testing only
-            getSender().tell(new GetCompositeModificationReply(compositeModification), getSelf());
         } else {
             super.handleReceive(message);
         }
@@ -90,7 +79,6 @@ public class ShardWriteTransaction extends ShardTransaction {
 
         try {
             for(Modification modification: batched.getModifications()) {
-                compositeModification.addModification(modification);
                 modification.apply(transaction.getSnapshot());
             }
 
@@ -143,8 +131,6 @@ public class ShardWriteTransaction extends ShardTransaction {
             return;
         }
 
-        compositeModification.addModification(
-                new WriteModification(message.getPath(), message.getData()));
         try {
             transaction.getSnapshot().write(message.getPath(), message.getData());
             WriteDataReply writeDataReply = WriteDataReply.INSTANCE;
@@ -161,9 +147,6 @@ public class ShardWriteTransaction extends ShardTransaction {
             return;
         }
 
-        compositeModification.addModification(
-                new MergeModification(message.getPath(), message.getData()));
-
         try {
             transaction.getSnapshot().merge(message.getPath(), message.getData());
             MergeDataReply mergeDataReply = MergeDataReply.INSTANCE;
@@ -180,7 +163,6 @@ public class ShardWriteTransaction extends ShardTransaction {
             return;
         }
 
-        compositeModification.addModification(new DeleteModification(message.getPath()));
         try {
             transaction.getSnapshot().delete(message.getPath());
             DeleteDataReply deleteDataReply = DeleteDataReply.INSTANCE;
@@ -199,27 +181,9 @@ public class ShardWriteTransaction extends ShardTransaction {
         ShardDataTreeCohort cohort =  transaction.ready();
 
         getShardActor().forward(new ForwardedReadyTransaction(transactionID, getClientTxVersion(),
-                cohort, compositeModification, returnSerialized, doImmediateCommit), getContext());
+                cohort, returnSerialized, doImmediateCommit), getContext());
 
         // The shard will handle the commit from here so we're no longer needed - self-destruct.
         getSelf().tell(PoisonPill.getInstance(), getSelf());
     }
-
-    // These classes are in here for test purposes only
-
-    static class GetCompositedModification {
-    }
-
-    static class GetCompositeModificationReply {
-        private final CompositeModification modification;
-
-
-        GetCompositeModificationReply(CompositeModification modification) {
-            this.modification = modification;
-        }
-
-        public CompositeModification getModification() {
-            return modification;
-        }
-    }
 }