示例#1
0
 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;
 }
示例#2
0
 public static ImportedPackage getImportedPackage(Bundle bundle, String packageName) {
   ImportedPackage result = null;
   for (ImportedPackage importedPackage : BundleUtils.getImportedPackages(bundle)) {
     if (importedPackage.getPackageName().equals(packageName)) {
       result = importedPackage;
       break;
     }
   }
   return result;
 }
示例#3
0
 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;
 }
示例#4
0
 /**
  * Finds {@link ExportedPackage} package from the bundle manifest that satisfies the specified
  * {@link ImportedPackage}
  *
  * @param bundle Bundle to check manifest exports
  * @param importedPackage Import to check if satisfied by an export in the specified {@link
  *     Bundle}
  * @return {@link ExportedPackage} from the bundle if it exists otherwise <code>null</code>
  */
 public static ExportedPackage getExportedPackage(Bundle bundle, ImportedPackage importedPackage) {
   com.springsource.util.osgi.manifest.ExportedPackage result = null;
   final List<ExportedPackage> exportedPackages = getExportedPackages(bundle);
   for (ExportedPackage exportedPackage : exportedPackages) {
     if (exportedPackage.getPackageName().equals(importedPackage.getPackageName())) {
       if (importedPackage.getVersion().includes(exportedPackage.getVersion())) {
         result = exportedPackage;
         break;
       }
     }
   }
   return result;
 }
示例#5
0
 public static boolean isImportedPackageResolved(
     BundleContext bundleContext, Bundle bundle, ImportedPackage importedPackage) {
   boolean result = false;
   if (isBundleResolved(bundle)) {
     result =
         BundleUtils.getBundleWire(bundleContext, bundle, importedPackage.getPackageName())
             != null;
   } else {
     result = BundleUtils.findBestMatchThatSatisfiesImport(bundleContext, importedPackage) != null;
   }
   return result;
 }