X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fmessagebus-netconf%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fmessagebus%2Feventsources%2Fnetconf%2FNetconfEventSourceRegistration.java;h=9089e92ee1ab999298f58200a88ccf7bb7876a51;hb=ddfdd7b56162e9c45639388b10407d45f5f0ba13;hp=8fcb44cfc120ff6f29fcfc4c1c5a3c6f6a809feb;hpb=ebce6c1ba9a22e420c87b45e5b20501dc7047730;p=netconf.git diff --git a/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceRegistration.java b/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceRegistration.java index 8fcb44cfc1..9089e92ee1 100644 --- a/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceRegistration.java +++ b/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceRegistration.java @@ -10,7 +10,6 @@ package org.opendaylight.netconf.messagebus.eventsources.netconf; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import java.util.List; -import org.opendaylight.controller.md.sal.binding.api.MountPoint; import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint; import org.opendaylight.controller.messagebus.spi.EventSourceRegistration; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; @@ -28,17 +27,18 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Helper class to keep connection status of netconf node and event source registration object + * Helper class to keep connection status of netconf node and event source registration object. */ public class NetconfEventSourceRegistration implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(NetconfEventSourceRegistration.class); private static final YangInstanceIdentifier NETCONF_DEVICE_DOM_PATH = YangInstanceIdentifier.builder() - .node(NetworkTopology.QNAME).node(Topology.QNAME) - .nodeWithKey(Topology.QNAME, QName.create(Topology.QNAME, "topology-id"), TopologyNetconf.QNAME.getLocalName()) - .node(Node.QNAME).build(); + .node(NetworkTopology.QNAME).node(Topology.QNAME) + .nodeWithKey(Topology.QNAME, QName.create(Topology.QNAME, "topology-id"), TopologyNetconf.QNAME + .getLocalName()) + .node(Node.QNAME).build(); private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "node-id"); - private static final String NotificationCapabilityPrefix = "(urn:ietf:params:xml:ns:netconf:notification"; + private static final String NOTIFICATION_CAPABILITY_PREFIX = "(urn:ietf:params:xml:ns:netconf:notification"; private final Node node; private final NetconfEventSourceManager netconfEventSourceManager; @@ -46,7 +46,7 @@ public class NetconfEventSourceRegistration implements AutoCloseable { private EventSourceRegistration eventSourceRegistration; public static NetconfEventSourceRegistration create(final InstanceIdentifier instanceIdent, final Node node, - final NetconfEventSourceManager netconfEventSourceManager) { + final NetconfEventSourceManager netconfEventSourceManager) { Preconditions.checkNotNull(instanceIdent); Preconditions.checkNotNull(node); Preconditions.checkNotNull(netconfEventSourceManager); @@ -72,7 +72,7 @@ public class NetconfEventSourceRegistration implements AutoCloseable { return false; } for (final AvailableCapability capability : netconfNode.getAvailableCapabilities().getAvailableCapability()) { - if (capability.getCapability().startsWith(NotificationCapabilityPrefix)) { + if (capability.getCapability().startsWith(NOTIFICATION_CAPABILITY_PREFIX)) { return true; } } @@ -141,14 +141,14 @@ public class NetconfEventSourceRegistration implements AutoCloseable { private void registrationEventSource() { final Optional domMountPoint = netconfEventSourceManager.getDomMounts() - .getMountPoint(domMountPath(node.getNodeId())); + .getMountPoint(domMountPath(node.getNodeId())); EventSourceRegistration registration = null; if (domMountPoint.isPresent()/* && mountPoint.isPresent()*/) { NetconfEventSourceMount mount = new NetconfEventSourceMount(node, domMountPoint.get()); final NetconfEventSource netconfEventSource = new NetconfEventSource( - netconfEventSourceManager.getStreamMap(), + netconfEventSourceManager.getStreamMap(), mount, - netconfEventSourceManager.getPublishService()); + netconfEventSourceManager.getPublishService()); registration = netconfEventSourceManager.getEventSourceRegistry().registerEventSource(netconfEventSource); LOG.info("Event source {} has been registered", node.getNodeId().getValue()); } @@ -157,7 +157,7 @@ public class NetconfEventSourceRegistration implements AutoCloseable { private YangInstanceIdentifier domMountPath(final NodeId nodeId) { return YangInstanceIdentifier.builder(NETCONF_DEVICE_DOM_PATH) - .nodeWithKey(Node.QNAME, NODE_ID_QNAME, nodeId.getValue()).build(); + .nodeWithKey(Node.QNAME, NODE_ID_QNAME, nodeId.getValue()).build(); } private void closeEventSourceRegistration() { @@ -166,7 +166,8 @@ public class NetconfEventSourceRegistration implements AutoCloseable { } } - @Override public void close() { + @Override + public void close() { closeEventSourceRegistration(); }