use of org.eclipse.osgi.internal.loader.BundleLoader in project rt.equinox.framework by eclipse.
the class EquinoxContainerAdaptor method invalidateWiring.
@Override
public void invalidateWiring(ModuleWiring moduleWiring, ModuleLoader current) {
if (current instanceof BundleLoader) {
BundleLoader bundleLoader = (BundleLoader) current;
bundleLoader.close();
}
long updatedTimestamp = storage.getModuleDatabase().getRevisionsTimestamp();
if (System.getSecurityManager() != null && updatedTimestamp != lastSecurityAdminFlush.getAndSet(updatedTimestamp)) {
storage.getSecurityAdmin().clearCaches();
List<Module> modules = storage.getModuleContainer().getModules();
for (Module module : modules) {
for (ModuleRevision revision : module.getRevisions().getModuleRevisions()) {
Generation generation = (Generation) revision.getRevisionInfo();
if (generation != null) {
ProtectionDomain domain = generation.getDomain();
if (domain != null) {
((BundlePermissions) domain.getPermissions()).clearPermissionCache();
}
}
}
}
}
clearManifestCache(moduleWiring);
}
use of org.eclipse.osgi.internal.loader.BundleLoader in project rt.equinox.framework by eclipse.
the class BundleContextImpl method loadBundleActivator.
private BundleActivator loadBundleActivator() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
ModuleWiring wiring = bundle.getModule().getCurrentRevision().getWiring();
if (wiring == null) {
return null;
}
BundleLoader loader = (BundleLoader) wiring.getModuleLoader();
if (loader == null) {
return null;
}
List<Capability> metadata = wiring.getRevision().getCapabilities(EquinoxModuleDataNamespace.MODULE_DATA_NAMESPACE);
if (metadata.isEmpty()) {
return null;
}
String activatorName = (String) metadata.get(0).getAttributes().get(EquinoxModuleDataNamespace.CAPABILITY_ACTIVATOR);
if (activatorName == null) {
return null;
}
Class<?> activatorClass = loader.findClass(activatorName);
return (BundleActivator) activatorClass.newInstance();
}
use of org.eclipse.osgi.internal.loader.BundleLoader in project rt.equinox.framework by eclipse.
the class DependentPolicy method loadResource.
public URL loadResource(String name) {
if (allDependents == null)
return null;
URL result = null;
// size may change, so we must check it every time
for (int i = 0; i < allDependents.size() && result == null; i++) {
ModuleWiring searchWiring = allDependents.get(i);
BundleLoader searchLoader = (BundleLoader) searchWiring.getModuleLoader();
if (searchLoader != null) {
result = searchLoader.findResource(name);
if (result == null) {
addDependent(i, searchWiring);
}
}
}
return result;
}
use of org.eclipse.osgi.internal.loader.BundleLoader in project rt.equinox.framework by eclipse.
the class DependentPolicy method loadClass.
public Class<?> loadClass(String name) {
if (allDependents == null)
return null;
Class<?> result = null;
// size may change, so we must check it every time
for (int i = 0; i < allDependents.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) {
if (result == null)
addDependent(i, searchWiring);
}
}
}
return result;
}
use of org.eclipse.osgi.internal.loader.BundleLoader in project rt.equinox.framework by eclipse.
the class PackageSource method getPackageSource.
private static PackageSource getPackageSource(Class<?> serviceClass, String pkgName, @SuppressWarnings("deprecation") PackageAdmin packageAdmin) {
if (serviceClass == null)
return null;
@SuppressWarnings("deprecation") Bundle serviceBundle = packageAdmin.getBundle(serviceClass);
if (serviceBundle == null)
return null;
BundleLoader producerBL = getBundleLoader(serviceBundle);
if (producerBL == null)
return null;
PackageSource producerSource = producerBL.getPackageSource(pkgName);
if (producerSource != null)
return producerSource;
// try the interfaces
Class<?>[] interfaces = serviceClass.getInterfaces();
// note that getInterfaces never returns null
for (int i = 0; i < interfaces.length; i++) {
producerSource = getPackageSource(interfaces[i], pkgName, packageAdmin);
if (producerSource != null)
return producerSource;
}
// try super class
return getPackageSource(serviceClass.getSuperclass(), pkgName, packageAdmin);
}
Aggregations