Search in sources :

Example 1 with ModuleLoader

use of org.eclipse.osgi.container.ModuleLoader in project rt.equinox.framework by eclipse.

the class EquinoxBundle method getModuleClassLoader.

private ModuleClassLoader getModuleClassLoader(boolean logResolveError) {
    ResolutionReport report = resolve();
    if (logResolveError && !Module.RESOLVED_SET.contains(module.getState())) {
        String reportMessage = report.getResolutionReportMessage(module.getCurrentRevision());
        equinoxContainer.getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, this, new BundleException(reportMessage, BundleException.RESOLVE_ERROR));
    }
    return AccessController.doPrivileged(new PrivilegedAction<ModuleClassLoader>() {

        @Override
        public ModuleClassLoader run() {
            ModuleWiring wiring = getModule().getCurrentRevision().getWiring();
            if (wiring != null) {
                ModuleLoader moduleLoader = wiring.getModuleLoader();
                if (moduleLoader instanceof BundleLoader) {
                    return ((BundleLoader) moduleLoader).getModuleClassLoader();
                }
            }
            return null;
        }
    });
}
Also used : ModuleLoader(org.eclipse.osgi.container.ModuleLoader) ModuleClassLoader(org.eclipse.osgi.internal.loader.ModuleClassLoader) ModuleWiring(org.eclipse.osgi.container.ModuleWiring) BundleException(org.osgi.framework.BundleException) ResolutionReport(org.eclipse.osgi.report.resolution.ResolutionReport) BundleLoader(org.eclipse.osgi.internal.loader.BundleLoader)

Aggregations

ModuleLoader (org.eclipse.osgi.container.ModuleLoader)1 ModuleWiring (org.eclipse.osgi.container.ModuleWiring)1 BundleLoader (org.eclipse.osgi.internal.loader.BundleLoader)1 ModuleClassLoader (org.eclipse.osgi.internal.loader.ModuleClassLoader)1 ResolutionReport (org.eclipse.osgi.report.resolution.ResolutionReport)1 BundleException (org.osgi.framework.BundleException)1