--- /dev/null
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.raft.messages;
+
+import java.io.Serializable;
+
+/**
+ * Abstract base class for a server configuration change reply.
+ *
+ * @author Thomas Pantelis
+ */
+public class AbstractServerChangeReply implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private final String leaderHint;
+ private final ServerChangeStatus status;
+
+ public AbstractServerChangeReply(ServerChangeStatus status, String leaderHint) {
+ this.status = status;
+ this.leaderHint = leaderHint;
+ }
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+ public String getLeaderHint() {
+ return leaderHint;
+ }
+
+ public ServerChangeStatus getStatus() {
+ return status;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " [status=" + status + ", leaderHint=" + leaderHint + "]";
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.raft.messages;
+
+import java.io.Serializable;
+
+/**
+ * Message sent to add a new server/replica (§4.1).
+ *
+ * @author Thomas Pantelis
+ */
+public class AddServer implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private final String newServerId;
+ private final String newServerAddress;
+ private final boolean votingMember;
+
+ public AddServer(String newServerId, String newServerAddress, boolean votingMember) {
+ this.newServerId = newServerId;
+ this.newServerAddress = newServerAddress;
+ this.votingMember = votingMember;
+ }
+
+ public String getNewServerId() {
+ return newServerId;
+ }
+
+ public String getNewServerAddress() {
+ return newServerAddress;
+ }
+
+ public boolean isVotingMember() {
+ return votingMember;
+ }
+
+ @Override
+ public String toString() {
+ return "AddServer [newServerId=" + newServerId + ", newServerAddress=" + newServerAddress + ", votingMember="
+ + votingMember + "]";
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.raft.messages;
+
+/**
+ * Reply to an AddServer message (§4.1).
+ *
+ * @author Thomas Pantelis
+ */
+public class AddServerReply extends AbstractServerChangeReply {
+ private static final long serialVersionUID = 1L;
+
+ public AddServerReply(ServerChangeStatus status, String leaderHint) {
+ super(status, leaderHint);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.raft.messages;
+
+/**
+ * Enumerates server configuration change status reply codes.
+ *
+ * @author Thomas Pantelis
+ */
+public enum ServerChangeStatus {
+ OK,
+ NO_LEADER,
+ TIMEOUT
+}