Made Notification and Data service available from SessionManager 27/2827/2
authorEd Warnicke <eaw@cisco.com>
Mon, 18 Nov 2013 14:46:34 +0000 (08:46 -0600)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 18 Nov 2013 17:19:08 +0000 (17:19 +0000)
This was so we can use them conviently throughout the plugin.

Change-Id: I878780b84c6ecb57e352a419c3ef44b524a3e26b
Signed-off-by: Ed Warnicke <eaw@cisco.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/SalRegistrationManager.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/session/SessionManager.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/session/SessionManagerOFImpl.java

index 1944c54412e2de77ad2ab437e373ac7a2f21066b..681aa1b71d0622cc0ba575040536bf6ca8ad7ef6 100644 (file)
@@ -13,6 +13,7 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.openflowplugin.openflow.md.ModelDrivenSwitch;
 import org.opendaylight.openflowplugin.openflow.md.SwitchInventory;
 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
@@ -48,6 +49,8 @@ public class SalRegistrationManager implements SessionListener, SwitchInventory
 
     private NotificationProviderService publishService;
 
+    private DataProviderService dataService;
+
     public NotificationProviderService getPublishService() {
         return publishService;
     }
@@ -63,9 +66,12 @@ public class SalRegistrationManager implements SessionListener, SwitchInventory
     public void onSessionInitiated(ProviderContext session) {
         this.providerContext = session;
         this.publishService = session.getSALService(NotificationProviderService.class);
+        this.dataService = session.getSALService(DataProviderService.class);
 
         // We register as listener for Session Manager
         getSessionManager().registerSessionListener(this);
+        getSessionManager().setNotificationProviderService(publishService);
+        getSessionManager().setDataProviderService(dataService);
         LOG.info("SalRegistrationManager initialized");
 
     }
index 261ee57f139ee402ac3e1214a12b7d696be7087a..150fe0c69224f018f9b8c5872fe8754ba23cefc8 100644 (file)
@@ -11,6 +11,8 @@ package org.opendaylight.openflowplugin.openflow.md.core.session;
 import java.util.Collection;
 import java.util.Map;
 
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
 import org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductor;
 import org.opendaylight.openflowplugin.openflow.md.core.IMDMessageTranslator;
@@ -66,12 +68,32 @@ public interface SessionManager {
      * @param translatorMapping
      */
     public void setTranslatorMapping(Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, DataObject>>> translatorMapping);
-    
+
     /**
      * @return translator mapping
      */
     public Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, DataObject>>> getTranslatorMapping();
 
+    /**
+     * @param notificationServiceProvider
+     */
+    public void setNotificationProviderService(NotificationProviderService notificationProviderService);
+
+    /**
+     * @return notificationServiceProvider
+     */
+    public DataProviderService getDataProviderService();
+
+    /**
+     * @param notificationServiceProvider
+     */
+    public void setDataProviderService(DataProviderService dataServiceProvider);
+
+    /**
+     * @return notificationServiceProvider
+     */
+    public NotificationProviderService getNotificationProviderService();
+
     /**
      * @param listener
      * @return registration
index 73e101c08a42b8e9dfee0a03704526b67aa3ee0a..f1bd382005bb536e6a5efb61591c8ecb9298959d 100644 (file)
@@ -14,6 +14,8 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductor;
 import org.opendaylight.openflowplugin.openflow.md.core.IMDMessageTranslator;
 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
@@ -36,6 +38,9 @@ public class SessionManagerOFImpl implements SessionManager {
     private Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, DataObject>>> translatorMapping;
 
     protected final ListenerRegistry<SessionListener> sessionListeners = new ListenerRegistry<>();
+    private NotificationProviderService notificationProviderService;
+
+    private DataProviderService dataProviderService;
 
     /**
      * @return singleton instance
@@ -180,4 +185,27 @@ public class SessionManagerOFImpl implements SessionManager {
         return this.translatorMapping;
     }
 
+    @Override
+    public void setNotificationProviderService(
+            NotificationProviderService notificationProviderService) {
+        this.notificationProviderService = notificationProviderService;
+
+    }
+
+    @Override
+    public DataProviderService getDataProviderService() {
+        return dataProviderService;
+    }
+
+    @Override
+    public void setDataProviderService(DataProviderService dataServiceProvider) {
+        this.dataProviderService = dataServiceProvider;
+
+    }
+
+    @Override
+    public NotificationProviderService getNotificationProviderService() {
+        return notificationProviderService;
+    }
+
 }