Search in sources :

Example 31 with ModuleRevision

use of org.eclipse.osgi.container.ModuleRevision 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 32 with ModuleRevision

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

the class BundleLoader method toString.

/**
 * Return a string representation of this loader.
 * @return String
 */
public final String toString() {
    ModuleRevision revision = wiring.getRevision();
    String name = revision.getSymbolicName();
    if (name == null)
        // $NON-NLS-1$
        name = "unknown";
    return name + '_' + revision.getVersion();
}
Also used : ModuleRevision(org.eclipse.osgi.container.ModuleRevision)

Example 33 with ModuleRevision

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

the class ClasspathManager method loadFragments.

public synchronized void loadFragments(Collection<ModuleRevision> addedFragments) {
    List<FragmentClasspath> result = new ArrayList<>(Arrays.asList(fragments));
    for (ModuleRevision addedFragment : addedFragments) {
        Generation fragGeneration = (Generation) addedFragment.getRevisionInfo();
        String[] cp = getClassPath(addedFragment);
        ClasspathEntry[] fragEntries = buildClasspath(cp, this, fragGeneration);
        FragmentClasspath fragClasspath = new FragmentClasspath(fragGeneration, fragEntries);
        insertFragment(fragClasspath, result);
    }
    fragments = result.toArray(new FragmentClasspath[result.size()]);
}
Also used : Generation(org.eclipse.osgi.storage.BundleInfo.Generation) ArrayList(java.util.ArrayList) ModuleRevision(org.eclipse.osgi.container.ModuleRevision)

Example 34 with ModuleRevision

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

the class ClasspathManager method buildFragmentClasspaths.

private FragmentClasspath[] buildFragmentClasspaths(ModuleClassLoader hostloader, ClasspathManager manager) {
    if (hostloader == null) {
        return emptyFragments;
    }
    List<ModuleWire> fragmentWires = hostloader.getBundleLoader().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE);
    if (fragmentWires == null || fragmentWires.isEmpty()) {
        // we don't hold locks while checking the graph, just return if no longer valid
        return emptyFragments;
    }
    List<FragmentClasspath> result = new ArrayList<>(fragmentWires.size());
    for (ModuleWire fragmentWire : fragmentWires) {
        ModuleRevision revision = fragmentWire.getRequirer();
        Generation fragGeneration = (Generation) revision.getRevisionInfo();
        String[] cp = getClassPath(revision);
        ClasspathEntry[] fragEntries = buildClasspath(cp, manager, fragGeneration);
        FragmentClasspath fragClasspath = new FragmentClasspath(fragGeneration, fragEntries);
        insertFragment(fragClasspath, result);
    }
    return result.toArray(new FragmentClasspath[result.size()]);
}
Also used : Generation(org.eclipse.osgi.storage.BundleInfo.Generation) ModuleWire(org.eclipse.osgi.container.ModuleWire) ArrayList(java.util.ArrayList) ModuleRevision(org.eclipse.osgi.container.ModuleRevision)

Example 35 with ModuleRevision

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

the class PlatformAdminImpl method createSystemState.

private State createSystemState() {
    State state = factory.createState(true);
    StateConverter converter = new StateConverter(state);
    ModuleDatabase database = equinoxContainer.getStorage().getModuleDatabase();
    database.readLock();
    try {
        ModuleContainer container = equinoxContainer.getStorage().getModuleContainer();
        List<Module> modules = equinoxContainer.getStorage().getModuleContainer().getModules();
        for (Module module : modules) {
            ModuleRevision current = module.getCurrentRevision();
            BundleDescription description = converter.createDescription(current);
            state.addBundle(description);
        }
        state.setPlatformProperties(asDictionary(equinoxContainer.getConfiguration().getInitialConfig()));
        synchronizer = new PlatformBundleListener(state, converter, database, container);
        state.setResolverHookFactory(synchronizer);
        bc.addBundleListener(synchronizer);
        bc.addFrameworkListener(synchronizer);
        state.resolve();
        state.setTimeStamp(database.getRevisionsTimestamp());
    } finally {
        database.readUnlock();
    }
    return state;
}
Also used : ModuleContainer(org.eclipse.osgi.container.ModuleContainer) State(org.eclipse.osgi.service.resolver.State) BundleDescription(org.eclipse.osgi.service.resolver.BundleDescription) ModuleDatabase(org.eclipse.osgi.container.ModuleDatabase) Module(org.eclipse.osgi.container.Module) ModuleRevision(org.eclipse.osgi.container.ModuleRevision)

Aggregations

ModuleRevision (org.eclipse.osgi.container.ModuleRevision)35 Module (org.eclipse.osgi.container.Module)21 Generation (org.eclipse.osgi.storage.BundleInfo.Generation)15 ModuleWiring (org.eclipse.osgi.container.ModuleWiring)12 ArrayList (java.util.ArrayList)9 ModuleContainer (org.eclipse.osgi.container.ModuleContainer)9 ModuleWire (org.eclipse.osgi.container.ModuleWire)9 DummyContainerAdaptor (org.eclipse.osgi.tests.container.dummys.DummyContainerAdaptor)8 Test (org.junit.Test)8 BundleException (org.osgi.framework.BundleException)5 IOException (java.io.IOException)4 ModuleCapability (org.eclipse.osgi.container.ModuleCapability)4 File (java.io.File)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 SystemModule (org.eclipse.osgi.container.SystemModule)3 BundleFile (org.eclipse.osgi.storage.bundlefile.BundleFile)3 DirBundleFile (org.eclipse.osgi.storage.bundlefile.DirBundleFile)3 NestedDirBundleFile (org.eclipse.osgi.storage.bundlefile.NestedDirBundleFile)3 ZipBundleFile (org.eclipse.osgi.storage.bundlefile.ZipBundleFile)3