X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fstreams%2Flisteners%2FListenerAdapter.java;h=2b7b0246e35ac2356ce90f87126d5e4f43076a2c;hp=e526ec13be75fad83ff6c33b95dfe9ba0d809298;hb=de3e413b633b7555ae8f3fe2ec163dbb7dda5da8;hpb=cbe83ca3074fa0182d4f079f528bb710a997ced7 diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/ListenerAdapter.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/ListenerAdapter.java index e526ec13be..2b7b0246e3 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/ListenerAdapter.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/ListenerAdapter.java @@ -45,10 +45,10 @@ import org.opendaylight.controller.sal.restconf.impl.ControllerContext; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.CompositeNode; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -69,7 +69,7 @@ public class ListenerAdapter implements DataChangeListener { private final XmlMapper xmlMapper = new XmlMapper(); private final SimpleDateFormat rfc3339 = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZ"); - private final InstanceIdentifier path; + private final YangInstanceIdentifier path; private ListenerRegistration registration; private final String streamName; private Set subscribers = new ConcurrentSet<>(); @@ -84,7 +84,7 @@ public class ListenerAdapter implements DataChangeListener { * @param streamName * The name of the stream. */ - ListenerAdapter(final InstanceIdentifier path, final String streamName) { + ListenerAdapter(final YangInstanceIdentifier path, final String streamName) { Preconditions.checkNotNull(path); Preconditions.checkArgument(streamName != null && !streamName.isEmpty()); this.path = path; @@ -95,7 +95,7 @@ public class ListenerAdapter implements DataChangeListener { } @Override - public void onDataChanged(final DataChangeEvent change) { + public void onDataChanged(final DataChangeEvent change) { if (!change.getCreatedConfigurationData().isEmpty() || !change.getCreatedOperationalData().isEmpty() || !change.getUpdatedConfigurationData().isEmpty() || !change.getUpdatedOperationalData().isEmpty() || !change.getRemovedConfigurationData().isEmpty() || !change.getRemovedOperationalData().isEmpty()) { @@ -216,7 +216,7 @@ public class ListenerAdapter implements DataChangeListener { * DataChangeEvent * @return Data in printable form. */ - private String prepareXmlFrom(final DataChangeEvent change) { + private String prepareXmlFrom(final DataChangeEvent change) { Document doc = createDocument(); Element notificationElement = doc.createElementNS("urn:ietf:params:xml:ns:netconf:notification:1.0", "notification"); @@ -287,7 +287,7 @@ public class ListenerAdapter implements DataChangeListener { */ private void addValuesToDataChangedNotificationEventElement(final Document doc, final Element dataChangedNotificationEventElement, - final DataChangeEvent change) { + final DataChangeEvent change) { addValuesFromDataToElement(doc, change.getCreatedConfigurationData(), dataChangedNotificationEventElement, Store.CONFIG, Operation.CREATED); addValuesFromDataToElement(doc, change.getCreatedOperationalData(), dataChangedNotificationEventElement, @@ -312,7 +312,7 @@ public class ListenerAdapter implements DataChangeListener { * @param doc * {@link Document} * @param data - * Set of {@link InstanceIdentifier}. + * Set of {@link YangInstanceIdentifier}. * @param element * {@link Element} * @param store @@ -320,12 +320,12 @@ public class ListenerAdapter implements DataChangeListener { * @param operation * {@link Operation} */ - private void addValuesFromDataToElement(final Document doc, final Set data, + private void addValuesFromDataToElement(final Document doc, final Set data, final Element element, final Store store, final Operation operation) { if (data == null || data.isEmpty()) { return; } - for (InstanceIdentifier path : data) { + for (YangInstanceIdentifier path : data) { Node node = createDataChangeEventElement(doc, path, null, store, operation); element.appendChild(node); } @@ -337,7 +337,7 @@ public class ListenerAdapter implements DataChangeListener { * @param doc * {@link Document} * @param data - * Map of {@link InstanceIdentifier} and {@link CompositeNode}. + * Map of {@link YangInstanceIdentifier} and {@link CompositeNode}. * @param element * {@link Element} * @param store @@ -345,12 +345,12 @@ public class ListenerAdapter implements DataChangeListener { * @param operation * {@link Operation} */ - private void addValuesFromDataToElement(final Document doc, final Map data, + private void addValuesFromDataToElement(final Document doc, final Map data, final Element element, final Store store, final Operation operation) { if (data == null || data.isEmpty()) { return; } - for (Entry entry : data.entrySet()) { + for (Entry entry : data.entrySet()) { Node node = createDataChangeEventElement(doc, entry.getKey(), entry.getValue(), store, operation); element.appendChild(node); } @@ -371,7 +371,7 @@ public class ListenerAdapter implements DataChangeListener { * {@link Operation} * @return {@link Node} node represented by changed event element. */ - private Node createDataChangeEventElement(final Document doc, final InstanceIdentifier path, + private Node createDataChangeEventElement(final Document doc, final YangInstanceIdentifier path, final CompositeNode data, final Store store, final Operation operation) { Element dataChangeEventElement = doc.createElement("data-change-event"); @@ -407,7 +407,7 @@ public class ListenerAdapter implements DataChangeListener { * {@link CompositeNode} * @return Data in XML format. */ - private Node translateToXml(final InstanceIdentifier path, final CompositeNode data) { + private Node translateToXml(final YangInstanceIdentifier path, final CompositeNode data) { DataNodeContainer schemaNode = ControllerContext.getInstance().getDataNodeContainerFor(path); if (schemaNode == null) { LOG.info( @@ -432,10 +432,10 @@ public class ListenerAdapter implements DataChangeListener { * @param element * {@link Element} */ - private void addPathAsValueToElement(final InstanceIdentifier path, final Element element) { + private void addPathAsValueToElement(final YangInstanceIdentifier path, final Element element) { // Map< key = namespace, value = prefix> Map prefixes = new HashMap<>(); - InstanceIdentifier instanceIdentifier = path; + YangInstanceIdentifier instanceIdentifier = path; StringBuilder textContent = new StringBuilder(); // FIXME: BUG-1281: this is duplicated code from yangtools (BUG-1275) @@ -520,7 +520,7 @@ public class ListenerAdapter implements DataChangeListener { * * @return Path pointed to data in data store. */ - public InstanceIdentifier getPath() { + public YangInstanceIdentifier getPath() { return path; }