public static List<ExportedPackage> getExportedPackages(Bundle bundle) { final List<ExportedPackage> result = new ArrayList<ExportedPackage>(); final BundleManifest manifest = BundleManifestFactory.createBundleManifest(bundle.getHeaders(), new DummyParserLogger()); for (ExportedPackage exportedPackage : manifest.getExportPackage().getExportedPackages()) { result.add(exportedPackage); } return result; }
public static List<ImportedPackage> getImportedPackages(Bundle bundle, Resolution resolution) { final List<ImportedPackage> result = new ArrayList<ImportedPackage>(); final BundleManifest manifest = BundleManifestFactory.createBundleManifest(bundle.getHeaders(), new DummyParserLogger()); for (ImportedPackage importedPackage : manifest.getImportPackage().getImportedPackages()) { if (resolution == null || resolution.equals(importedPackage.getResolution())) { result.add(importedPackage); } } return result; }
public static ImportedPackage getImportedPackage(BundleManifest manifest, String packageName) { ImportedPackage result = null; for (ImportedPackage importedPackage : manifest.getImportPackage().getImportedPackages()) { if (importedPackage.getPackageName().equals(packageName)) { result = importedPackage; break; } } return result; }
public static boolean isWebBundle(BundleManifest manifest) { return manifest.getHeader("Web-ContextPath") != null; }