X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft-example%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fexample%2Fmessages%2FKeyValue.java;h=520188b8cd4dd91ecc8a4649ab5e3dab42744443;hb=d0f46920468c8e4b67c68bd9058572b2d10d75f1;hp=2eb4189eac911d7ecb773137bfcfc652b523564b;hpb=608760751ce7fcf4e84e86a8b33d43bc1d9984d6;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft-example/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValue.java b/opendaylight/md-sal/sal-akka-raft-example/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValue.java index 2eb4189eac..520188b8cd 100644 --- a/opendaylight/md-sal/sal-akka-raft-example/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValue.java +++ b/opendaylight/md-sal/sal-akka-raft-example/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValue.java @@ -8,13 +8,8 @@ package org.opendaylight.controller.cluster.example.messages; -import com.google.protobuf.GeneratedMessage; import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; -import org.opendaylight.controller.protobuff.messages.cluster.example.KeyValueMessages; -import org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages; public class KeyValue extends Payload implements Serializable { private static final long serialVersionUID = 1L; @@ -24,7 +19,7 @@ public class KeyValue extends Payload implements Serializable { public KeyValue() { } - public KeyValue(String key, String value){ + public KeyValue(String key, String value) { this.key = key; this.value = value; } @@ -45,29 +40,9 @@ public class KeyValue extends Payload implements Serializable { this.value = value; } - @Override public String toString() { - return "KeyValue{" + - "key='" + key + '\'' + - ", value='" + value + '\'' + - '}'; - } - - // override this method to return the protobuff related extension fields and their values - @Override public Map, String> encode() { - Map, String> map = new HashMap<>(); - map.put(KeyValueMessages.key, getKey()); - map.put(KeyValueMessages.value, getValue()); - return map; - } - - // override this method to assign the values from protobuff - @Override public Payload decode( - AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payloadProtoBuff) { - String key = payloadProtoBuff.getExtension(KeyValueMessages.key); - String value = payloadProtoBuff.getExtension(KeyValueMessages.value); - this.setKey(key); - this.setValue(value); - return this; + @Override + public String toString() { + return "KeyValue{" + "key='" + key + '\'' + ", value='" + value + '\'' + '}'; } @Override