PackageAdmin packageAdmin = (PackageAdmin) bundleContext.getService(reference);
ExportedPackage[] exportedPackages = packageAdmin.getExportedPackages(bundle);
if (exportedPackages != null) {
Set<ExportPackage> exportPackageNames = new HashSet<ExportPackage>();
for (ExportedPackage exportedPackage : exportedPackages) {
HeaderElement headerElement = nameVersionExportPackageMap.get(exportedPackage.getName() + exportedPackage.getVersion());
if (headerElement != null) {
exportPackageNames.add(new ExportPackage(headerElement.getName(), headerElement.getAttributes(), headerElement.getDirectives()));
}
}
return exportPackageNames;
}
return Collections.<ExportPackage> emptySet();