import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply;
+import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.ForwardedCommitTransaction;
import org.opendaylight.controller.cluster.datastore.messages.NonPersistent;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply;
import java.util.HashMap;
import java.util.Map;
ActorRef transactionActor = getContext().actorOf(
ShardTransaction.props(transaction, getSelf()), "shard-" + createTransaction.getTransactionId());
getSender()
- .tell(CreateTransactionReply.newBuilder()
- .setTransactionActorPath(transactionActor.path().toString())
- .setTransactionId(createTransaction.getTransactionId())
- .build(),
+ .tell(new CreateTransactionReply(transactionActor.path().toString(), createTransaction.getTransactionId()).toSerializable(),
getSelf());
}
public class CreateTransactionChain {
+
}
package org.opendaylight.controller.cluster.datastore.messages;
-import akka.actor.ActorPath;
+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;
- public CreateTransactionReply(ActorPath transactionPath,
+ public CreateTransactionReply(String transactionPath,
String transactionId) {
this.transactionPath = transactionPath;
this.transactionId = transactionId;
}
- public ActorPath getTransactionPath() {
+ public String getTransactionPath() {
return transactionPath;
}
public String getTransactionId() {
return transactionId;
}
+
+ public Object toSerializable(){
+ return ShardTransactionMessages.CreateTransactionReply.newBuilder()
+ .setTransactionActorPath(transactionPath.toString())
+ .setTransactionId(transactionId)
+ .build();
+ }
+
+ public static CreateTransactionReply fromSerializable(Object serializable){
+ ShardTransactionMessages.CreateTransactionReply o = (ShardTransactionMessages.CreateTransactionReply) serializable;
+ return new CreateTransactionReply(o.getTransactionActorPath(), o.getTransactionId());
+ }
+
}
--- /dev/null
+/*
+ * 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.cluster.datastore.messages;
+
+public interface SerializableMessage {
+ Object toSerializable();
+}
import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply;
-import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransaction;
import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction;
final ActorSelection transaction =
new ExpectMsg<ActorSelection>("CreateTransactionReply") {
protected ActorSelection match(Object in) {
- if (in instanceof CreateTransactionReply) {
+ if (CreateTransactionReply.SERIALIZABLE_CLASS.equals(in.getClass())) {
+ CreateTransactionReply reply = CreateTransactionReply.fromSerializable(in);
return getSystem()
- .actorSelection((((CreateTransactionReply) in)
- .getTransactionActorPath()));
+ .actorSelection(reply
+ .getTransactionPath());
} else {
throw noMatch();
}
+
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorRef;