org.jboss.shrinkwrap.api.Node Java Examples

The following examples show how to use org.jboss.shrinkwrap.api.Node. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JBossDeploymentStructureContainer.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 6 votes vote down vote up
default JBossDeploymentStructureAsset getDescriptorAsset() {
    String path = PRIMARY_JBOSS_DEPLOYMENT_DESCRIPTOR_PATH;
    Node jbossDS = this.get(PRIMARY_JBOSS_DEPLOYMENT_DESCRIPTOR_PATH);
    if (jbossDS == null) {
        jbossDS = this.get(SECONDARY_JBOSS_DEPLOYMENT_DESCRIPTOR_PATH);
        if (jbossDS != null) {
            path = SECONDARY_JBOSS_DEPLOYMENT_DESCRIPTOR_PATH;
        }
    }
    Asset asset;

    if (jbossDS == null) {
        asset = new JBossDeploymentStructureAsset();
    } else {
        asset = jbossDS.getAsset();
        if (!(asset instanceof JBossDeploymentStructureAsset)) {
            asset = new JBossDeploymentStructureAsset(asset.openStream());
        }
    }

    this.add(asset, path);

    return (JBossDeploymentStructureAsset) asset;
}
 
Example #2
Source File: DeploymentArchiveProcessor.java    From keycloak with Apache License 2.0 6 votes vote down vote up
public void addFilterDependencies(Archive<?> archive, TestClass testClass) {
    TestContext testContext = testContextProducer.get();
    if (testContext.getAppServerInfo().isUndertow()) {
        return;
    }

    Node jbossDeploymentStructureXml = archive.get(JBOSS_DEPLOYMENT_XML_PATH);
    if (jbossDeploymentStructureXml == null) {
        log.debug("Archive doesn't contain " + JBOSS_DEPLOYMENT_XML_PATH);
        return;
    }

    log.info("Adding filter dependencies to " + archive.getName());
    
    String dependency = testClass.getAnnotation(UseServletFilter.class).filterDependency();
    ((WebArchive) archive).addAsLibraries(KeycloakDependenciesResolver.resolveDependencies((dependency + ":" + System.getProperty("project.version"))));

    Document jbossXmlDoc = loadXML(jbossDeploymentStructureXml.getAsset().openStream());
    removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-saml-core");
    removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-adapter-spi");
    archive.add(new StringAsset((documentToString(jbossXmlDoc))), JBOSS_DEPLOYMENT_XML_PATH);

}
 
Example #3
Source File: OpenEJBArchiveProcessor.java    From tomee with Apache License 2.0 6 votes vote down vote up
private static void addEnvEntries(final Archive<?> archive, final String prefix, final AppModule appModule, final EjbModule ejbModule) {
    final Node envEntriesProperties = archive.get(prefix.concat(ENV_ENTRIES_PROPERTIES));
    if (envEntriesProperties != null) {
        InputStream is = null;
        final Properties properties = new Properties();
        try {
            is = envEntriesProperties.getAsset().openStream();
            properties.load(is);
            ejbModule.getAltDDs().put(ENV_ENTRIES_PROPERTIES, properties);

            // do it for test class too
            appModule.getEjbModules().iterator().next().getAltDDs().put(ENV_ENTRIES_PROPERTIES, properties);
        } catch (final Exception e) {
            LOGGER.log(Level.SEVERE, "can't read env-entries.properties", e);
        } finally {
            IO.close(is);
        }
    }
}
 
Example #4
Source File: ShrinkWrapResource.java    From piranha with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public InputStream getResourceAsStreamByLocation(String location) {
    if (location == null) {
        return null;
    }
    
    Node node = getNode(archive, location);
    if (node == null) {
        return null;
    }
    
    Asset asset = node.getAsset();
    if (asset == null) {
        // Node was a directory
        return new ShrinkWrapDirectoryInputStream(getContentFromNode(node));
    }
    
    // Node was an asset
    return asset.openStream();
}
 
Example #5
Source File: KeycloakMicroprofileJwtArchivePreparer.java    From thorntail with Apache License 2.0 6 votes vote down vote up
private InputStream getKeycloakJsonFromClasspath(String resourceName) {
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    InputStream keycloakJson = cl.getResourceAsStream(resourceName);
    if (keycloakJson == null) {

        Node jsonNode = archive.get(resourceName);
        if (jsonNode == null) {
            jsonNode = getKeycloakJsonNodeFromWebInf(resourceName, true);
        }
        if (jsonNode == null) {
            jsonNode = getKeycloakJsonNodeFromWebInf(resourceName, false);
        }
        if (jsonNode != null && jsonNode.getAsset() != null) {
            keycloakJson = jsonNode.getAsset().openStream();
        }
    }
    return keycloakJson;
}
 
Example #6
Source File: BuildTool.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 6 votes vote down vote up
protected boolean nodeIsInArtifactList(final Node node,
                                       final Collection<ArtifactSpec> artifactList,
                                       final boolean exact) {
    final List<Properties> poms = extractPomProperties(node);
    final String jarName = node.getPath().get().substring(WEB_INF_LIB.length());
    boolean found = false;
    final Iterator<ArtifactSpec> specs = artifactList.iterator();

    while (!found && specs.hasNext()) {
        final ArtifactSpec spec = specs.next();
        if (!poms.isEmpty()) {
            found = matchProperty(poms, "groupId", spec.groupId())
                    && matchProperty(poms, "artifactId", spec.artifactId())
                    && (!exact || matchProperty(poms, "version", spec.version()));
        } else {
            // no pom, try to match by file name
            if (exact) {
                found = jarName.equals(String.format("%s-%s.%s", spec.artifactId(), spec.version(), spec.type()));
            } else {
                found = jarName.matches("^" + spec.artifactId() + "-\\d.*\\." + spec.type());
            }
        }
    }

    return found;
}
 
Example #7
Source File: SWClassLoader.java    From tomee with Apache License 2.0 6 votes vote down vote up
public URL getWebResource(final String name) {
    for (final Archive<?> a : archives) {
        if (!WebArchive.class.isInstance(a)) {
            continue;
        }
        final Node node = a.get(name);
        if (node != null) {
            try {
                return new URL(null, "archive:" + a.getName() + (!name.startsWith("/") ? "/" : "") + name, new ArchiveStreamHandler());
            } catch (final MalformedURLException e) {
                // no-op
            }
        }
    }
    return null;
}
 
Example #8
Source File: MicroProfileOpenTracingTCKDeploymentPackager.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Override
public Archive<?> generateDeployment(final TestDeployment testDeployment,
                                     final Collection<ProtocolArchiveProcessor> processors) {

    final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "microprofile-opentracing.war")
                                            .merge(testDeployment.getApplicationArchive());

    // opentracing-api jar added by Geronimo Impl. Also added by TCK causes issues with same classes in different Classloaders
    final Map<ArchivePath, Node> content = webArchive.getContent(object -> object.get().matches(".*opentracing-api.*jar.*"));
    content.forEach((archivePath, node) -> webArchive.delete(archivePath));

    // TCK expects a MockTracer. Check org/eclipse/microprofile/opentracing/tck/application/TracerWebService.java:133
    webArchive.addAsLibrary(jarLocation(MockTracer.class));
    webArchive.addAsLibrary(jarLocation(ThreadLocalScopeManager.class));
    webArchive.addAsWebInfResource("META-INF/beans.xml");
    webArchive.addClass(MicroProfileOpenTracingTCKTracer.class);

    System.out.println(webArchive.toString(true));

    return super.generateDeployment(
            new TestDeployment(null, webArchive, testDeployment.getAuxiliaryArchives()), processors);
}
 
Example #9
Source File: OpenEJBArchiveProcessor.java    From tomee with Apache License 2.0 6 votes vote down vote up
private static WebApp createWebApp(final Archive<?> archive) {
    WebApp webApp;
    final Node webXml = archive.get(WEB_INF + "web.xml");
    if (webXml == null) {
        webApp = new WebApp();
    } else {
        InputStream inputStream = null;
        try {
            inputStream = webXml.getAsset().openStream();
            webApp = Sxc.unmarshalJavaee(new WebApp$JAXB(), inputStream);
        } catch (final Exception e) {
            webApp = new WebApp();
        } finally {
            IO.close(inputStream);
        }
    }
    return webApp;
}
 
Example #10
Source File: ConfigApplicationArchiveProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public void process(Archive<?> applicationArchive, TestClass testClass) {
    if (applicationArchive instanceof WebArchive) {
        WebArchive war = applicationArchive.as(WebArchive.class);
        Node libNode = war.get(PATH_LIBRARY);
        if (libNode != null) {
            for (Node child : libNode.getChildren()) {
                Asset childAsset = child.getAsset();
                if (childAsset instanceof ArchiveAsset) {
                    ArchiveAsset archiveAsset = (ArchiveAsset) childAsset;
                    if (archiveAsset.getArchive() instanceof JavaArchive) {
                        JavaArchive libArchive = (JavaArchive) archiveAsset.getArchive();
                        libArchive.deleteClass(testClass.getName());
                    }
                }
            }
        }
    }
}
 
Example #11
Source File: JBossWebContainer.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 6 votes vote down vote up
default JBossWebAsset findJbossWebAsset() {
    final Node jbossWeb = this.get(JBOSS_WEB_PATH);
    Asset asset;
    if (jbossWeb == null) {
        asset = new JBossWebAsset();
        this.add(asset, JBOSS_WEB_PATH);
    } else {
        asset = jbossWeb.getAsset();
        if (!(asset instanceof JBossWebAsset)) {
            asset = new JBossWebAsset(asset.openStream());
            this.add(asset, JBOSS_WEB_PATH);
        }
    }

    return (JBossWebAsset) asset;
}
 
Example #12
Source File: SwaggerArchiveImpl.java    From thorntail with Apache License 2.0 6 votes vote down vote up
private void loadOrCreateConfigurationAsset() throws IOException {

        Node node = getArchive().get(SWAGGER_CONFIGURATION_PATH);

        if (node == null && getArchive().getName().endsWith(".war")) {
            node = getArchive().get("WEB-INF/classes/" + SWAGGER_CONFIGURATION_PATH);
        }

        if (node != null) {
            Asset asset = node.getAsset();
            if (asset instanceof SwaggerConfigurationAsset) {
                this.configurationAsset = (SwaggerConfigurationAsset) asset;
            } else {
                this.configurationAsset = new SwaggerConfigurationAsset(asset.openStream());
                getArchive().add(this.configurationAsset, node.getPath());
            }
        } else {
            this.configurationAsset = new SwaggerConfigurationAsset();
            if (getArchive().getName().endsWith(".war")) {
                getArchive().add(this.configurationAsset, "WEB-INF/classes/" + SWAGGER_CONFIGURATION_PATH);
            } else {
                getArchive().add(this.configurationAsset, SWAGGER_CONFIGURATION_PATH);
            }
        }
    }
 
Example #13
Source File: ServiceFileCombinationImpl.java    From vertx-maven-plugin with Apache License 2.0 6 votes vote down vote up
private static Map<String, List<List<String>>> findDescriptorsFromDependencies(List<File> deps, List<String> patterns) {
    Map<String, List<List<String>>> map = new LinkedHashMap<>();

    for (File file : deps) {
        JavaArchive archive = ShrinkWrap.createFromZipFile(JavaArchive.class, file);
        Map<ArchivePath, Node> content = getMatchingFilesFromJar(patterns, archive);

        for (Map.Entry<ArchivePath, Node> entry : content.entrySet()) {
            Asset asset = entry.getValue().getAsset();
            if (asset != null) {
                List<String> lines;
                String path = entry.getKey().get();
                lines = read(asset, path);

                List<List<String>> items = map.computeIfAbsent(path, k -> new ArrayList<>());
                items.add(lines);
                map.put(path, items);
            }
        }
    }
    return map;
}
 
Example #14
Source File: JBossWebContainer.java    From thorntail with Apache License 2.0 6 votes vote down vote up
/**
 * Locate and load, or create a {@code jboss-web.xml} asset for this archive.
 *
 * @return The existing or new {@code jboss-web.xml} asset.
 */
default JBossWebAsset findJbossWebAsset() {
    final Node jbossWeb = this.get(JBOSS_WEB_PATH);
    Asset asset;
    if (jbossWeb == null) {
        asset = new JBossWebAsset();
        this.add(asset, JBOSS_WEB_PATH);
    } else {
        asset = jbossWeb.getAsset();
        if (!(asset instanceof JBossWebAsset)) {
            asset = new JBossWebAsset(asset.openStream());
            this.add(asset, JBOSS_WEB_PATH);
        }
    }

    return (JBossWebAsset) asset;
}
 
Example #15
Source File: FileDeploymentUtils.java    From camel-spring-boot with Apache License 2.0 6 votes vote down vote up
public static void materializeSubdirectories(File entryDirectory, Node node) throws DeploymentException, IOException {
    for (Node child : node.getChildren()) {
        if (child.getAsset() == null) {
            materializeSubdirectories(entryDirectory, child);
        } else {
            if (ClassPathDirectory.isMarkerFileArchivePath(child.getPath())) {
                // Do not materialize the marker file
                continue;
            }
            // E.g. META-INF/my-super-descriptor.xml
            File resourceFile = new File(entryDirectory, child.getPath().get().replace(DELIMITER_RESOURCE_PATH, File.separatorChar));
            File resoureDirectory = resourceFile.getParentFile();
            if (!resoureDirectory.exists() && !resoureDirectory.mkdirs()) {
                throw new DeploymentException("Could not create class path directory: " + entryDirectory);
            }
            resourceFile.createNewFile();
            try (InputStream in = child.getAsset().openStream(); OutputStream out = new FileOutputStream(resourceFile)) {
                copy(in, out);
            }
            child.getPath().get();
        }
    }
}
 
Example #16
Source File: MicroProfileOpenAPITCKDeploymentPackager.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Override
public Archive<?> generateDeployment(final TestDeployment testDeployment,
                                     final Collection<ProtocolArchiveProcessor> processors) {
    final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "microprofile-openapi.war")
                                            .merge(testDeployment.getApplicationArchive())
                                            // TODO - This doesn't seem right. This is for the JAX-RS endpoints to be CDI scanned.
                                            // This is to use CDI events to filter endpoints with configuration.
                                            // Check org.apache.geronimo.microprofile.openapi.cdi.GeronimoOpenAPIExtension.findEndpointsAndApplication()
                                            // A beans.xml should not be required.
                                            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            ;

    // MP Config in wrong place - See https://github.com/eclipse/microprofile/issues/46.
    if (testDeployment.getApplicationArchive() instanceof WebArchive) {
        final Map<ArchivePath, Node> content =
                testDeployment.getApplicationArchive().getContent(
                        object -> object.get().matches(".*META-INF/.*"));
        content.forEach((archivePath, node) -> webArchive.addAsResource(node.getAsset(), node.getPath()));
    }

    return super.generateDeployment(
            new TestDeployment(null, webArchive, testDeployment.getAuxiliaryArchives()), processors);
}
 
Example #17
Source File: ConfigPropertiesAdder.java    From piranha with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void process(WebArchive webArchive) {
    Node metaInfConfig = webArchive.get("/META-INF/microprofile-config.properties");
    
    if (metaInfConfig == null) {
        if (webArchive.get("/WEB-INF/classes/publicKey.pem") != null) {
            webArchive.addAsResource("META-INF/public-key.properties", "META-INF/microprofile-config.properties");
        } else {
            webArchive.addAsResource("META-INF/microprofile-config.properties");
        }
    } else {
        webArchive.addAsResource(metaInfConfig.getAsset(), "META-INF/microprofile-config.properties");
        webArchive.delete("/META-INF/microprofile-config.properties");
    }
    
    System.out.printf("WebArchive: %s\n", webArchive.toString(true));
}
 
Example #18
Source File: GaeApplicationArchiveProcessor.java    From appengine-tck with Apache License 2.0 6 votes vote down vote up
protected void handleWebArchive(WebArchive war) {
    final Node lib = war.get("WEB-INF/lib");
    if (lib != null) {
        final Set<Node> libs = lib.getChildren();
        for (Node jar : libs) {
            if (jar.getPath().get().contains("appengine-api"))
                return;
        }
    }

    // do not add GAE jar; e.g. CapeDwarf can work off GAE module
    boolean ignoreGaeJar = Boolean.getBoolean("ignore.gae.jar");
    if (ignoreGaeJar == false) {
        war.addAsLibraries(Maven.resolver()
            .loadPomFromFile("pom.xml")
            .resolve("com.google.appengine:appengine-api-1.0-sdk")
            .withTransitivity()
            .as(File.class)
        );
    }
}
 
Example #19
Source File: Main.java    From thorntail with Apache License 2.0 6 votes vote down vote up
public static void main(String... args) throws Exception {
    swarm = new Swarm(args);
    swarm.start();
    Archive<?> deployment = swarm.createDefaultDeployment();
    if (deployment == null) {
        throw new Error("Couldn't create default deployment");
    }

    Node persistenceXml = deployment.get("WEB-INF/classes/META-INF/persistence.xml");

    if (persistenceXml == null) {
        throw new Error("persistence.xml is not found");
    }

    if (persistenceXml.getAsset() == null) {
        throw new Error("persistence.xml is not found");
    }

    swarm.deploy(deployment);
}
 
Example #20
Source File: SwaggerWebAppFractionTest.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
private Archive<?> assertArchive(SwaggerWebAppFraction fraction) {
    Archive<?> archive = fraction.getWebContent();
    assertThat(archive).isNotNull();
    Node node = archive.get("/index.html");
    assertThat(node).isNotNull();
    return archive;
}
 
Example #21
Source File: AdvertisingMetadataProcessorTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
Index createIndex(Archive<?> archive) throws IOException {
    Indexer indexer = new Indexer();

    Map<ArchivePath, Node> c = archive.getContent();
    for (Map.Entry<ArchivePath, Node> each : c.entrySet()) {
        if (each.getKey().get().endsWith(".class")) {
            indexer.index(each.getValue().getAsset().openStream());
        }
    }


    return indexer.complete();
}
 
Example #22
Source File: SWClassLoader.java    From tomee with Apache License 2.0 5 votes vote down vote up
public LinkedList<Archive<?>> findNodes(final String name) {
    final LinkedList<Archive<?>> items = new LinkedList<>();
    for (final Archive<?> a : archives) {
        final boolean isWar = WebArchive.class.isInstance(a);
        final Node node = a.get(ArchivePaths.create((isWar ? "/WEB-INF/classes/" : "") + name));
        if (node != null) {
            items.add(a);
        }
    }
    return items;
}
 
Example #23
Source File: SwaggerArchiveImpl.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
private void loadOrCreateConfigurationAsset() {
    Node node = getArchive().get(SWAGGER_CONFIGURATION_PATH);
    if (node != null) {
        Asset asset = node.getAsset();
        if (asset instanceof SwaggerConfigurationAsset) {
            this.configurationAsset = (SwaggerConfigurationAsset) asset;
        } else {
            this.configurationAsset = new SwaggerConfigurationAsset(asset.openStream());
        }
    } else {
        this.configurationAsset = new SwaggerConfigurationAsset();
        getArchive().add(this.configurationAsset, SWAGGER_CONFIGURATION_PATH);
    }
}
 
Example #24
Source File: SecuredArchivePreparer.java    From thorntail with Apache License 2.0 5 votes vote down vote up
private static InputStream getKeycloakJsonFromClasspath(String resourceName) {
    InputStream keycloakJson = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);
    if (keycloakJson == null) {

        String appArtifact = System.getProperty(BootstrapProperties.APP_ARTIFACT);

        if (appArtifact != null) {
            try (InputStream in = loadAppArtifact(appArtifact)) {
                Archive<?> tmpArchive = ShrinkWrap.create(JARArchive.class);
                tmpArchive.as(ZipImporter.class).importFrom(in);
                Node jsonNode = tmpArchive.get(resourceName);
                if (jsonNode == null) {
                    jsonNode = getKeycloakJsonNodeFromWebInf(tmpArchive, resourceName, true);
                }
                if (jsonNode == null) {
                    jsonNode = getKeycloakJsonNodeFromWebInf(tmpArchive, resourceName, false);
                }
                if (jsonNode != null && jsonNode.getAsset() != null) {
                    keycloakJson = jsonNode.getAsset().openStream();
                }
            } catch (IOException e) {
                // ignore
            }
        }
    }
    return keycloakJson;
}
 
Example #25
Source File: DefaultApplicationDeploymentProcessorTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Test
public void testWebXmlApplicationServletMappingPresent() throws Exception {
    JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
    archive.addClass(MyResource.class);
    archive.setWebXML(new StringAsset(
            "<web-app><servlet-mapping><servlet-name>Faces Servlet</servlet-name><url-pattern>*.jsf</url-pattern></servlet-mapping><servlet-mapping><servlet-name>javax.ws.rs.core.Application</servlet-name><url-pattern>/foo/*</url-pattern></servlet-mapping></web-app>"));
    DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive);

    processor.process();

    Node generated = archive.get(PATH);
    assertThat(generated).isNull();
}
 
Example #26
Source File: DefaultApplicationDeploymentProcessorTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Test
public void testApplicationPathAnnotation_InWebInfLibArchive() throws Exception {
    JavaArchive subArchive = ShrinkWrap.create(JavaArchive.class, "mysubarchive.jar");
    subArchive.addClass(MySampleApplication.class);
    JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
    archive.addAsLibrary(subArchive);
    DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive);

    processor.process();

    Node generated = archive.get(PATH);
    assertThat(generated).isNull();
}
 
Example #27
Source File: DefaultApplicationDeploymentProcessorTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Test
public void testApplicationPathAnnotation_DirectlyInArchive() throws Exception {
    JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
    archive.addClass(MySampleApplication.class);
    DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive);

    processor.process();

    Node generated = archive.get(PATH);
    assertThat(generated).isNull();
}
 
Example #28
Source File: DefaultApplicationDeploymentProcessorTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Test
public void testApplicationPathAnnotation_SpecifiedInProjectDefaults() throws Exception {
    JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class, "app.war");
    DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive);
    processor.applicationPath.set("/api-test"); // Simulate the behavior of loading the project defaults.
    processor.process();

    Node generated = archive.get(PATH);
    Asset asset = generated.getAsset();

    assertThat(generated).isNotNull();
    assertThat(asset).isNotNull();
}
 
Example #29
Source File: DefaultApplicationDeploymentProcessor.java    From thorntail with Apache License 2.0 5 votes vote down vote up
private static boolean hasApplicationServletMapping(Archive<?> archive) {
    Node webXmlNode = archive.get(PATH_WEB_XML);
    if (webXmlNode != null) {
        return hasApplicationServletMapping(webXmlNode.getAsset());
    }
    return false;
}
 
Example #30
Source File: DefaultApplicationDeploymentProcessor.java    From thorntail with Apache License 2.0 5 votes vote down vote up
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;
}