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<ShardTransactionMessages.CreateTransactionReply> SERIALIZABLE_CLASS =
16 ShardTransactionMessages.CreateTransactionReply.class;
17 private final String transactionPath;
18 private final String transactionId;
19 private final int version;
21 public CreateTransactionReply(final String transactionPath,
22 final String transactionId) {
23 this(transactionPath, transactionId, CreateTransaction.CURRENT_VERSION);
26 public CreateTransactionReply(final String transactionPath,
27 final String transactionId, final int version) {
28 this.transactionPath = transactionPath;
29 this.transactionId = transactionId;
30 this.version = version;
34 public String getTransactionPath() {
35 return transactionPath;
38 public String getTransactionId() {
42 public int getVersion() {
47 public Object toSerializable(){
48 return ShardTransactionMessages.CreateTransactionReply.newBuilder()
49 .setTransactionActorPath(transactionPath)
50 .setTransactionId(transactionId)
51 .setMessageVersion(version)
55 public static CreateTransactionReply fromSerializable(final Object serializable){
56 ShardTransactionMessages.CreateTransactionReply o = (ShardTransactionMessages.CreateTransactionReply) serializable;
57 return new CreateTransactionReply(o.getTransactionActorPath(), o.getTransactionId(), o.getMessageVersion());