Migrate netconf to MD-SAL APIs
[netconf.git] / netconf / messagebus-netconf / src / main / java / org / opendaylight / netconf / messagebus / eventsources / netconf / NetconfEventSourceRegistration.java
index 649454ef11c866b945e81f70a7d806297c1ee645..2ae032288b8901207c5858ed75aaec3d342ad778 100644 (file)
@@ -7,11 +7,11 @@
  */
 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.dom.api.DOMMountPoint;
+import java.util.Optional;
 import org.opendaylight.controller.messagebus.spi.EventSourceRegistration;
+import org.opendaylight.mdsal.dom.api.DOMMountPoint;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapability;
@@ -60,7 +60,7 @@ public final class NetconfEventSourceRegistration implements AutoCloseable {
     }
 
     private static boolean isEventSource(final Node node) {
-        final NetconfNode netconfNode = node.getAugmentation(NetconfNode.class);
+        final NetconfNode netconfNode = node.augmentation(NetconfNode.class);
         if (netconfNode == null) {
             return false;
         }
@@ -88,11 +88,11 @@ public final class NetconfEventSourceRegistration implements AutoCloseable {
     }
 
     Optional<EventSourceRegistration<NetconfEventSource>> getEventSourceRegistration() {
-        return Optional.fromNullable(eventSourceRegistration);
+        return Optional.ofNullable(eventSourceRegistration);
     }
 
     NetconfNode getNetconfNode() {
-        return node.getAugmentation(NetconfNode.class);
+        return node.augmentation(NetconfNode.class);
     }
 
     void updateStatus() {
@@ -104,12 +104,12 @@ public final class NetconfEventSourceRegistration implements AutoCloseable {
         changeStatus(netconfConnStatus);
     }
 
-    private boolean checkConnectionStatusType(ConnectionStatus status) {
+    private static boolean checkConnectionStatusType(final ConnectionStatus status) {
         return status == ConnectionStatus.Connected || status == ConnectionStatus.Connecting
                 || status == ConnectionStatus.UnableToConnect;
     }
 
-    private void changeStatus(ConnectionStatus newStatus) {
+    private void changeStatus(final ConnectionStatus newStatus) {
         Preconditions.checkNotNull(newStatus);
         Preconditions.checkState(this.currentNetconfConnStatus != null);
         if (!checkConnectionStatusType(newStatus)) {
@@ -155,7 +155,7 @@ public final class NetconfEventSourceRegistration implements AutoCloseable {
         this.eventSourceRegistration = registration;
     }
 
-    private YangInstanceIdentifier domMountPath(final NodeId nodeId) {
+    private static YangInstanceIdentifier domMountPath(final NodeId nodeId) {
         return YangInstanceIdentifier.builder(NETCONF_DEVICE_DOM_PATH)
                 .nodeWithKey(Node.QNAME, NODE_ID_QNAME, nodeId.getValue()).build();
     }