Package org.osmorc.manifest

Examples of org.osmorc.manifest.BundleManifest


   */
  @NotNull
  public List<ManifestHolder> whoIs(@NotNull final String bundleSymbolicName) {
    List<ManifestHolder> result = new ArrayList<ManifestHolder>();
    for (ManifestHolder manifestHolder : myManifestHolders) {
      BundleManifest bundleManifest;
      try {
        bundleManifest = manifestHolder.getBundleManifest();
      }
      catch (ManifestHolderDisposedException ignore) {
        continue;
      }
      if (bundleManifest != null) {
        if (bundleSymbolicName.equals(bundleManifest.getBundleSymbolicName())) {
          result.add(manifestHolder);
        }
      }
    }
    return result;
View Full Code Here


   */
  @Nullable
  public ManifestHolder whoIsRequiredBundle(@NotNull final String requiredBundleSpec) {
    List<ManifestHolder> candidates = new ArrayList<ManifestHolder>();
    for (ManifestHolder manifestHolder : myManifestHolders) {
      BundleManifest bundleManifest;
      try {
        bundleManifest = manifestHolder.getBundleManifest();
      }
      catch (ManifestHolderDisposedException ignore) {
        // this thing is gone
        continue;
      }

      if (bundleManifest != null) {
        if (bundleManifest.isRequiredBundle(requiredBundleSpec)) {
          candidates.add(manifestHolder);
        }
      }
    }

View Full Code Here

    Map<String, Set<ManifestHolder>> sets = new HashMap<String, Set<ManifestHolder>>();

    // first build sets of entries with the same bundle symbolic name. This will also eliminate duplicate holders.
    for (ManifestHolder holder : manifestHolders) {
      try {
        BundleManifest manifest = holder.getBundleManifest();
        if (manifest != null) {
          String bundleSymbolicName = manifest.getBundleSymbolicName();
          Set<ManifestHolder> set;
          if (sets.containsKey(bundleSymbolicName)) {
            set = sets.get(bundleSymbolicName);
          }
          else {
View Full Code Here

      if (result == null) {
        result = candidate;
        continue;
      }

      BundleManifest resultManifest;

      try {
        resultManifest = result.getBundleManifest();
        if (resultManifest == null) {
          // weird but may happen
          result = candidate; // discard result and replace it with current candidate.
          continue;
        }
      }
      catch (ManifestHolderDisposedException e) {
        // ok result is gone, replace it with the candidate
        result = candidate;
        continue;
      }

      try {
        BundleManifest bundleManifest = candidate.getBundleManifest();
        if (bundleManifest == null) {
          // weird, but may happen, discard current candidate and go on with the next one
          continue;
        }
        Version candidateVersion = bundleManifest.getBundleVersion();
        Version resultVersion = resultManifest.getBundleVersion();
        if (resultVersion.compareTo(candidateVersion) < 0) { // result version is smaller than candidate version
          result = candidate; // candidate becomes next result
        }
      }
View Full Code Here

  }

  @Override
  @NotNull
  public Set<Object> resolveDependenciesOf(@NotNull final Module module) {
    BundleManifest manifest = getManifestByObject(module);
    if (manifest == null) {
      return Collections.emptySet();
    }

    // set of all manifest holders that are dependencies
    Set<ManifestHolder> dependencyHolders = new HashSet<ManifestHolder>();

    // resolve Import-Package
    List<String> imports = manifest.getImports();
    for (String anImport : imports) {
      dependencyHolders.addAll(myBundleCache.whoProvides(anImport));
    }

    // Resolve Require-Bundle
    List<String> requiredBundles = manifest.getRequiredBundles();
    List<ManifestHolder> allRequiredBundles = new ArrayList<ManifestHolder>();
    for (String requiredBundle : requiredBundles) {
      resolveRequiredBundle(requiredBundle, allRequiredBundles);
    }
    dependencyHolders.addAll(allRequiredBundles);

    // Resolve Fragment-Hosts
    ManifestHolder manifestHolder = myBundleCache.getManifestHolder(module);
    if (manifestHolder != null) {
      dependencyHolders.addAll(myBundleCache.getFragmentHosts(manifestHolder));
    }

    // finally extract result objects from holders.
    Set<Object> result = new HashSet<Object>();
    for (ManifestHolder holder : dependencyHolders) {
      try {
        result.add(holder.getBoundObject());
      }
      catch (ManifestHolderDisposedException ignored) { }
    }

    // Resolve Bundle-ClassPath (this might contain non-osgi-bundles so we have to work on the library level here)
    List<String> entries = manifest.getBundleClassPathEntries();
    result.addAll(resolveBundleClassPath(entries));
    return result;
  }
View Full Code Here

    if (resolvedDependencies.contains(manifestHolder)) {
      // we're done here, we already resolved this dependency
      return;
    }

    BundleManifest requireBundleManifest;
    try {
      requireBundleManifest = manifestHolder.getBundleManifest();
    }
    catch (ManifestHolderDisposedException e) {
      // ok it's gone. Should rarely happen but in this case there is nothing we can do anymore.
      return;
    }

    if (requireBundleManifest != null) {
      // its kosher, so add it to the result list.
      resolvedDependencies.add(manifestHolder);

      // now determine additional dependencies
      List<String> toResolve = new ArrayList<String>();

      // -  bundles that are re-exported from the current dependency
      toResolve.addAll(requireBundleManifest.getReExportedBundles());

      // - bundles that are re-exported from any fragments
      Set<ManifestHolder> fragments = myBundleCache.getFragmentsForBundle(manifestHolder);

      // we only want the highest version of each fragment, so filter this out:
      fragments = BundleCache.getCandidatesWithHighestVersions(fragments);

      for (ManifestHolder fragment : fragments) {
        BundleManifest manifest = null;
        try {
          manifest = fragment.getBundleManifest();
        }
        catch (ManifestHolderDisposedException ignored) { }
        if (manifest != null) {
          toResolve.addAll(manifest.getReExportedBundles());
        }
      }

      // now recursively resolve these dependencies
      for (String dependencySpec : toResolve) {
View Full Code Here

TOP

Related Classes of org.osmorc.manifest.BundleManifest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.