Simplify NotificationListenerAdapter 57/79757/1
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 20 Jan 2019 13:52:19 +0000 (14:52 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 20 Jan 2019 13:54:40 +0000 (14:54 +0100)
There is just no need for the ceremony around what sort of normalized
node a DOMNotification has -- just use ContainerNode.

Change-Id: I66e2e0e72b75b0ce58be359eaa40668bc0c53b81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/NotificationListenerAdapter.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/NotificationListenerAdapter.java

index 95c2ca26fbf581bf55baa9ae1452e6fba1a8a9c1..653e0bfbc12e9c8f83fcfcc9d62e99acecd3c504 100644 (file)
@@ -15,17 +15,13 @@ import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.time.Instant;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.time.Instant;
-import java.util.Collection;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.dom.DOMResult;
 import org.opendaylight.mdsal.dom.api.DOMNotification;
 import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
 import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.dom.DOMResult;
 import org.opendaylight.mdsal.dom.api.DOMNotification;
 import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
 import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
@@ -184,8 +180,7 @@ public class NotificationListenerAdapter extends AbstractCommonSubscriber implem
     }
 
     private void addValuesToNotificationEventElement(final Document doc, final Element element) {
     }
 
     private void addValuesToNotificationEventElement(final Document doc, final Element element) {
-        final NormalizedNode<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> body =
-                notification.getBody();
+        final ContainerNode body = notification.getBody();
         try {
 
             final DOMResult domResult = writeNormalizedNode(body, schemaContext, this.path);
         try {
 
             final DOMResult domResult = writeNormalizedNode(body, schemaContext, this.path);
index 947c454b36572ade9b793640cdd9e89d5d2537d3..1a3e1e209389a9bbe239d81750a9f11c088cd281 100644 (file)
@@ -15,16 +15,12 @@ import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.time.Instant;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.time.Instant;
-import java.util.Collection;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.dom.DOMResult;
 import org.opendaylight.mdsal.dom.api.DOMNotification;
 import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.dom.DOMResult;
 import org.opendaylight.mdsal.dom.api.DOMNotification;
 import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
@@ -186,8 +182,7 @@ public class NotificationListenerAdapter extends AbstractCommonSubscriber implem
             return;
         }
 
             return;
         }
 
-        final NormalizedNode<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> body =
-                notification.getBody();
+        final ContainerNode body = notification.getBody();
         try {
 
             final DOMResult domResult = writeNormalizedNode(body, schemaContext, this.path);
         try {
 
             final DOMResult domResult = writeNormalizedNode(body, schemaContext, this.path);