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();
}
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();
}
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()]);
}
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()]);
}
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;
}
Aggregations