use of org.apache.karaf.bundle.core.internal.BundlesMBeanImpl in project karaf by apache.
the class Activator method doStart.
@Override
protected void doStart() throws Exception {
ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
if (configurationAdmin == null) {
return;
}
final BundleServiceImpl bundleService = new BundleServiceImpl(bundleContext);
register(BundleService.class, bundleService);
bundleStateServicesTracker = new ServiceTracker<>(bundleContext, BundleStateService.class, new ServiceTrackerCustomizer<BundleStateService, BundleStateService>() {
@Override
public BundleStateService addingService(ServiceReference<BundleStateService> reference) {
BundleStateService service = bundleContext.getService(reference);
bundleService.registerBundleStateService(service);
return service;
}
@Override
public void modifiedService(ServiceReference<BundleStateService> reference, BundleStateService service) {
}
@Override
public void removedService(ServiceReference<BundleStateService> reference, BundleStateService service) {
bundleService.unregisterBundleStateService(service);
bundleContext.ungetService(reference);
}
});
bundleStateServicesTracker.open();
bundleWatcher = new BundleWatcherImpl(bundleContext, new MavenConfigService(configurationAdmin), bundleService);
bundleWatcher.start();
register(BundleWatcher.class, bundleWatcher);
BundlesMBeanImpl bundlesMBeanImpl = new BundlesMBeanImpl(bundleContext, bundleService);
registerMBean(bundlesMBeanImpl, "type=bundle");
}
Aggregations