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.protobuff.messages.transaction.ShardTransactionMessages;
13 public class CreateTransactionReply implements SerializableMessage {
15 public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransactionReply.class;
16 private final String transactionPath;
17 private final String transactionId;
18 private final int version;
20 public CreateTransactionReply(String transactionPath,
21 String transactionId) {
22 this(transactionPath, transactionId, CreateTransaction.CURRENT_VERSION);
25 public CreateTransactionReply(String transactionPath,
26 String transactionId, int 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 int getVersion() {
45 public Object toSerializable(){
46 return ShardTransactionMessages.CreateTransactionReply.newBuilder()
47 .setTransactionActorPath(transactionPath)
48 .setTransactionId(transactionId)
49 .setMessageVersion(version)
53 public static CreateTransactionReply fromSerializable(Object serializable){
54 ShardTransactionMessages.CreateTransactionReply o = (ShardTransactionMessages.CreateTransactionReply) serializable;
55 return new CreateTransactionReply(o.getTransactionActorPath(), o.getTransactionId(), o.getMessageVersion());