Package org.osmorc.manifest

Examples of org.osmorc.manifest.ManifestHolder


    assertThat(fragmentHosts.size(), is(1));
    assertThat(getManifest(fragmentHosts.iterator().next()).getBundleSymbolicName(), equalTo("foo.bar"));
  }

  public void testRequiredBundleWithVersion() throws ManifestHolderDisposedException {
    ManifestHolder manifestHolder = myCache.whoIsRequiredBundle("foo.bam;bundle-version=1.2.0");
    assertThat(manifestHolder, notNullValue());
    BundleManifest bundleManifest = getManifest(manifestHolder);
    assertThat(bundleManifest.getBundleSymbolicName(), equalTo("foo.bam"));

    // should pick largest available version
View Full Code Here


    // should pick largest available version
    assertThat(bundleManifest.getBundleVersion().toString(), equalTo("1.2.3"));
  }

  public void testRequiredBundleWithVersionRange() throws ManifestHolderDisposedException {
    ManifestHolder manifestHolder = myCache.whoIsRequiredBundle("foo.bam;bundle-version=\"[1.2.0,1.2.3)\"");
    assertThat(manifestHolder, notNullValue());
    BundleManifest bundleManifest = getManifest(manifestHolder);
    assertThat(bundleManifest.getBundleSymbolicName(), equalTo("foo.bam"));
    // 1.2.3 is not allowed by version range.
    assertThat(bundleManifest.getBundleVersion().toString(), equalTo("1.2.0"));
View Full Code Here

    // 1.2.3 is not allowed by version range.
    assertThat(bundleManifest.getBundleVersion().toString(), equalTo("1.2.0"));
  }

  public void testRequiredBundleWithoutVersion() throws ManifestHolderDisposedException {
    ManifestHolder manifestHolder = myCache.whoIsRequiredBundle("foo.bam");
    assertThat(manifestHolder, notNullValue());
    BundleManifest bundleManifest = getManifest(manifestHolder);
    assertThat(bundleManifest.getBundleSymbolicName(), equalTo("foo.bam"));

    // should pick largest available version
View Full Code Here

      return result;
    }
    VirtualFile[] classRoots = library.getFiles(OrderRootType.CLASSES);
    for (VirtualFile classRoot : classRoots) {
      String jarFileUrl = classRoot.getUrl();
      ManifestHolder cachedHolder = myHolderCache.get(jarFileUrl);
      if (cachedHolder != null) {
        result.add(cachedHolder);
        continue;
      }
      VirtualFile classDir;
View Full Code Here

        // its gone, ignore it
      }
    }
    Set<ManifestHolder> result = new HashSet<ManifestHolder>();
    for (Set<ManifestHolder> holders : sets.values()) {
      ManifestHolder candidateWithHighestVersion = getCandidateWithHighestVersion(holders);
      if (candidateWithHighestVersion != null) {
        result.add(candidateWithHighestVersion);
      }
    }
View Full Code Here

    if (candidates.size() == 1) {
      return candidates.iterator().next();
    }

    ManifestHolder result = null;
    for (ManifestHolder candidate : candidates) {
      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;
        }
View Full Code Here

      return; // don't work on modules outside of the current project.
    }

    // if the module has an osmorc facet, treat it as a bundle and add it to the cache
    if (OsmorcFacet.hasOsmorcFacet(module)) {
      ManifestHolder manifestHolder = myManifestHolderRegistry.getManifestHolder(module);
      myBundleCache.updateWith(manifestHolder);

      CommonProcessors.CollectProcessor<Library> collector = new CommonProcessors.CollectProcessor<Library>();
      OrderEnumerator.orderEntries(module).forEachLibrary(collector);
      reindex(collector.getResults());
View Full Code Here

      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.
View Full Code Here

   * @param requireBundleSpec    the spec to resolve
   * @param resolvedDependencies the resolved dependencies.
   */
  private void resolveRequiredBundle(@NotNull String requireBundleSpec, @NotNull List<ManifestHolder> resolvedDependencies) {
    // first get the manifest holder of the required bundle
    ManifestHolder manifestHolder = myBundleCache.whoIsRequiredBundle(requireBundleSpec);

    if (manifestHolder == null) {
      // unresolvable, may happen if the user misses some dependencies.
      return;
    }

    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;
    }
View Full Code Here

  }

  @Nullable
  @Override
  public BundleManifest getManifestByObject(@NotNull Object object) {
    ManifestHolder manifestHolder = myBundleCache.getManifestHolder(object);
    if (manifestHolder != null) {
      try {
        return manifestHolder.getBundleManifest();
      }
      catch (ManifestHolderDisposedException ignore) { }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.osmorc.manifest.ManifestHolder

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.