2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.datastore.messages;
11 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
12 import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
14 public class CreateTransactionReply implements SerializableMessage {
16 public static final Class<?> SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransactionReply.class;
17 private final String transactionPath;
18 private final String transactionId;
19 private final short version;
21 public CreateTransactionReply(String transactionPath, String transactionId) {
22 this(transactionPath, transactionId, DataStoreVersions.CURRENT_VERSION);
25 public CreateTransactionReply(final String transactionPath,
26 final String transactionId, final short version) {
27 this.transactionPath = transactionPath;
28 this.transactionId = transactionId;
29 this.version = version;
33 public String getTransactionPath() {
34 return transactionPath;
37 public String getTransactionId() {
41 public short getVersion() {
46 public Object toSerializable(){
47 return ShardTransactionMessages.CreateTransactionReply.newBuilder()
48 .setTransactionActorPath(transactionPath)
49 .setTransactionId(transactionId)
50 .setMessageVersion(version)
54 public static CreateTransactionReply fromSerializable(Object serializable){
55 ShardTransactionMessages.CreateTransactionReply o = (ShardTransactionMessages.CreateTransactionReply) serializable;
56 return new CreateTransactionReply(o.getTransactionActorPath(), o.getTransactionId(),
57 (short)o.getMessageVersion());
61 public String toString() {
62 StringBuilder builder = new StringBuilder();
63 builder.append("CreateTransactionReply [transactionPath=").append(transactionPath).append(", transactionId=")
64 .append(transactionId).append(", version=").append(version).append("]");
65 return builder.toString();