public SortedMap<String, PackageVersion> getExports() {
Bundle[] bundles = bundleContext.getBundles();
SortedMap<String, PackageVersion> packageVersionMap = new TreeMap<String, PackageVersion>();
for (Bundle bundle : bundles) {
BundleRevision rev = bundle.adapt(BundleRevision.class);
if (rev != null) {
List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
for (BundleCapability cap : caps) {
Map<String, Object> attr = cap.getAttributes();
String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
Version version = (Version)attr.get("version");
String key = packageName + ":" + version.toString();