Search in sources :

Example 36 with ModuleWiring

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

the class RegisteredPolicy method loadClass.

public Class<?> loadClass(String name) {
    if (allDependents == null)
        return null;
    Class<?> result = null;
    int size = allDependents.size();
    for (int i = 0; i < size && result == null; i++) {
        ModuleWiring searchWiring = allDependents.get(i);
        BundleLoader searchLoader = (BundleLoader) searchWiring.getModuleLoader();
        if (searchLoader != null) {
            try {
                result = searchLoader.findClass(name);
            } catch (ClassNotFoundException e) {
                // Nothing to do, just keep looking
                continue;
            }
        }
    }
    return result;
}
Also used : ModuleWiring(org.eclipse.osgi.container.ModuleWiring) BundleLoader(org.eclipse.osgi.internal.loader.BundleLoader)

Example 37 with ModuleWiring

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

the class RegisteredPolicy method loadResource.

public URL loadResource(String name) {
    if (allDependents == null)
        return null;
    URL result = null;
    int size = allDependents.size();
    for (int i = 0; i < size && result == null; i++) {
        ModuleWiring searchWiring = allDependents.get(i);
        BundleLoader searchLoader = (BundleLoader) searchWiring.getModuleLoader();
        if (searchLoader != null) {
            result = searchLoader.findResource(name);
        }
    }
    return result;
}
Also used : ModuleWiring(org.eclipse.osgi.container.ModuleWiring) URL(java.net.URL) BundleLoader(org.eclipse.osgi.internal.loader.BundleLoader)

Example 38 with ModuleWiring

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

the class PackageSource method getBundleLoader.

private static BundleLoader getBundleLoader(Bundle bundle) {
    ModuleRevision producer = ((EquinoxBundle) bundle).getModule().getCurrentRevision();
    ModuleWiring producerWiring = producer.getWiring();
    return producerWiring == null ? null : (BundleLoader) producerWiring.getModuleLoader();
}
Also used : ModuleWiring(org.eclipse.osgi.container.ModuleWiring) ModuleRevision(org.eclipse.osgi.container.ModuleRevision)

Example 39 with ModuleWiring

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

the class DependentPolicy method loadResources.

public Enumeration<URL> loadResources(String name) {
    if (allDependents == null)
        return null;
    Enumeration<URL> results = null;
    // size may change, so we must check it every time
    for (int i = 0; i < allDependents.size(); i++) {
        ModuleWiring searchWiring = allDependents.get(i);
        BundleLoader searchLoader = (BundleLoader) searchWiring.getModuleLoader();
        if (searchLoader != null) {
            try {
                results = BundleLoader.compoundEnumerations(results, searchLoader.findResources(name));
                addDependent(i, searchWiring);
            } catch (IOException e) {
            // Ignore and keep looking
            }
        }
    }
    return results;
}
Also used : ModuleWiring(org.eclipse.osgi.container.ModuleWiring) IOException(java.io.IOException) URL(java.net.URL) BundleLoader(org.eclipse.osgi.internal.loader.BundleLoader)

Aggregations

ModuleWiring (org.eclipse.osgi.container.ModuleWiring)39 Module (org.eclipse.osgi.container.Module)22 ModuleWire (org.eclipse.osgi.container.ModuleWire)21 ModuleContainer (org.eclipse.osgi.container.ModuleContainer)20 DummyContainerAdaptor (org.eclipse.osgi.tests.container.dummys.DummyContainerAdaptor)20 Test (org.junit.Test)20 ModuleRevision (org.eclipse.osgi.container.ModuleRevision)12 BundleLoader (org.eclipse.osgi.internal.loader.BundleLoader)8 ArrayList (java.util.ArrayList)7 ResolutionReport (org.eclipse.osgi.report.resolution.ResolutionReport)6 URL (java.net.URL)5 BundleCapability (org.osgi.framework.wiring.BundleCapability)4 HashMap (java.util.HashMap)3 ModuleCapability (org.eclipse.osgi.container.ModuleCapability)3 DummyModuleDatabase (org.eclipse.osgi.tests.container.dummys.DummyModuleDatabase)3 Bundle (org.osgi.framework.Bundle)3 BundleException (org.osgi.framework.BundleException)3 IOException (java.io.IOException)2 ModuleClassLoader (org.eclipse.osgi.internal.loader.ModuleClassLoader)2 BundleRequirement (org.osgi.framework.wiring.BundleRequirement)2