2 * Copyright (c) 2015 Brocade Communications 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
8 package org.opendaylight.controller.cluster.datastore.messages;
10 import java.io.IOException;
11 import java.io.ObjectInput;
12 import java.io.ObjectOutput;
15 * The reply for the BatchedModifications message.
17 * @author Thomas Pantelis
19 public class BatchedModificationsReply extends VersionedExternalizableMessage {
20 private static final long serialVersionUID = 1L;
22 private static final byte COHORT_PATH_NOT_PRESENT = 0;
23 private static final byte COHORT_PATH_PRESENT = 1;
25 private int numBatched;
26 private String cohortPath;
28 public BatchedModificationsReply() {
31 public BatchedModificationsReply(int numBatched) {
32 this.numBatched = numBatched;
35 public BatchedModificationsReply(int numBatched, String cohortPath) {
36 this.numBatched = numBatched;
37 this.cohortPath = cohortPath;
40 public int getNumBatched() {
44 public String getCohortPath() {
49 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
50 super.readExternal(in);
51 numBatched = in.readInt();
53 if(in.readByte() == COHORT_PATH_PRESENT) {
54 cohortPath = in.readUTF();
59 public void writeExternal(ObjectOutput out) throws IOException {
60 super.writeExternal(out);
61 out.writeInt(numBatched);
63 if(cohortPath != null) {
64 out.writeByte(COHORT_PATH_PRESENT);
65 out.writeUTF(cohortPath);
67 out.writeByte(COHORT_PATH_NOT_PRESENT);
72 public Object toSerializable() {
77 public String toString() {
78 StringBuilder builder = new StringBuilder();
79 builder.append("BatchedModificationsReply [numBatched=").append(numBatched).append(", cohortPath=")
80 .append(cohortPath).append("]");
81 return builder.toString();