BundleScanner needs to be registered as a bundle listener to track bundles being... 52/1652/2
authorPrasanth Pallamreddy <ppallamr@cisco.com>
Thu, 3 Oct 2013 16:49:49 +0000 (09:49 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 3 Oct 2013 20:09:37 +0000 (20:09 +0000)
Change-Id: I40af7fb2da4aabe9ae2605d0187d97384be5a3f4
Signed-off-by: Prasanth Pallamreddy <ppallamr@cisco.com>
opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/Activator.java

index 82de105709004b5ba5323de0f58f6c822431fa57..69c81242d99c1ace9cc2ebdbb8a9fd47d9ca07c8 100644 (file)
@@ -11,12 +11,26 @@ package org.opendaylight.controller.northbound.bundlescanner.internal;
 import org.apache.felix.dm.Component;
 import org.opendaylight.controller.northbound.bundlescanner.IBundleScanService;
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
 
 /**
  * The activator registers the BundleScanner.
  */
 public class Activator extends ComponentActivatorAbstractBase {
 
+    @Override
+    protected void init() {
+        BundleContext context = FrameworkUtil.getBundle(BundleScanner.class).getBundleContext();
+        context.addBundleListener(BundleScanner.getInstance());
+    }
+
+    @Override
+    public void destroy() {
+        BundleContext context = FrameworkUtil.getBundle(BundleScanner.class).getBundleContext();
+        context.removeBundleListener(BundleScanner.getInstance());
+    }
+
     @Override
     protected Object[] getGlobalImplementations() {
         return new Object[] { BundleScanServiceImpl.class };