Teach NETCONF about YANG 1.1 actions in cluster topology
[netconf.git] / netconf / netconf-topology-singleton / src / main / java / org / opendaylight / netconf / topology / singleton / messages / SchemaPathMessage.java
index 319b375340262e221b9dc4e0027fbbc88777ec79..5f170036c5456cca2eeb275f491229f8cc3de79d 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.netconf.topology.singleton.messages;
 
 import com.google.common.collect.Iterables;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -20,7 +21,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 public class SchemaPathMessage implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    private SchemaPath schemaPath;
+    @SuppressFBWarnings("SE_BAD_FIELD")
+    private final SchemaPath schemaPath;
 
     public SchemaPathMessage(final SchemaPath schemaPath) {
         this.schemaPath = schemaPath;
@@ -34,12 +36,18 @@ public class SchemaPathMessage implements Serializable {
         return new Proxy(this);
     }
 
+    @Override
+    public String toString() {
+        return "SchemaPathMessage [schemaPath=" + schemaPath + "]";
+    }
+
     private static class Proxy implements Externalizable {
         private static final long serialVersionUID = 2L;
 
         private SchemaPathMessage schemaPathMessage;
 
-        Proxy() {
+        @SuppressWarnings("checkstyle:RedundantModifier")
+        public Proxy() {
             //due to Externalizable
         }
 
@@ -49,9 +57,10 @@ public class SchemaPathMessage implements Serializable {
 
         @Override
         public void writeExternal(final ObjectOutput out) throws IOException {
-            out.writeInt(Iterables.size(schemaPathMessage.getSchemaPath().getPathTowardsRoot()));
-
-            for (final QName qualifiedName : schemaPathMessage.getSchemaPath().getPathTowardsRoot()) {
+            final Iterable<QName> path = schemaPathMessage.getSchemaPath().getPathFromRoot();
+            out.writeInt(Iterables.size(path));
+            for (final QName qualifiedName : path) {
+                // FIXME: switch to QName.writeTo() or a sal-clustering-commons stream
                 out.writeObject(qualifiedName);
             }
 
@@ -63,6 +72,7 @@ public class SchemaPathMessage implements Serializable {
             final int sizePath = in.readInt();
             final QName[] paths = new QName[sizePath];
             for (int i = 0; i < sizePath; i++) {
+                // FIXME: switch to QName.readFrom() or a sal-clustering-commons stream
                 paths[i] = (QName) in.readObject();
             }
             final boolean absolute = in.readBoolean();