Search in sources :

Example 1 with EquinoxFactoryManager

use of org.eclipse.osgi.internal.url.EquinoxFactoryManager in project rt.equinox.framework by eclipse.

the class SystemBundleActivator method start.

@SuppressWarnings("deprecation")
public void start(BundleContext bc) throws Exception {
    registrations.clear();
    EquinoxBundle bundle = (EquinoxBundle) bc.getBundle();
    bundle.getEquinoxContainer().systemStart(bc);
    EquinoxConfiguration configuration = bundle.getEquinoxContainer().getConfiguration();
    installSecurityManager(configuration);
    bundle.getEquinoxContainer().getLogServices().start(bc);
    urlFactoryManager = new EquinoxFactoryManager(bundle.getEquinoxContainer());
    urlFactoryManager.installHandlerFactories(bc);
    FrameworkDebugOptions dbgOptions = (FrameworkDebugOptions) configuration.getDebugOptions();
    dbgOptions.start(bc);
    SecurityAdmin sa = bundle.getEquinoxContainer().getStorage().getSecurityAdmin();
    ClassLoader tccl = bundle.getEquinoxContainer().getContextFinder();
    registerLocations(bc, bundle.getEquinoxContainer().getLocations());
    register(bc, EnvironmentInfo.class, bundle.getEquinoxContainer().getConfiguration(), null);
    register(bc, PackageAdmin.class, bundle.getEquinoxContainer().getPackageAdmin(), null);
    register(bc, StartLevel.class, bundle.getEquinoxContainer().getStartLevel(), null);
    register(bc, PermissionAdmin.class, sa, null);
    register(bc, ConditionalPermissionAdmin.class, sa, null);
    Hashtable<String, Object> props = new Hashtable<>(7);
    props.clear();
    props.put(Constants.SERVICE_RANKING, Integer.MIN_VALUE);
    register(bc, Resolver.class, new ResolverImpl(new Logger(0), null), false, props);
    register(bc, DebugOptions.class, dbgOptions, null);
    if (tccl != null) {
        props.clear();
        // $NON-NLS-1$ //$NON-NLS-2$
        props.put("equinox.classloader.type", "contextClassLoader");
        register(bc, ClassLoader.class, tccl, props);
    }
    props.clear();
    // $NON-NLS-1$
    props.put("protocol", new String[] { BundleResourceHandler.OSGI_ENTRY_URL_PROTOCOL, BundleResourceHandler.OSGI_RESOURCE_URL_PROTOCOL });
    register(bc, URLConverter.class, new BundleURLConverter(), props);
    register(bc, BundleLocalization.class, new BundleLocalizationImpl(), null);
    // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    boolean setTccl = "true".equals(bundle.getEquinoxContainer().getConfiguration().getConfiguration("eclipse.parsers.setTCCL", "true"));
    try {
        // $NON-NLS-1$
        register(bc, "javax.xml.parsers.SAXParserFactory", new XMLParsingServiceFactory(true, setTccl), false, null);
        // $NON-NLS-1$
        register(bc, "javax.xml.parsers.DocumentBuilderFactory", new XMLParsingServiceFactory(false, setTccl), false, null);
    } catch (NoClassDefFoundError e) {
    // ignore; on a platform with no javax.xml (Java 8 SE compact1 profile)
    }
    bundle.getEquinoxContainer().getStorage().getExtensionInstaller().startExtensionActivators(bc);
    // Add an options listener; we already read the options on initialization.
    // Here we are just allowing the options to change
    props.clear();
    props.put(DebugOptions.LISTENER_SYMBOLICNAME, EquinoxContainer.NAME);
    register(bc, DebugOptionsListener.class, bundle.getEquinoxContainer().getConfiguration().getDebug(), props);
    register(bc, DebugOptionsListener.class, bundle.getModule().getContainer(), props);
}
Also used : ResolverImpl(org.apache.felix.resolver.ResolverImpl) Logger(org.apache.felix.resolver.Logger) EquinoxFactoryManager(org.eclipse.osgi.internal.url.EquinoxFactoryManager) SecurityAdmin(org.eclipse.osgi.internal.permadmin.SecurityAdmin) BundleURLConverter(org.eclipse.osgi.storage.url.BundleURLConverter) FrameworkDebugOptions(org.eclipse.osgi.internal.debug.FrameworkDebugOptions) BundleLocalizationImpl(org.eclipse.osgi.storage.BundleLocalizationImpl)

Aggregations

Logger (org.apache.felix.resolver.Logger)1 ResolverImpl (org.apache.felix.resolver.ResolverImpl)1 FrameworkDebugOptions (org.eclipse.osgi.internal.debug.FrameworkDebugOptions)1 SecurityAdmin (org.eclipse.osgi.internal.permadmin.SecurityAdmin)1 EquinoxFactoryManager (org.eclipse.osgi.internal.url.EquinoxFactoryManager)1 BundleLocalizationImpl (org.eclipse.osgi.storage.BundleLocalizationImpl)1 BundleURLConverter (org.eclipse.osgi.storage.url.BundleURLConverter)1