X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fprotobuff%2Fclient%2Fmessages%2FPayload.java;fp=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fprotobuff%2Fclient%2Fmessages%2FPayload.java;h=9a251cd64586741de2ec69ca288dc21189ca027e;hb=d097d70beab05f7fcb028ff12b2c47e35570fb55;hp=0000000000000000000000000000000000000000;hpb=d255fdd0b14660a22ff63771d954ac3fe5d0cb7e;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java new file mode 100644 index 0000000000..9a251cd645 --- /dev/null +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2014 Cisco 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.protobuff.client.messages; + + +import com.google.protobuf.GeneratedMessage; +import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages; + +import java.util.Map; + +/** + * An instance of a Payload class is meant to be used as the Payload for + * AppendEntries. + *
+ * + * When an actor which is derived from RaftActor attempts to persistData it + * must pass an instance of the Payload class. Similarly when state needs to + * be applied to the derived RaftActor it will be passed an instance of the + * Payload class. + *
+ * + * To define your own payload do the following, + *
+ * {@code + * + * import "AppendEntriesMessages.proto"; + * + * package org.opendaylight.controller.cluster.raft; + * + * option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages"; + * option java_outer_classname = "MockPayloadMessages"; + * + * extend AppendEntries.ReplicatedLogEntry.Payload { + * optional string value = 2; + * } + * } + *+ * + */ +public abstract class Payload { + private String clientPayloadClassName; + + public String getClientPayloadClassName() { + return this.getClass().getName(); + } + + public void setClientPayloadClassName(String clientPayloadClassName) { + this.clientPayloadClassName = clientPayloadClassName; + } + + /** + * Encode the payload data as a protocol buffer extension. + *
+ * TODO: Add more meat in here
+ * @param