Search in sources :

Example 6 with Resource

use of org.jboss.modules.Resource in project wildfly-swarm by wildfly-swarm.

the class ManagementConsoleDeploymentProducer method managementConsoleWar.

@Produces
public Archive managementConsoleWar() throws Exception {
    // Load the management-ui webjars.
    WARArchive war = ShrinkWrap.create(WARArchive.class, "management-console-ui.war");
    Module module = Module.getBootModuleLoader().loadModule("org.jboss.as.console");
    Iterator<Resource> resources = module.globResources("*");
    while (resources.hasNext()) {
        Resource each = resources.next();
        war.add(new UrlAsset(each.getURL()), each.getName());
    }
    war.setContextRoot(this.fraction.contextRoot());
    return war;
}
Also used : Resource(org.jboss.modules.Resource) Module(org.jboss.modules.Module) WARArchive(org.wildfly.swarm.undertow.WARArchive) UrlAsset(org.jboss.shrinkwrap.api.asset.UrlAsset) Produces(javax.enterprise.inject.Produces)

Example 7 with Resource

use of org.jboss.modules.Resource in project jboss-modules by jboss-modules.

the class TestResourceLoader method getManifest.

private Manifest getManifest() throws IOException {
    if (manifest != null)
        return manifest;
    final Resource manifestResource = getResource("META-INF/MANIFEST.MF");
    if (manifestResource == null)
        return null;
    final InputStream manifestStream = manifestResource.openStream();
    try {
        manifest = new Manifest(manifestStream);
    } finally {
        if (manifestStream != null)
            manifestStream.close();
    }
    return manifest;
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Resource(org.jboss.modules.Resource) Manifest(java.util.jar.Manifest)

Aggregations

Resource (org.jboss.modules.Resource)7 Module (org.jboss.modules.Module)4 HashSet (java.util.HashSet)3 InputStream (java.io.InputStream)2 ModuleLoadException (org.jboss.modules.ModuleLoadException)2 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Manifest (java.util.jar.Manifest)1 Produces (javax.enterprise.inject.Produces)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)1 WarMetaData (org.jboss.as.web.common.WarMetaData)1 ClassInfo (org.jboss.jandex.ClassInfo)1 Index (org.jboss.jandex.Index)1 Indexer (org.jboss.jandex.Indexer)1 ListenerMetaData (org.jboss.metadata.web.spec.ListenerMetaData)1 TldMetaData (org.jboss.metadata.web.spec.TldMetaData)1 LocalLoader (org.jboss.modules.LocalLoader)1