Merge "Added extended ietf-netconf-monitoring detection for Netconf devices"
authorEd Warnicke <eaw@cisco.com>
Thu, 16 Jan 2014 16:01:08 +0000 (16:01 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 16 Jan 2014 16:01:08 +0000 (16:01 +0000)
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.xtend

index 3d19c98..4587cc5 100644 (file)
@@ -41,8 +41,10 @@ import org.osgi.framework.BundleContext
 import static org.opendaylight.controller.sal.compatibility.NodeMapping.*
 import org.opendaylight.controller.sal.compatibility.topology.TopologyProvider
 import org.opendaylight.controller.sal.compatibility.adsal.DataPacketServiceAdapter
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
 
-class ComponentActivator extends ComponentActivatorAbstractBase implements BindingAwareConsumer {
+class ComponentActivator extends ComponentActivatorAbstractBase {
 
     private BundleContext context;
 
@@ -83,37 +85,9 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
     }
 
     def setBroker(BindingAwareBroker broker) {
-        broker.registerConsumer(this, context)
+        broker.registerProvider(new SalCompatibilityProvider(this), context)
     }
 
-    override onSessionInitialized(ConsumerContext session) {
-        val subscribe = session.getSALService(NotificationService)
-
-        // Registration of Flow Service
-        flow.delegate = session.getRpcService(SalFlowService)
-        flow.dataBrokerService = session.getSALService(DataBrokerService);
-        subscribe.registerNotificationListener(flow);
-
-        // Data Packet Service
-        subscribe.registerNotificationListener(inventory);
-        dataPacketService.delegate = session.getRpcService(PacketProcessingService)
-
-        // Inventory Service
-        inventory.dataService = session.getSALService(DataBrokerService);
-        inventory.flowStatisticsService = session.getRpcService(OpendaylightFlowStatisticsService);
-        inventory.flowTableStatisticsService = session.getRpcService(OpendaylightFlowTableStatisticsService);
-        inventory.nodeConnectorStatisticsService = session.getRpcService(OpendaylightPortStatisticsService);
-        inventory.topologyDiscovery = session.getRpcService(FlowTopologyDiscoveryService);
-               inventory.dataProviderService = session.getSALService(DataProviderService)
-               topology.dataService = session.getSALService(DataProviderService)
-               tpProvider.dataService = session.getSALService(DataProviderService)
-
-
-               tpProvider.start();
-
-        subscribe.registerNotificationListener(dataPacket)
-
-    }
 
     override protected getGlobalImplementations() {
         return Arrays.asList(this, flow, inventory, dataPacket, nodeFactory, nodeConnectorFactory,topology,tpProvider)
@@ -225,3 +199,54 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
         return props;
     }
 }
+package class SalCompatibilityProvider implements BindingAwareProvider {
+    
+    private val ComponentActivator activator;
+    
+    new(ComponentActivator cmpAct) {
+        activator = cmpAct;
+    }
+    
+    override getFunctionality() {
+        // Noop
+    }
+    
+    override getImplementations() {
+        // Noop
+    }
+    
+    
+    override onSessionInitialized(ConsumerContext session) {
+        // Noop
+    }
+    
+    
+    override onSessionInitiated(ProviderContext session) {
+        val it = activator
+                val subscribe = session.getSALService(NotificationService)
+
+        // Registration of Flow Service
+        flow.delegate = session.getRpcService(SalFlowService)
+        flow.dataBrokerService = session.getSALService(DataBrokerService);
+        subscribe.registerNotificationListener(flow);
+
+        // Data Packet Service
+        subscribe.registerNotificationListener(inventory);
+        dataPacketService.delegate = session.getRpcService(PacketProcessingService)
+
+        // Inventory Service
+        inventory.dataService = session.getSALService(DataBrokerService);
+        inventory.flowStatisticsService = session.getRpcService(OpendaylightFlowStatisticsService);
+        inventory.flowTableStatisticsService = session.getRpcService(OpendaylightFlowTableStatisticsService);
+        inventory.nodeConnectorStatisticsService = session.getRpcService(OpendaylightPortStatisticsService);
+        inventory.topologyDiscovery = session.getRpcService(FlowTopologyDiscoveryService);
+        inventory.dataProviderService = session.getSALService(DataProviderService)
+        topology.dataService = session.getSALService(DataProviderService)
+        tpProvider.dataService = session.getSALService(DataProviderService)
+
+
+        tpProvider.start();
+
+        subscribe.registerNotificationListener(dataPacket)
+    }
+}