Search in sources :

Example 1 with Slf4jResolverLog

use of org.apache.karaf.features.internal.resolver.Slf4jResolverLog 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();
}
Also used : FeaturesServiceImpl(org.apache.karaf.features.internal.service.FeaturesServiceImpl) BootFeaturesInstaller(org.apache.karaf.features.internal.service.BootFeaturesInstaller) Resolver(org.osgi.service.resolver.Resolver) URLStreamHandlerService(org.osgi.service.url.URLStreamHandlerService) StateStorage(org.apache.karaf.features.internal.service.StateStorage) BundleInstallSupportImpl(org.apache.karaf.features.internal.service.BundleInstallSupportImpl) ResolverImpl(org.apache.felix.resolver.ResolverImpl) FeatureRepoFinder(org.apache.karaf.features.internal.service.FeatureRepoFinder) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) FeaturesServiceMBeanImpl(org.apache.karaf.features.internal.management.FeaturesServiceMBeanImpl) StandardRegionDigraph(org.eclipse.equinox.internal.region.StandardRegionDigraph) EventAdminListener(org.apache.karaf.features.internal.service.EventAdminListener) FeatureConfigInstaller(org.apache.karaf.features.internal.service.FeatureConfigInstaller) XmlRepository(org.apache.karaf.features.internal.repository.XmlRepository) Repository(org.osgi.service.repository.Repository) AggregateRepository(org.apache.karaf.features.internal.repository.AggregateRepository) JsonRepository(org.apache.karaf.features.internal.repository.JsonRepository) FeaturesServiceConfig(org.apache.karaf.features.internal.service.FeaturesServiceConfig) Slf4jResolverLog(org.apache.karaf.features.internal.resolver.Slf4jResolverLog) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) ConfigurationAdmin(org.osgi.service.cm.ConfigurationAdmin) BundleContext(org.osgi.framework.BundleContext)

Aggregations

LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 ResolverImpl (org.apache.felix.resolver.ResolverImpl)1 FeaturesServiceMBeanImpl (org.apache.karaf.features.internal.management.FeaturesServiceMBeanImpl)1 AggregateRepository (org.apache.karaf.features.internal.repository.AggregateRepository)1 JsonRepository (org.apache.karaf.features.internal.repository.JsonRepository)1 XmlRepository (org.apache.karaf.features.internal.repository.XmlRepository)1 Slf4jResolverLog (org.apache.karaf.features.internal.resolver.Slf4jResolverLog)1 BootFeaturesInstaller (org.apache.karaf.features.internal.service.BootFeaturesInstaller)1 BundleInstallSupportImpl (org.apache.karaf.features.internal.service.BundleInstallSupportImpl)1 EventAdminListener (org.apache.karaf.features.internal.service.EventAdminListener)1 FeatureConfigInstaller (org.apache.karaf.features.internal.service.FeatureConfigInstaller)1 FeatureRepoFinder (org.apache.karaf.features.internal.service.FeatureRepoFinder)1 FeaturesServiceConfig (org.apache.karaf.features.internal.service.FeaturesServiceConfig)1 FeaturesServiceImpl (org.apache.karaf.features.internal.service.FeaturesServiceImpl)1 StateStorage (org.apache.karaf.features.internal.service.StateStorage)1 StandardRegionDigraph (org.eclipse.equinox.internal.region.StandardRegionDigraph)1 BundleContext (org.osgi.framework.BundleContext)1 ConfigurationAdmin (org.osgi.service.cm.ConfigurationAdmin)1 Repository (org.osgi.service.repository.Repository)1