Merge "Fix for Bug 2290."
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / ReadyTransactionReply.java
index 48565d4fbb5b8847b1c90beea6ce7ca964b00256..282e23ed3bab4458ef771b338d6bf03861536662 100644 (file)
@@ -8,17 +8,33 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import akka.actor.ActorPath;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
 
-public class ReadyTransactionReply {
-  private final ActorPath path;
+public class ReadyTransactionReply implements SerializableMessage {
+    public static final Class<ShardTransactionMessages.ReadyTransactionReply> SERIALIZABLE_CLASS =
+            ShardTransactionMessages.ReadyTransactionReply.class;
 
-  public ReadyTransactionReply(ActorPath path) {
+    private final String cohortPath;
 
-    this.path = path;
-  }
+    public ReadyTransactionReply(String cohortPath) {
+        this.cohortPath = cohortPath;
+    }
 
-  public ActorPath getPath() {
-    return path;
-  }
+    public String getCohortPath() {
+        return cohortPath;
+    }
+
+    @Override
+    public ShardTransactionMessages.ReadyTransactionReply toSerializable() {
+        return ShardTransactionMessages.ReadyTransactionReply.newBuilder()
+                .setActorPath(cohortPath)
+                .build();
+    }
+
+    public static ReadyTransactionReply fromSerializable(Object serializable) {
+        ShardTransactionMessages.ReadyTransactionReply o =
+                (ShardTransactionMessages.ReadyTransactionReply) serializable;
+
+        return new ReadyTransactionReply(o.getActorPath());
+    }
 }