From 4589b1c99f6a35e980af42885bcdbabcfd3503a5 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 26 Feb 2020 11:38:07 +0100 Subject: [PATCH] Use osgi-core constants Just to keep things consistent, use OSGi's Constants class to get the bundle id for framework (i.e. SYSTEM_BUNDLE_ID). Change-Id: I18dae474c944f29ebb32203a12db1c96c2e1483f Signed-off-by: Robert Varga (cherry picked from commit a246443e10cc43adace7bc36fdf8014d76010389) --- .../service/osgi/OsgiBundleScanningSchemaService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dom/mdsal-dom-schema-service-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/service/osgi/OsgiBundleScanningSchemaService.java b/dom/mdsal-dom-schema-service-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/service/osgi/OsgiBundleScanningSchemaService.java index d1917c0bef..727d790ab2 100644 --- a/dom/mdsal-dom-schema-service-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/service/osgi/OsgiBundleScanningSchemaService.java +++ b/dom/mdsal-dom-schema-service-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/service/osgi/OsgiBundleScanningSchemaService.java @@ -27,6 +27,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContextListener; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; +import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.BundleTracker; import org.osgi.util.tracker.BundleTrackerCustomizer; @@ -40,7 +41,6 @@ public final class OsgiBundleScanningSchemaService extends ScanningSchemaService private static final Logger LOG = LoggerFactory.getLogger(OsgiBundleScanningSchemaService.class); private static final AtomicReference GLOBAL_INSTANCE = new AtomicReference<>(); - private static final long FRAMEWORK_BUNDLE_ID = 0; private final BundleScanner scanner = new BundleScanner(); private final BundleContext context; @@ -125,7 +125,7 @@ public final class OsgiBundleScanningSchemaService extends ScanningSchemaService @Override public Iterable addingBundle(final Bundle bundle, final BundleEvent event) { - if (bundle.getBundleId() == FRAMEWORK_BUNDLE_ID) { + if (bundle.getBundleId() == Constants.SYSTEM_BUNDLE_ID) { return Collections.emptyList(); } @@ -158,7 +158,7 @@ public final class OsgiBundleScanningSchemaService extends ScanningSchemaService @Override public void modifiedBundle(final Bundle bundle, final BundleEvent event, final Iterable object) { - if (bundle.getBundleId() == FRAMEWORK_BUNDLE_ID) { + if (bundle.getBundleId() == Constants.SYSTEM_BUNDLE_ID) { LOG.debug("Framework bundle {} got event {}", bundle, event.getType()); if ((event.getType() & BundleEvent.STOPPING) != 0) { LOG.info("OSGi framework is being stopped, halting bundle scanning"); -- 2.36.6