Пример #1
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;
 }
Пример #2
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;
 }
Пример #3
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;
 }
Пример #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;
 }