Bump versions 9.0.4-SNAPSHOT
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / ReadDataReply.java
index 52e2c29249704fc2831b1db0d97ad1a4f9b2ecdc..2ed53ad0501a81e6ce9615fa318f4fa7a3fbb1c3 100644 (file)
@@ -5,20 +5,49 @@
  * 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.datastore.messages;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.opendaylight.controller.cluster.datastore.node.utils.stream.SerializationUtils;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public class ReadDataReply {
-  private final NormalizedNode<?, ?> normalizedNode;
+@Deprecated(since = "9.0.0", forRemoval = true)
+public class ReadDataReply extends VersionedExternalizableMessage {
+    private static final long serialVersionUID = 1L;
+
+    private NormalizedNode normalizedNode;
+
+    public ReadDataReply() {
+    }
+
+    public ReadDataReply(final NormalizedNode normalizedNode, final short version) {
+        super(version);
+        this.normalizedNode = normalizedNode;
+    }
+
+    public NormalizedNode getNormalizedNode() {
+        return normalizedNode;
+    }
+
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        super.readExternal(in);
+        normalizedNode = SerializationUtils.readNormalizedNode(in).orElse(null);
+    }
 
-  public ReadDataReply(NormalizedNode<?, ?> normalizedNode){
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+        SerializationUtils.writeNormalizedNode(out, getStreamVersion(), normalizedNode);
+    }
 
-    this.normalizedNode = normalizedNode;
-  }
+    public static ReadDataReply fromSerializable(final Object serializable) {
+        return (ReadDataReply) serializable;
+    }
 
-  public NormalizedNode<?, ?> getNormalizedNode() {
-    return normalizedNode;
-  }
+    public static boolean isSerializedType(final Object message) {
+        return message instanceof ReadDataReply;
+    }
 }