Search in sources :

Example 1 with URLStreamHandlerService

use of org.osgi.service.url.URLStreamHandlerService 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);
    Resolver resolver = new ResolverImpl(new Slf4jResolverLog(LoggerFactory.getLogger(ResolverImpl.class)));
    URLStreamHandlerService mvnUrlHandler = getTrackedService(URLStreamHandlerService.class);
    if (configurationAdmin == null || mvnUrlHandler == null) {
        return;
    }
    StandardRegionDigraph dg = DigraphHelper.loadDigraph(bundleContext);
    registerRegionDiGraph(dg);
    boolean configCfgStore = getBoolean("configCfgStore", FeaturesService.DEFAULT_CONFIG_CFG_STORE);
    FeatureConfigInstaller configInstaller = configurationAdmin != null ? new FeatureConfigInstaller(configurationAdmin, configCfgStore) : null;
    installSupport = new BundleInstallSupportImpl(bundleContext.getBundle(), bundleContext, systemBundleContext, configInstaller, dg);
    register(RegionDigraphPersistence.class, () -> installSupport.saveState());
    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) 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) ConfigurationAdmin(org.osgi.service.cm.ConfigurationAdmin) BundleContext(org.osgi.framework.BundleContext)

Aggregations

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 Resolver (org.osgi.service.resolver.Resolver)1 URLStreamHandlerService (org.osgi.service.url.URLStreamHandlerService)1