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

x33g5p2x  于2022-01-24 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(152)

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

Node.getPath介绍

暂无

代码示例

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

  1. String p = n.getPath().get();
  2. if (callback != null) {
  3. callback.accept(p);

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

  1. @Override
  2. public boolean equals(Object obj) {
  3. if (obj instanceof Node) {
  4. Node node = (Node) obj;
  5. if (path.equals(node.getPath())) {
  6. return true;
  7. }
  8. }
  9. return false;
  10. }

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

  1. @Override
  2. public boolean equals(Object obj) {
  3. if (obj instanceof Node) {
  4. Node node = (Node) obj;
  5. if (path.equals(node.getPath())) {
  6. return true;
  7. }
  8. }
  9. return false;
  10. }

代码示例来源:origin: org.agiso.tempel/tempel-support-test

  1. private ITemplateSourceEntry addJarEntry(Map<String, ITemplateSourceEntry> entries, Node jarEntry) {
  2. String name = jarEntry.getPath().get().substring(basePathLength);
  3. if(name.isEmpty()) {
  4. name = "/";
  5. }
  6. ITemplateSourceEntry entry = new JarTemplateSourceEntry(name, jarEntry);
  7. entries.put(name, entry);
  8. return entry;
  9. }

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

  1. protected void filter(Set<ArchivePath> remove, Node node, ResolvedDependencies resolvedDependencies) {
  2. String path = node.getPath().get();
  3. if (path.startsWith("/WEB-INF/lib") && path.endsWith(".jar")) {
  4. if (path.contains("thorntail-runner")) {
  5. remove.add(node.getPath());
  6. }
  7. if (resolvedDependencies.isRemovable(node)) {
  8. remove.add(node.getPath());
  9. }
  10. }
  11. for (Node each : node.getChildren()) {
  12. filter(remove, each, resolvedDependencies);
  13. }
  14. }
  15. }

代码示例来源:origin: org.wildfly.swarm/tools

  1. protected void filter(Set<ArchivePath> remove, Node node, ResolvedDependencies resolvedDependencies) {
  2. String path = node.getPath().get();
  3. if (path.startsWith("/WEB-INF/lib") && path.endsWith(".jar")) {
  4. if (resolvedDependencies.isRemovable(node)) {
  5. remove.add(node.getPath());
  6. }
  7. }
  8. for (Node each : node.getChildren()) {
  9. filter(remove, each, resolvedDependencies);
  10. }
  11. }
  12. }

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

  1. private static boolean hasApplicationPathAnnotation(Archive<?> archive) {
  2. Map<ArchivePath, Node> content = archive.getContent();
  3. for (Map.Entry<ArchivePath, Node> entry : content.entrySet()) {
  4. Node node = entry.getValue();
  5. Asset asset = node.getAsset();
  6. if (hasApplicationPathAnnotation(node.getPath(), asset)) {
  7. return true;
  8. }
  9. }
  10. return false;
  11. }

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

  1. public static boolean isJAXRS(Archive<?> archive) {
  2. Map<ArchivePath, Node> content = archive.getContent();
  3. for (Map.Entry<ArchivePath, Node> entry : content.entrySet()) {
  4. Node node = entry.getValue();
  5. Asset asset = node.getAsset();
  6. if (isJAXRS(node.getPath(), asset)) {
  7. return true;
  8. }
  9. }
  10. return false;
  11. }

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

  1. private void format(StringBuilder sb, Node node) {
  2. sb.append(node.getPath().get());
  3. if (node.getAsset() == null) {
  4. sb.append(FormattingConstants.SLASH);
  5. }
  6. sb.append(FormattingConstants.NEWLINE);
  7. for (Node child : node.getChildren()) {
  8. format(sb, child);
  9. }
  10. }

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

  1. private void format(StringBuilder sb, Node node) {
  2. sb.append(node.getPath().get());
  3. if (node.getAsset() == null) {
  4. sb.append(FormattingConstants.SLASH);
  5. }
  6. sb.append(FormattingConstants.NEWLINE);
  7. for (Node child : node.getChildren()) {
  8. format(sb, child);
  9. }
  10. }

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

  1. @Override
  2. protected Archive<?> filter(Archive<?> archive) {
  3. final Set<ArtifactSpec> moduleSpecs = dependencyManager.getModuleDependencies();
  4. final Set<ArtifactSpec> nonSwarmSpecs = dependencyManager.getNonSwarmDependencies();
  5. archive.getContent().values().stream()
  6. .filter(node -> node.getPath().get().startsWith(WEB_INF_LIB))
  7. .filter(node -> !nodeIsInArtifactList(node, nonSwarmSpecs, false)
  8. && (nodeIsInArtifactList(node, moduleSpecs, true)
  9. || nodeIsSwarmArtifact(node)))
  10. .forEach(node -> archive.delete(node.getPath()));
  11. return archive;
  12. }

代码示例来源:origin: org.arquillian.algeron/arquillian-algeron-provider-maven-retriever

  1. private void unpack(File destination, JavaArchive file) throws IOException {
  2. final Node rootDir = file.get("/");
  3. final Set<Node> contractFiles = rootDir.getChildren();
  4. for (Node contractFile : contractFiles) {
  5. final String filename = contractFile.getPath().get().substring(1);
  6. final Asset asset = contractFile.getAsset();
  7. try (final InputStream in = asset.openStream()) {
  8. Files.copy(in, new File(destination, filename).toPath());
  9. }
  10. }
  11. }

代码示例来源:origin: org.jboss.forge.test/arquillian-forge-core

  1. @Override
  2. public void process(Archive<?> archive)
  3. {
  4. if ("arquillian-core.jar".equals(archive.getName()))
  5. {
  6. Node node = archive.get("org/jboss/shrinkwrap/descriptor");
  7. if (node != null)
  8. archive.delete(node.getPath());
  9. }
  10. }
  11. }

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

  1. /**
  2. * Recursive call to process all the node hierarchy
  3. *
  4. * @param node
  5. */
  6. private void processNode(final Node node) {
  7. processNode(node.getPath(), node);
  8. Set<Node> children = node.getChildren();
  9. for (Node child : children) {
  10. processNode(child);
  11. }
  12. }

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

  1. /**
  2. * Recursive call to process all the node hierarchy
  3. *
  4. * @param node
  5. */
  6. private void processNode(final Node node) {
  7. processNode(node.getPath(), node);
  8. Set<Node> children = node.getChildren();
  9. for (Node child : children) {
  10. processNode(child);
  11. }
  12. }

代码示例来源:origin: com.kumuluz.ee.testing/kumuluzee-arquillian-container

  1. private static void copyDir(Archive<?> sourceArchive, Archive<?> targetArchive, String source, String target) {
  2. Node sourceNode = sourceArchive.get(source);
  3. if (sourceNode.getAsset() != null) {
  4. targetArchive.add(sourceNode.getAsset(), target);
  5. } else {
  6. for (Node child : sourceNode.getChildren()) {
  7. String childName = child.getPath().get().replaceFirst(child.getPath().getParent().get(), "");
  8. copyDir(sourceArchive, targetArchive,
  9. child.getPath().get(), ArchivePaths.create(target, childName).get());
  10. }
  11. }
  12. }
  13. }

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

  1. public static WebArchive createDeployment(String packageName) throws IOException {
  2. WebArchive war = createPortletDeployment(packageName);
  3. Node node = war.get("WEB-INF/portlet.xml");
  4. ArchivePath path = node.getPath();
  5. String s = Tools.read(node.getAsset().openStream(), Tools.UTF_8);
  6. s = s.replace("<portlet-info>", "<resource-bundle>bundle</resource-bundle>" + "<portlet-info>");
  7. war.delete(path);
  8. war.add(new StringAsset(s), path);
  9. war.addAsResource(new StringAsset("abc=def"), "bundle_fr_FR.properties");
  10. return war;
  11. }

代码示例来源:origin: org.juzu/juzu-core

  1. public static WebArchive createDeployment(String packageName) throws IOException {
  2. WebArchive war = createPortletDeployment(packageName);
  3. Node node = war.get("WEB-INF/portlet.xml");
  4. ArchivePath path = node.getPath();
  5. String s = Tools.read(node.getAsset().openStream(), Tools.UTF_8);
  6. s = s.replace("<portlet-info>", "<resource-bundle>bundle</resource-bundle>" + "<portlet-info>");
  7. war.delete(path);
  8. war.add(new StringAsset(s), path);
  9. war.addAsResource(new StringAsset("abc=def"), "bundle_fr_FR.properties");
  10. return war;
  11. }

代码示例来源:origin: org.juzu/juzu-core

  1. public static WebArchive createDeployment(String packageName) throws IOException {
  2. WebArchive war = createServletDeployment(true, packageName);
  3. Node node = war.get("/WEB-INF/web.xml");
  4. ArchivePath path = node.getPath();
  5. String s = Tools.read(node.getAsset().openStream(), Tools.UTF_8);
  6. s = s.replace("<async-supported>true</async-supported>",
  7. "<init-param><param-name>juzu.resource_bundle</param-name><param-value>bundle</param-value></init-param>" +
  8. "<async-supported>true</async-supported>");
  9. war.delete(path);
  10. war.add(new StringAsset(s), path);
  11. war.addAsResource(new StringAsset("abc=def"), "bundle_fr_FR.properties");
  12. return war;
  13. }

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

  1. public static WebArchive createDeployment(String packageName) throws IOException {
  2. WebArchive war = createServletDeployment(true, packageName);
  3. Node node = war.get("/WEB-INF/web.xml");
  4. ArchivePath path = node.getPath();
  5. String s = Tools.read(node.getAsset().openStream(), Tools.UTF_8);
  6. s = s.replace("<async-supported>true</async-supported>",
  7. "<init-param><param-name>juzu.resource_bundle</param-name><param-value>bundle</param-value></init-param>" +
  8. "<async-supported>true</async-supported>");
  9. war.delete(path);
  10. war.add(new StringAsset(s), path);
  11. war.addAsResource(new StringAsset("abc=def"), "bundle_fr_FR.properties");
  12. return war;
  13. }

相关文章