Use only BundleContext in BindingClassLoadingStrategy 27/88027/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 24 Feb 2020 12:23:16 +0000 (13:23 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Feb 2020 10:59:32 +0000 (11:59 +0100)
OSGi DS allows us to inject BundleContext directly, do not bother
with ComponentContext.

JIRA: MDSAL-392
Change-Id: I679d981d36a2e9e8d7df09bc79f87b4e803b1e8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-dom-codec-osgi/src/main/java/org/opendaylight/mdsal/binding/dom/codec/osgi/impl/BindingClassLoadingStrategy.java

index 2d5e3e24947ec9a6ee8cae493e03fdbcc9dd5b92..d0ee2fa30f9822f6067df2079eff8b17b3383d8d 100644 (file)
@@ -11,7 +11,7 @@ import org.opendaylight.binding.runtime.api.ClassLoadingStrategy;
 import org.opendaylight.binding.runtime.spi.GeneratedClassLoadingStrategy;
 import org.opendaylight.binding.runtime.spi.ModuleInfoBackedContext;
 import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
-import org.osgi.service.component.ComponentContext;
+import org.osgi.framework.BundleContext;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.Deactivate;
@@ -30,7 +30,7 @@ public final class BindingClassLoadingStrategy implements ClassLoadingStrategy {
     private ModuleInfoBackedContext moduleInfoBackedContext = null;
 
     @Activate
-    void activate(final ComponentContext ctx) {
+    void activate(final BundleContext ctx) {
         LOG.info("Binding-DOM codec starting");
 
         moduleInfoBackedContext = ModuleInfoBackedContext.create("binding-dom-codec", factory,
@@ -41,7 +41,7 @@ public final class BindingClassLoadingStrategy implements ClassLoadingStrategy {
                 moduleInfoBackedContext);
 
         LOG.debug("Starting Binding-DOM codec bundle tracker");
-        bundleTracker = new ModuleInfoBundleTracker(ctx.getBundleContext(), registry);
+        bundleTracker = new ModuleInfoBundleTracker(ctx, registry);
         bundleTracker.open();
 
         LOG.info("Binding-DOM codec started");