use of org.eclipse.osgi.container.ModuleRevision 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.container.ModuleRevision in project rt.equinox.framework by eclipse.
the class PackageAdminImpl method getWiring.
private ModuleWiring getWiring(Bundle bundle) {
Module module = StartLevelImpl.getModule(bundle);
if (module == null) {
return null;
}
List<ModuleRevision> revisions = module.getRevisions().getModuleRevisions();
if (revisions.isEmpty()) {
return null;
}
return revisions.get(0).getWiring();
}
use of org.eclipse.osgi.container.ModuleRevision in project rt.equinox.framework by eclipse.
the class BundleLoader method findDynamicSource.
private PackageSource findDynamicSource(String pkgName) {
if (!isExportedPackage(pkgName) && isDynamicallyImported(pkgName)) {
if (debug.DEBUG_LOADER) {
// $NON-NLS-1$ //$NON-NLS-2$
Debug.println("BundleLoader[" + this + "] attempting to resolve dynamic package: " + pkgName);
}
ModuleRevision revision = wiring.getRevision();
ModuleWire dynamicWire = revision.getRevisions().getModule().getContainer().resolveDynamic(pkgName, revision);
if (dynamicWire != null) {
PackageSource source = createExportPackageSource(dynamicWire, null);
if (debug.DEBUG_LOADER) {
// $NON-NLS-1$ //$NON-NLS-2$
Debug.println("BundleLoader[" + this + "] using dynamic import source: " + source);
}
synchronized (importedSources) {
importedSources.add(source);
}
return source;
}
}
return null;
}
use of org.eclipse.osgi.container.ModuleRevision in project rt.equinox.framework by eclipse.
the class ServiceRegistry method hasListenServicePermission.
/**
* Check for permission to listen to a service.
*/
static boolean hasListenServicePermission(ServiceEvent event, BundleContextImpl context) {
ModuleRevision revision = context.getBundleImpl().getModule().getCurrentRevision();
if (revision == null) {
return false;
}
ProtectionDomain domain = ((Generation) revision.getRevisionInfo()).getDomain();
if (domain == null) {
return true;
}
return domain.implies(new ServicePermission(event.getServiceReference(), ServicePermission.GET));
}
use of org.eclipse.osgi.container.ModuleRevision in project rt.equinox.framework by eclipse.
the class BundleLocalizationImpl method getLocalization.
/**
* The getLocalization method gets a ResourceBundle object for the given
* locale and bundle.
*
* @return A <code>ResourceBundle</code> object for the given bundle and locale.
* If null is passed for the locale parameter, the default locale is used.
*/
public ResourceBundle getLocalization(Bundle bundle, String locale) {
Module m = ((EquinoxBundle) bundle).getModule();
ModuleRevision r = m.getCurrentRevision();
Generation g = (Generation) r.getRevisionInfo();
return g.getResourceBundle(locale);
}
Aggregations