use of org.eclipse.osgi.container.ModuleWire in project rt.equinox.framework by eclipse.
the class FrameworkExtensionInstaller method startExtensionActivators.
public void startExtensionActivators(BundleContext context) {
// First start the hook registry activators
// TODO not sure we really need these anymore
HookRegistry hookRegistry = configuration.getHookRegistry();
List<ActivatorHookFactory> activatorHookFactories = hookRegistry.getActivatorHookFactories();
for (ActivatorHookFactory activatorFactory : activatorHookFactories) {
BundleActivator activator = activatorFactory.createActivator();
try {
startActivator(activator, context, null);
} catch (Exception e) {
configuration.getHookRegistry().getContainer().getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, null, e);
}
}
// start the extension bundle activators. In Equinox we let
// framework extensions define Bundle-Activator headers.
ModuleWiring systemWiring = (ModuleWiring) context.getBundle().adapt(BundleWiring.class);
if (systemWiring != null) {
List<ModuleWire> extensionWires = systemWiring.getProvidedModuleWires(HostNamespace.HOST_NAMESPACE);
for (ModuleWire extensionWire : extensionWires) {
ModuleRevision extensionRevision = extensionWire.getRequirer();
startExtensionActivator(extensionRevision, context);
}
}
}
use of org.eclipse.osgi.container.ModuleWire in project rt.equinox.framework by eclipse.
the class ManifestLocalization method findResource.
private URL findResource(String resource) {
ModuleWiring searchWiring = generation.getRevision().getWiring();
if (searchWiring != null) {
if ((generation.getRevision().getTypes() & BundleRevision.TYPE_FRAGMENT) != 0) {
List<ModuleWire> hostWires = searchWiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE);
searchWiring = null;
Long lowestHost = Long.MAX_VALUE;
if (hostWires != null) {
// search for the host with the highest ID
for (ModuleWire hostWire : hostWires) {
Long hostID = hostWire.getProvider().getRevisions().getModule().getId();
if (hostID.compareTo(lowestHost) <= 0) {
lowestHost = hostID;
searchWiring = hostWire.getProviderWiring();
}
}
}
}
}
if (searchWiring != null) {
int lastSlash = resource.lastIndexOf('/');
// $NON-NLS-1$
String path = lastSlash > 0 ? resource.substring(0, lastSlash) : "/";
String fileName = lastSlash != -1 ? resource.substring(lastSlash + 1) : resource;
List<URL> result = searchWiring.findEntries(path, fileName, 0);
return (result == null || result.isEmpty()) ? null : result.get(0);
}
// search the raw bundle file for the generation
return generation.getEntry(resource);
}
use of org.eclipse.osgi.container.ModuleWire in project rt.equinox.framework by eclipse.
the class EquinoxBundle method getGenerations.
List<Generation> getGenerations() {
List<Generation> result = new ArrayList<>();
ModuleRevision current = getModule().getCurrentRevision();
result.add((Generation) current.getRevisionInfo());
ModuleWiring wiring = current.getWiring();
if (wiring != null) {
List<ModuleWire> hostWires = wiring.getProvidedModuleWires(HostNamespace.HOST_NAMESPACE);
if (hostWires != null) {
for (ModuleWire hostWire : hostWires) {
result.add((Generation) hostWire.getRequirer().getRevisionInfo());
}
}
}
return result;
}
use of org.eclipse.osgi.container.ModuleWire in project rt.equinox.framework by eclipse.
the class BundleLoader method clearManifestLocalizationCache.
protected void clearManifestLocalizationCache() {
Generation hostGen = (Generation) wiring.getRevision().getRevisionInfo();
hostGen.clearManifestCache();
List<ModuleWire> hostWires = wiring.getProvidedModuleWires(HostNamespace.HOST_NAMESPACE);
// doing a null check because there is no lock on the module database here
if (hostWires != null) {
for (ModuleWire fragmentWire : hostWires) {
Generation fragGen = (Generation) fragmentWire.getRequirer().getRevisionInfo();
fragGen.clearManifestCache();
}
}
}
use of org.eclipse.osgi.container.ModuleWire 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()]);
}
Aggregations