Search in sources :

Example 6 with ArchiveAsset

use of org.jboss.shrinkwrap.api.asset.ArchiveAsset in project wildfly-swarm by wildfly-swarm.

the class DefaultApplicationDeploymentProcessor method hasApplicationPathAnnotation.

static boolean hasApplicationPathAnnotation(ArchivePath path, Asset asset) {
    if (asset == null) {
        return false;
    }
    if (asset instanceof ArchiveAsset) {
        return hasApplicationPathAnnotation(((ArchiveAsset) asset).getArchive());
    }
    if (!path.get().endsWith(".class")) {
        return false;
    }
    try (InputStream in = asset.openStream()) {
        ClassReader reader = new ClassReader(in);
        ApplicationPathAnnotationSeekingClassVisitor visitor = new ApplicationPathAnnotationSeekingClassVisitor();
        reader.accept(visitor, 0);
        return visitor.isFound();
    } catch (IOException ignored) {
    }
    return false;
}
Also used : InputStream(java.io.InputStream) ClassReader(org.objectweb.asm.ClassReader) ArchiveAsset(org.jboss.shrinkwrap.api.asset.ArchiveAsset) IOException(java.io.IOException)

Aggregations

ArchiveAsset (org.jboss.shrinkwrap.api.asset.ArchiveAsset)6 IOException (java.io.IOException)4 InputStream (java.io.InputStream)3 Node (org.jboss.shrinkwrap.api.Node)2 ZipExporter (org.jboss.shrinkwrap.api.exporter.ZipExporter)2 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)2 ClassReader (org.objectweb.asm.ClassReader)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Properties (java.util.Properties)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Produces (javax.enterprise.inject.Produces)1 Inject (javax.inject.Inject)1 DeploymentException (org.jboss.arquillian.container.spi.client.container.DeploymentException)1 JMXContext (org.jboss.arquillian.container.spi.client.protocol.metadata.JMXContext)1 ProtocolMetaData (org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData)1 Deployment (org.jboss.arquillian.container.test.api.Deployment)1 CompositeIndex (org.jboss.jandex.CompositeIndex)1