Add message to update the schema context of the InMemoryDOMDataStore
[controller.git] / opendaylight / sal / connection / implementation / src / main / java / org / opendaylight / controller / sal / connection / implementation / internal / ConnectionService.java
index ad4a5fba94e4b34f69bbb658421693305bd82888..b2cb414303fa2a826f9b9a3ebfc0ab7f7365da88 100644 (file)
@@ -8,14 +8,12 @@
 
 package org.opendaylight.controller.sal.connection.implementation.internal;
 
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
-import java.util.Collections;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
 import org.opendaylight.controller.sal.connection.ConnectionConstants;
+import org.opendaylight.controller.sal.connection.ConnectionLocality;
 import org.opendaylight.controller.sal.connection.IConnectionListener;
 import org.opendaylight.controller.sal.connection.IConnectionService;
 import org.opendaylight.controller.sal.connection.IPluginInConnectionService;
@@ -100,10 +98,16 @@ public class ConnectionService implements IPluginOutConnectionService, IConnecti
      * @return true if node is local to this controller. false otherwise.
      */
     public boolean isLocal(Node node) {
-        if (this.connectionListener == null) return true;
+        if (this.connectionListener == null) return false;
         return connectionListener.isLocal(node);
     }
 
+    @Override
+    public ConnectionLocality getLocalityStatus(Node node) {
+        if (this.connectionListener == null) return ConnectionLocality.NOT_CONNECTED;
+        return connectionListener.getLocalityStatus(node);
+    }
+
     @Override
     public Node connect (String type, String connectionIdentifier, Map<ConnectionConstants, String> params) {
         IPluginInConnectionService s = pluginService.get(type);
@@ -146,9 +150,9 @@ public class ConnectionService implements IPluginOutConnectionService, IConnecti
      */
     @Override
     public void notifyNodeDisconnectFromMaster(Node node) {
-        for (String pluginType : this.pluginService.keySet()) {
-            IPluginInConnectionService s = pluginService.get(pluginType);
-            s.notifyNodeDisconnectFromMaster(node);
+        IPluginInConnectionService s = pluginService.get(node.getType());
+        if (s != null) {
+             s.notifyNodeDisconnectFromMaster(node);
         }
     }
-}
\ No newline at end of file
+}