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 com.google.common.base.Preconditions;
12 import java.io.IOException;
13 import java.io.ObjectInput;
14 import java.io.ObjectOutput;
16 public class CreateTransactionReply extends VersionedExternalizableMessage {
17 private static final long serialVersionUID = 1L;
19 private String transactionPath;
20 private String transactionId;
22 public CreateTransactionReply() {
25 public CreateTransactionReply(final String transactionPath, final String transactionId, final short version) {
27 this.transactionPath = transactionPath;
28 this.transactionId = transactionId;
31 public String getTransactionPath() {
32 return transactionPath;
35 public String getTransactionId() {
40 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
41 super.readExternal(in);
42 transactionId = in.readUTF();
43 transactionPath = in.readUTF();
47 public void writeExternal(ObjectOutput out) throws IOException {
48 super.writeExternal(out);
49 out.writeUTF(transactionId);
50 out.writeUTF(transactionPath);
54 public String toString() {
55 StringBuilder builder = new StringBuilder();
56 builder.append("CreateTransactionReply [transactionPath=").append(transactionPath).append(", transactionId=")
57 .append(transactionId).append(", version=").append(getVersion()).append("]");
58 return builder.toString();
61 public static CreateTransactionReply fromSerializable(Object serializable) {
62 Preconditions.checkNotNull(serializable instanceof CreateTransactionReply);
63 return (CreateTransactionReply)serializable;
66 public static boolean isSerializedType(Object message) {
67 return message instanceof CreateTransactionReply;