X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fmessages%2FCreateTransactionReply.java;h=c2bf81fa8e75fd0b5da2a700d37ab142e4815042;hb=3104f91c7d1b3ee5914d8778f87315f4ac64036d;hp=81fd6eeabf49e62e2ad5f53ee4dadd8dc4bc4068;hpb=f1c47fb514878ef2149e5f22d6098ff8c79dec1d;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java index 81fd6eeabf..c2bf81fa8e 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java @@ -8,30 +8,60 @@ package org.opendaylight.controller.cluster.datastore.messages; -import akka.actor.ActorPath; +import org.opendaylight.controller.cluster.datastore.DataStoreVersions; +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; -/** - * This is being deprecated to use sal-protocolbuff-encoding ShardTransactionMessages.CreateTransactionReply - * This classes will be removed once complete integration of distribute datastore with - * sal-protocolbuff-encoding is done. - */ +public class CreateTransactionReply implements SerializableMessage { -@Deprecated -public class CreateTransactionReply { - private final ActorPath transactionPath; + public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransactionReply.class; + private final String transactionPath; private final String transactionId; + private final short version; + + public CreateTransactionReply(String transactionPath, String transactionId) { + this(transactionPath, transactionId, DataStoreVersions.CURRENT_VERSION); + } - public CreateTransactionReply(ActorPath transactionPath, - String transactionId) { + public CreateTransactionReply(final String transactionPath, + final String transactionId, final short version) { this.transactionPath = transactionPath; this.transactionId = transactionId; + this.version = version; } - public ActorPath getTransactionPath() { + + public String getTransactionPath() { return transactionPath; } public String getTransactionId() { return transactionId; } + + public short getVersion() { + return version; + } + + @Override + public Object toSerializable(){ + return ShardTransactionMessages.CreateTransactionReply.newBuilder() + .setTransactionActorPath(transactionPath) + .setTransactionId(transactionId) + .setMessageVersion(version) + .build(); + } + + public static CreateTransactionReply fromSerializable(Object serializable){ + ShardTransactionMessages.CreateTransactionReply o = (ShardTransactionMessages.CreateTransactionReply) serializable; + return new CreateTransactionReply(o.getTransactionActorPath(), o.getTransactionId(), + (short)o.getMessageVersion()); + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("CreateTransactionReply [transactionPath=").append(transactionPath).append(", transactionId=") + .append(transactionId).append(", version=").append(version).append("]"); + return builder.toString(); + } }