Map<ArchivePath, Node> archiveContents = archive.getContent(); for (Map.Entry<ArchivePath, Node> entry : archiveContents.entrySet()) { ArchivePath path = entry.getKey();
/** * Creates stream directly from archive. * * @param archive */ public AbstractOnDemandInputStream(final Archive<?> archive) { final Collection<Node> nodes = archive.getContent().values(); this.nodesIterator = nodes.iterator(); }
/** * Creates stream directly from archive. * * @param archive */ public AbstractOnDemandInputStream(final Archive<?> archive) { final Collection<Node> nodes = archive.getContent().values(); this.nodesIterator = nodes.iterator(); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getContent() */ @Override public Map<ArchivePath, Node> getContent() { return this.getArchive().getContent(); }
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()); } }
/** * {@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); }
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-[^/]*")); }
private Collection<Node> collectSubArchives(final Archive<?> archive) { return archive.getContent(Filters.include(WAR_AND_JAR)).values(); } }
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()); } }
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()); } }
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); }); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getContent() */ @Override public Map<ArchivePath, Node> getContent() { return this.getArchive().getContent(); }
private Collection<Node> collectSubArchives(final Archive<?> archive) { return archive.getContent(Filters.include(WAR_AND_JAR)).values(); } }
/** * {@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); }
public Map<ArchivePath, Node> getManifestFiles(Archive<?> archive) { return archive.getContent(Filters.include("/META-INF/MANIFEST\\.MF")); } }
private Collection<Node> getPersistenceDescriptors(final Archive<?> archive) { return archive.getContent(Filters.include(".*persistence.xml")).values(); }
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; }
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; }
@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; }
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"); } } } }