use of org.apache.karaf.features.internal.service.FeatureRepoFinder in project karaf by apache.
the class Activator method doStart.
protected void doStart() throws Exception {
BundleContext systemBundleContext = bundleContext.getBundle(0).getBundleContext();
ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
int resolverThreads = getInt("resolverThreads", Runtime.getRuntime().availableProcessors());
executorService = new ThreadPoolExecutor(0, resolverThreads, 1L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), ThreadUtils.namedThreadFactory("resolver"));
Resolver resolver = new ResolverImpl(new Slf4jResolverLog(LoggerFactory.getLogger(ResolverImpl.class)), executorService);
URLStreamHandlerService mvnUrlHandler = getTrackedService(URLStreamHandlerService.class);
if (configurationAdmin == null || mvnUrlHandler == null) {
return;
}
StandardRegionDigraph dg = DigraphHelper.loadDigraph(bundleContext);
DigraphHelper.verifyUnmanagedBundles(bundleContext, dg);
registerRegionDiGraph(dg);
boolean configCfgStore = getBoolean("configCfgStore", FeaturesService.DEFAULT_CONFIG_CFG_STORE);
FeatureConfigInstaller configInstaller = new FeatureConfigInstaller(configurationAdmin, configCfgStore);
installSupport = new BundleInstallSupportImpl(bundleContext.getBundle(), bundleContext, systemBundleContext, getTrackedServiceRef(ConfigurationAdmin.class).getBundle(), configInstaller, dg);
register(RegionDigraphPersistence.class, () -> installSupport.saveDigraph());
FeatureRepoFinder featureFinder = new FeatureRepoFinder();
register(ManagedService.class, featureFinder, FeatureRepoFinder.getServiceProperties());
Repository globalRepository = getGlobalRepository();
FeaturesServiceConfig cfg = getConfig();
StateStorage stateStorage = createStateStorage();
featuresService = new FeaturesServiceImpl(stateStorage, featureFinder, configurationAdmin, resolver, installSupport, globalRepository, cfg);
try {
EventAdminListener eventAdminListener = new EventAdminListener(bundleContext);
featuresService.registerListener(eventAdminListener);
} catch (Throwable t) {
// No EventAdmin support in this case
}
register(FeaturesService.class, featuresService);
featuresListenerTracker = createFeatureListenerTracker();
featuresListenerTracker.open();
FeaturesServiceMBeanImpl featuresServiceMBean = new FeaturesServiceMBeanImpl();
featuresServiceMBean.setBundleContext(bundleContext);
featuresServiceMBean.setFeaturesService(featuresService);
registerMBean(featuresServiceMBean, "type=feature");
String[] featuresRepositories = getStringArray("featuresRepositories", "");
String featuresBoot = getString("featuresBoot", "");
boolean featuresBootAsynchronous = getBoolean("featuresBootAsynchronous", false);
BootFeaturesInstaller bootFeaturesInstaller = new BootFeaturesInstaller(bundleContext, featuresService, featuresRepositories, featuresBoot, featuresBootAsynchronous);
bootFeaturesInstaller.start();
}
Aggregations