Package org.osmorc.manifest

Examples of org.osmorc.manifest.BundleManifest


    assertThat(providerManifest1.isRequiredBundle(requiredBundles.get(0)), is(false));
    assertThat(providerManifest2.isRequiredBundle(requiredBundles.get(0)), is(true));
  }

  public void testMultipleRequirements() {
    BundleManifest requestorManifest = getManifest(Manifest6);

    List<String> requiredBundles = requestorManifest.getRequiredBundles();
    assertThat(requiredBundles.size(), is(3));
    assertThat(requiredBundles.get(0), equalTo("foo.bar;bundle-version=\"(2.0.0, 2.5.0]\""));
    assertThat(requiredBundles.get(1), equalTo("foo.bam"));
    assertThat(requiredBundles.get(2), equalTo("foo.baz;bundle-version=10.0.5"));
  }
View Full Code Here


    assertThat(requiredBundles.get(1), equalTo("foo.bam"));
    assertThat(requiredBundles.get(2), equalTo("foo.baz;bundle-version=10.0.5"));
  }

  public void testReexport() {
    BundleManifest providerManifest = getManifest(Manifest2);
    BundleManifest requestorManifest1 = getManifest(Manifest5);
    BundleManifest requestorManifest2 = getManifest(Manifest7);

    assertThat(requestorManifest1.reExportsBundle(providerManifest), is(false));
    assertThat(requestorManifest2.reExportsBundle(providerManifest), is(true));
  }
View Full Code Here

    assertThat(requestorManifest1.reExportsBundle(providerManifest), is(false));
    assertThat(requestorManifest2.reExportsBundle(providerManifest), is(true));
  }

  public void testFragmentBundles() {
    BundleManifest potentialHost1 = getManifest(Manifest1);
    BundleManifest potentialHost2 = getManifest(Manifest2);
    BundleManifest fragment = getManifest(Manifest8);

    assertThat(fragment.isFragmentBundle(), is(true));
    assertThat(potentialHost1.isFragmentBundle(), is(false));
    assertThat(potentialHost2.isFragmentBundle(), is(false));
    assertThat(potentialHost1.isFragmentHostFor(fragment), is(false));
    assertThat(potentialHost2.isFragmentHostFor(fragment), is(true));
  }
View Full Code Here

    assertThat(potentialHost1.isFragmentHostFor(fragment), is(false));
    assertThat(potentialHost2.isFragmentHostFor(fragment), is(true));
  }

  public void testImports() {
    BundleManifest manifest = getManifest(Manifest9);
    assertThat(manifest.isPackageImported("foo.bar.baz"), is(true));
    assertThat(manifest.isPackageImported("foo.bar.split_name"), is(true));
    assertThat(manifest.isPackageImported("foo.bar.bam"), is(false));
    assertThat(manifest.isPackageImported("foo.bar"), is(false));
  }
View Full Code Here

              if (className != null) {
                LocalQuickFix fix = null;

                OsmorcFacetConfiguration configuration = facet.getConfiguration();
                if (configuration.isManifestManuallyEdited()) {
                  BundleManifest manifest = BundleManager.getInstance(project).getManifestByObject(facet.getModule());
                  if (manifest == null || !className.equals(manifest.getBundleActivator())) {
                    fix = new RegisterInManifestQuickfix(className);
                  }
                }
                else {
                  if (!className.equals(configuration.getBundleActivator())) {
View Full Code Here

  @Nullable
  protected ManifestFile getVerifiedManifestFile(@NotNull PsiElement element) {
    Module module = ModuleUtilCore.findModuleForPsiElement(element);
    assert module != null : element;

    BundleManifest manifest = BundleManager.getInstance(element.getProject()).getManifestByObject(module);
    if (manifest == null) {
      String message = OsmorcBundle.message("inspection.fix.no.manifest");
      Notifications.Bus.notify(new Notification("osmorc", getFamilyName(), message, NotificationType.WARNING));
      return null;
    }

    ManifestFile manifestFile = manifest.getManifestFile();
    if (!CommonRefactoringUtil.checkReadOnlyStatus(manifestFile)) {
      return null;
    }

    return manifestFile;
View Full Code Here

    List<OrderEntry> entries = index.getOrderEntriesForFile(targetFile.getVirtualFile());
    OrderEntry entry = !entries.isEmpty() ? entries.get(0) : null;
    if (entry instanceof ModuleOrderEntry) {
      Module module = ((ModuleOrderEntry)entry).getModule();
      if (module != null) {
        BundleManifest manifest = bundleManager.getManifestByObject(module);
        exportedPackage = manifest != null ? manifest.getExportedPackage(packageName) : null;
      }
    }
    else if (entry instanceof LibraryOrderEntry) {
      Library library = ((LibraryOrderEntry)entry).getLibrary();
      if (library != null) {
        BundleManifest manifest = bundleManager.getManifestByObject(library);
        exportedPackage = manifest != null ? manifest.getExportedPackage(packageName) : null;
      }
    }
    else if (entry instanceof JdkOrderEntry) {
      exportedPackage = packageName;
    }
    if (exportedPackage == null) {
      return NOT_EXPORTED;
    }

    if (!facet.getConfiguration().isManifestManuallyEdited()) {
      return null;
    }

    BundleManifest manifest = bundleManager.getManifestByObject(requestorModule);
    if (manifest != null) {
      // Imported packages
      if (manifest.isPackageImported(packageName)) {
        return null;
      }

      // Required bundles
      for (String bundleSpec : manifest.getRequiredBundles()) {
        BundleManifest bundle = bundleManager.getManifestByBundleSpec(bundleSpec);
        if (bundle != null && bundle.getExportedPackage(packageName) != null) {
          return null;
        }
      }

      // Attached fragments [AFAIK these should not be linked statically - r.sh]
View Full Code Here

   */
  @NotNull
  public Set<ManifestHolder> whoProvides(@NotNull final String packageSpec) {
    Set<ManifestHolder> result = new HashSet<ManifestHolder>();
    for (ManifestHolder manifestHolder : myManifestHolders) {
      BundleManifest bundleManifest;
      try {
        bundleManifest = manifestHolder.getBundleManifest();
      }
      catch (ManifestHolderDisposedException ignore) {
        // ok this thing is gone
        continue;
      }
      if (bundleManifest != null) {
        if (bundleManifest.isPackageExported(packageSpec)) {
          result.add(manifestHolder);
        }
      }
    }
    return result;
View Full Code Here

   * @return a set of matching manifest holders. If there are no fragments known, returns an empty set.
   */
  @NotNull
  public Set<ManifestHolder> getFragmentsForBundle(@NotNull ManifestHolder bundle) {
    try {
      BundleManifest bundleManifest = bundle.getBundleManifest();
      // if it has no manifest, we can short cut here
      if (bundleManifest == null) {
        return Collections.emptySet();
      }

      Set<ManifestHolder> result = new HashSet<ManifestHolder>();
      for (ManifestHolder manifestHolder : myManifestHolders) {
        try {
          BundleManifest potentialFragmentManifest = manifestHolder.getBundleManifest();
          if (potentialFragmentManifest == null) {
            continue;
          }
          if (bundleManifest.isFragmentHostFor(potentialFragmentManifest)) {
            result.add(manifestHolder);
View Full Code Here

   * @return a set of fragment hosts. returns an empty set if no hosts could be found or if the given manifest holder does not represent a fragment bundle.
   */
  @NotNull
  public Set<ManifestHolder> getFragmentHosts(@NotNull ManifestHolder fragment) {
    try {
      BundleManifest fragmentManifest = fragment.getBundleManifest();
      // if its not a fragment or has no manifest, we can short cut here
      if (fragmentManifest == null || !fragmentManifest.isFragmentBundle()) {
        return Collections.emptySet();
      }

      Set<ManifestHolder> result = new HashSet<ManifestHolder>();
      for (ManifestHolder manifestHolder : myManifestHolders) {
        try {
          BundleManifest potentialHostManifest = manifestHolder.getBundleManifest();
          if (potentialHostManifest == null) {
            continue;
          }
          if (potentialHostManifest.isFragmentHostFor(fragmentManifest)) {
            result.add(manifestHolder);
          }
        }
        catch (ManifestHolderDisposedException ignore) {
          // ignore.
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.