use of org.eclipse.osgi.container.ModuleCapability in project rt.equinox.framework by eclipse.
the class PackageAdminImpl method getExportedPackages.
public ExportedPackage[] getExportedPackages(Bundle bundle) {
if (bundle == null) {
return getExportedPackages((String) null);
}
Module module = StartLevelImpl.getModule(bundle);
Collection<ModuleRevision> revisions = module == null ? Collections.<ModuleRevision>emptyList() : module.getRevisions().getModuleRevisions();
Collection<ExportedPackage> allExports = new ArrayList<>();
for (ModuleRevision revision : revisions) {
ModuleWiring wiring = revision.getWiring();
if (wiring != null) {
List<ModuleCapability> providedPackages = wiring.getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE);
if (providedPackages != null) {
for (ModuleCapability providedPackage : providedPackages) {
allExports.add(new ExportedPackageImpl(providedPackage, wiring));
}
}
}
}
return allExports.isEmpty() ? null : allExports.toArray(new ExportedPackage[allExports.size()]);
}
Aggregations