org.jboss.shrinkwrap.api.Archive.getContent()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.jboss.shrinkwrap.api.Archive.getContent()方法的一些代码示例,展示了Archive.getContent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Archive.getContent()方法的具体详情如下:
包路径:org.jboss.shrinkwrap.api.Archive
类名称:Archive
方法名:getContent

Archive.getContent介绍

[英]Obtains all assets in this archive, along with their respective paths. The returned Map will be an immutable view.
[中]获取此存档中的所有资产及其各自的路径。返回的映射将是一个不可变的视图。

代码示例

代码示例来源:origin: oracle/helidon

Map<ArchivePath, Node> archiveContents = archive.getContent();
for (Map.Entry<ArchivePath, Node> entry : archiveContents.entrySet()) {
  ArchivePath path = entry.getKey();

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * Creates stream directly from archive.
 *
 * @param archive
 */
public AbstractOnDemandInputStream(final Archive<?> archive) {
  final Collection<Node> nodes = archive.getContent().values();
  this.nodesIterator = nodes.iterator();
}

代码示例来源:origin: shrinkwrap/shrinkwrap

/**
 * Creates stream directly from archive.
 *
 * @param archive
 */
public AbstractOnDemandInputStream(final Archive<?> archive) {
  final Collection<Node> nodes = archive.getContent().values();
  this.nodesIterator = nodes.iterator();
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#getContent()
 */
@Override
public Map<ArchivePath, Node> getContent() {
  return this.getArchive().getContent();
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

protected ZipExporterDelegate(final Archive<?> archive) {
  super(archive);
  compressed = true;
  // Precondition check
  if (archive.getContent().isEmpty()) {
    throw new IllegalArgumentException(
      "[SHRINKWRAP-93] Cannot use this JDK-based implementation to export as ZIP an archive with no content: "
        + archive.toString());
  }
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#getContent(org.jboss.shrinkwrap.api.Filter)
 */
@Override
public Map<ArchivePath, Node> getContent(Filter<ArchivePath> filter) {
  return this.getArchive().getContent(filter);
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-jacoco

public Map<ArchivePath, Node> getSignatureFiles(Archive<?> archive) {
  return archive.getContent(//
    // This is adapted from Jacoco SignatureRemover
    Filters.include("/META-INF/[^/]*\\.SF|" //
      + "/META-INF/[^/]*\\.DSA|" //
      + "/META-INF/[^/]*\\.RSA|" //
      + "/META-INF/SIG-[^/]*"));
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-persistence-core

private Collection<Node> collectSubArchives(final Archive<?> archive)
  {
   return archive.getContent(Filters.include(WAR_AND_JAR)).values();
  }
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

protected ZipExporterDelegate(final Archive<?> archive, final boolean compressed) {
  super(archive);
  this.compressed = compressed;
  // Precondition check
  if (archive.getContent().isEmpty()) {
    throw new IllegalArgumentException(
        "[SHRINKWRAP-93] Cannot use this JDK-based implementation to export as ZIP an archive with no content: "
            + archive.toString());
  }
}

代码示例来源:origin: shrinkwrap/shrinkwrap

protected ZipExporterDelegate(final Archive<?> archive) {
  super(archive);
  compressed = true;
  // Precondition check
  if (archive.getContent().isEmpty()) {
    throw new IllegalArgumentException(
      "[SHRINKWRAP-93] Cannot use this JDK-based implementation to export as ZIP an archive with no content: "
        + archive.toString());
  }
}

代码示例来源:origin: io.thorntail/arquillian-daemon

private void findServiceDescriptors(final Archive<?> archive, final Map<ArchivePath, List<Node>> descs) {
  archive.getContent(path -> path.get().startsWith("/META-INF/services/"))
      .forEach((path, node) -> {
        List<Node> nodes = descs.get(path);
        if (nodes == null) {
          nodes = new ArrayList<>();
          descs.put(path, nodes);
        }
        nodes.add(node);
      });
}

代码示例来源:origin: shrinkwrap/shrinkwrap

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#getContent()
 */
@Override
public Map<ArchivePath, Node> getContent() {
  return this.getArchive().getContent();
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-persistence-impl

private Collection<Node> collectSubArchives(final Archive<?> archive)
  {
   return archive.getContent(Filters.include(WAR_AND_JAR)).values();
  }
}

代码示例来源:origin: shrinkwrap/shrinkwrap

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#getContent(org.jboss.shrinkwrap.api.Filter)
 */
@Override
public Map<ArchivePath, Node> getContent(Filter<ArchivePath> filter) {
  return this.getArchive().getContent(filter);
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-jacoco

public Map<ArchivePath, Node> getManifestFiles(Archive<?> archive) {
    return archive.getContent(Filters.include("/META-INF/MANIFEST\\.MF"));
  }
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-persistence-impl

private Collection<Node> getPersistenceDescriptors(final Archive<?> archive)
{
 return archive.getContent(Filters.include(".*persistence.xml")).values();
}

代码示例来源:origin: io.thorntail/jaxrs

private static boolean hasApplicationPathAnnotation(Archive<?> archive) {
  Map<ArchivePath, Node> content = archive.getContent();
  for (Map.Entry<ArchivePath, Node> entry : content.entrySet()) {
    Node node = entry.getValue();
    Asset asset = node.getAsset();
    if (hasApplicationPathAnnotation(node.getPath(), asset)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: io.thorntail/jaxrs

public static boolean isJAXRS(Archive<?> archive) {
  Map<ArchivePath, Node> content = archive.getContent();
  for (Map.Entry<ArchivePath, Node> entry : content.entrySet()) {
    Node node = entry.getValue();
    Asset asset = node.getAsset();
    if (isJAXRS(node.getPath(), asset)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm

@Override
protected Archive<?> filter(Archive<?> archive) {
  final Set<ArtifactSpec> moduleSpecs = dependencyManager.getModuleDependencies();
  final Set<ArtifactSpec> nonSwarmSpecs = dependencyManager.getNonSwarmDependencies();
  archive.getContent().values().stream()
      .filter(node -> node.getPath().get().startsWith(WEB_INF_LIB))
      .filter(node -> !nodeIsInArtifactList(node, nonSwarmSpecs, false)
          && (nodeIsInArtifactList(node, moduleSpecs, true)
          || nodeIsSwarmArtifact(node)))
      .forEach(node -> archive.delete(node.getPath()));
  return archive;
}

代码示例来源:origin: cukespace/cukespace

private void enrichWithCDI(Archive<?> applicationArchive) {
    Map<ArchivePath, Node> contentMap = applicationArchive.getContent(Filters.include(".*/cukespace-core.jar"));
    for (Node node : contentMap.values()) {
      if (node.getAsset() instanceof ArchiveAsset) {
        JavaArchive archive = (JavaArchive) ((ArchiveAsset) node.getAsset()).getArchive();

        archive.addClass(CukeSpaceCDIObjectFactory.class);
        archive.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
      }
    }
  }
}

相关文章