Add blueprint wiring for the helium inventory manager 31/38631/3
authorTom Pantelis <tpanteli@brocade.com>
Mon, 9 May 2016 23:36:17 +0000 (19:36 -0400)
committerAnil Vishnoi <vishnoianil@gmail.com>
Fri, 3 Jun 2016 08:08:59 +0000 (08:08 +0000)
Change-Id: Ie6685cdf636c6f707943460bc6dbcac3483442c8
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
applications/inventory-manager/src/main/config/default-config.xml
applications/inventory-manager/src/main/java/org/opendaylight/openflowplugin/applications/inventory/manager/InventoryActivator.java
applications/inventory-manager/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/inventory/manager/impl/rev150530/InventoryManagerImplModule.java
applications/inventory-manager/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/inventory/manager/impl/rev150530/InventoryManagerImplModuleFactory.java
applications/inventory-manager/src/main/yang/inventory-manager-impl.yang
openflowplugin-blueprint-config-he/src/main/resources/org/opendaylight/blueprint/openflowplugin-helium.xml

index cfb992a206926e3471dffad31f20dac2066d56a2..8fa1cc456d9310b65bc1b8cbddb709f082f9f336 100644 (file)
@@ -6,6 +6,9 @@ Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License v1.0 which accompanies this distribution,
 and is available at http://www.eclipse.org/legal/epl-v10.html
+
+NOTE: This file is deprecated as wiring is now done via blueprint. This file is kept for
+       backwards compatibility. Runtime modifications are not honored.
 -->
 <snapshot>
   <required-capabilities>
index 3610157774a360893d7bca9c26fd4db3ab9711f6..1ed9397e54bd43a33304b64a0b7c3be40a0fa9ff 100644 (file)
@@ -9,41 +9,30 @@ package org.opendaylight.openflowplugin.applications.inventory.manager;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class InventoryActivator implements BindingAwareProvider, AutoCloseable {
+public class InventoryActivator implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(InventoryActivator.class);
-    private FlowCapableInventoryProvider provider;
-    final private EntityOwnershipService eos;
-
-    public InventoryActivator(EntityOwnershipService eos) {
-        this.eos = eos;
-    }
 
+    private final FlowCapableInventoryProvider provider;
 
-    @Override
-    public void onSessionInitiated(final ProviderContext session) {
-        DataBroker dataBroker = session.getSALService(DataBroker.class);
-        NotificationProviderService salNotifiService =
-                session.getSALService(NotificationProviderService.class);
+    public InventoryActivator(DataBroker dataBroker, NotificationProviderService notificationService,
+            EntityOwnershipService eos) {
+        provider = new FlowCapableInventoryProvider(dataBroker, notificationService, eos);
+    }
 
-        provider = new FlowCapableInventoryProvider(dataBroker, salNotifiService, eos);
+    public void start() {
         provider.start();
     }
 
     @Override
-    public void close() throws Exception {
-        if (provider != null) {
-            try {
-                provider.close();
-            } catch (InterruptedException e) {
-                LOG.warn("Interrupted while waiting for shutdown", e);
-            }
-            provider = null;
+    public void close() {
+        try {
+            provider.close();
+        } catch (InterruptedException e) {
+            LOG.warn("Interrupted while waiting for shutdown", e);
         }
     }
 }
index 673aa2515861d55cebbe1aa02f6208822f10e287..60bf1fbcac8c15d30019eaf24297c26162947d41 100644 (file)
@@ -1,8 +1,12 @@
 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530;
 
-import org.opendaylight.openflowplugin.applications.inventory.manager.InventoryActivator;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
 
-public class InventoryManagerImplModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530.AbstractInventoryManagerImplModule {
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class InventoryManagerImplModule extends AbstractInventoryManagerImplModule {
     public InventoryManagerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
@@ -12,15 +16,8 @@ public class InventoryManagerImplModule extends org.opendaylight.yang.gen.v1.urn
     }
 
     @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
+    public AutoCloseable createInstance() {
+        // InventoryActivator instance is created via blueprint so this in a no-op.
+        return NoopAutoCloseable.INSTANCE;
     }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        InventoryActivator provider = new InventoryActivator(getEntityOwnershipServiceDependency());
-        getBrokerDependency().registerProvider(provider);
-        return provider;
-    }
-
 }
index 49369d4a87a87aec800ce80deee05f312bfe382c..b8fe5bc13a3d6b7c6e68a600accdf97b883d10aa 100644 (file)
@@ -8,6 +8,11 @@
 * Do not modify this file unless it is present under src/main directory
 */
 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530;
-public class InventoryManagerImplModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530.AbstractInventoryManagerImplModuleFactory {
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class InventoryManagerImplModuleFactory extends AbstractInventoryManagerImplModuleFactory {
 
 }
index f3483ecd8c58c2670a10171fcb45328bcb81cba7..d68891584bf6d5edfc3591b5e0303cbeb4d79e0f 100644 (file)
@@ -18,6 +18,7 @@ module inventory-manager-impl {
     identity inventory-manager-impl {
         base config:module-type;
         config:java-name-prefix InventoryManagerImpl;
+        status deprecated;
     }
 
     augment "/config:modules/config:module/config:configuration" {
index 1ffee5285d3534cc887c866dd533a29aa79ee233..6ef2961be6c065d27ba65ea89dc1e314ad4751aa 100644 (file)
     <argument ref="entityOwnershipService"/>
   </bean>
 
+  <!-- Create the Inventory manager/provider -->
+  <bean id="inventoryManager" class="org.opendaylight.openflowplugin.applications.inventory.manager.InventoryActivator"
+          init-method="start" destroy-method="close">
+    <argument ref="dataBroker"/>
+    <argument ref="notificationService"/>
+    <argument ref="entityOwnershipService"/>
+  </bean>
+
   <reference id="switchConnProviderFactory"
           interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderFactory"/>
 
@@ -69,7 +77,7 @@
   <!-- Create OpenflowPluginProvider instance -->
 
   <bean id="openflowPluginProvider" class="org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider"
-          init-method="initialization" destroy-method="close" depends-on="statsManager">
+          init-method="initialization" destroy-method="close" depends-on="statsManager inventoryManager">
     <property name="dataBroker" ref="dataBroker"/>
     <property name="rpcRegistry" ref="rpcRegistry"/>
     <property name="notificationService" ref="notificationService"/>