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 <robert.varga@pantheon.tech>
(cherry picked from commit
a246443e10cc43adace7bc36fdf8014d76010389)
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
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;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.BundleTracker;
import org.osgi.util.tracker.BundleTrackerCustomizer;
private static final Logger LOG = LoggerFactory.getLogger(OsgiBundleScanningSchemaService.class);
private static final AtomicReference<OsgiBundleScanningSchemaService> GLOBAL_INSTANCE = new AtomicReference<>();
private static final Logger LOG = LoggerFactory.getLogger(OsgiBundleScanningSchemaService.class);
private static final AtomicReference<OsgiBundleScanningSchemaService> GLOBAL_INSTANCE = new AtomicReference<>();
- private static final long FRAMEWORK_BUNDLE_ID = 0;
private final BundleScanner scanner = new BundleScanner();
private final BundleContext context;
private final BundleScanner scanner = new BundleScanner();
private final BundleContext context;
@Override
public Iterable<Registration> addingBundle(final Bundle bundle, final BundleEvent event) {
@Override
public Iterable<Registration> addingBundle(final Bundle bundle, final BundleEvent event) {
- if (bundle.getBundleId() == FRAMEWORK_BUNDLE_ID) {
+ if (bundle.getBundleId() == Constants.SYSTEM_BUNDLE_ID) {
return Collections.emptyList();
}
return Collections.emptyList();
}
@Override
public void modifiedBundle(final Bundle bundle, final BundleEvent event, final Iterable<Registration> object) {
@Override
public void modifiedBundle(final Bundle bundle, final BundleEvent event, final Iterable<Registration> 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");
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");