当前位置: 首页>>代码示例>>Java>>正文


Java ClassLoaderAsset类代码示例

本文整理汇总了Java中org.jboss.shrinkwrap.api.asset.ClassLoaderAsset的典型用法代码示例。如果您正苦于以下问题:Java ClassLoaderAsset类的具体用法?Java ClassLoaderAsset怎么用?Java ClassLoaderAsset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ClassLoaderAsset类属于org.jboss.shrinkwrap.api.asset包,在下文中一共展示了ClassLoaderAsset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    // Instantiate the container
    Swarm swarm = new Swarm(args);

    // Create one or more deployments
    WARArchive deployment = ShrinkWrap.create(WARArchive.class);

    // Add resource to deployment
    deployment.addPackage(Main.class.getPackage());
    deployment.addAllDependencies();

    // Add Web resources
    deployment.addAsWebResource(
            new ClassLoaderAsset("src/main/webapp/index.html", Main.class.getClassLoader()), "src/main/webapp/index.html");
    deployment.addAsWebInfResource(
            new ClassLoaderAsset("src/main/webapp/WEB-INF/beans.xml", Main.class.getClassLoader()), "beans.xml");


    swarm.start().deploy(deployment);

}
 
开发者ID:xstefank,项目名称:lra-service,代码行数:22,代码来源:Main.java

示例2: getImplicitDeployments

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Override
public List<Archive> getImplicitDeployments(TopologyWebAppFraction fraction) throws Exception {
    String context = System.getProperty(TopologyProperties.CONTEXT_PATH);
    if (context == null) context = DEFAULT_CONTEXT;

    List<Archive> list = new ArrayList<>();
    if (fraction.exposeTopologyEndpoint()) {
        WARArchive war = ShrinkWrap.create(WARArchive.class, "topology-webapp.war");
        war.addAsWebInfResource(new StringAsset(getWebXml(fraction)), "web.xml");
        war.addClass(TopologySSEServlet.class);
        war.addModule("swarm.application");
        war.addModule("org.wildfly.swarm.topology");
        war.addAsWebResource(new ClassLoaderAsset("topology.js", this.getClass().getClassLoader()), "topology.js");
        war.setContextRoot(context);
        war.as(TopologyArchive.class);
        list.add(war);
    }
    return list;
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-topology,代码行数:20,代码来源:TopologyWebAppConfiguration.java

示例3: deployment

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Produces
@Dependent()
Archive deployment() {

    String context = TopologyWebAppFraction.DEFAULT_CONTEXT;
    if (this.contextPath != null) {
        context = this.contextPath;
    }

    if (fraction.exposeTopologyEndpoint()) {
        WARArchive war = ShrinkWrap.create(WARArchive.class, "topology-webapp.war");
        war.addAsWebInfResource(new StringAsset(getWebXml(fraction)), "web.xml");
        war.addClass(TopologySSEServlet.class);
        war.addModule("swarm.application");
        war.addModule("org.wildfly.swarm.topology");
        war.addAsWebResource(new ClassLoaderAsset("topology.js", this.getClass().getClassLoader()), "topology.js");
        war.setContextRoot(context);
        war.as(TopologyArchive.class);
        return war;
    }
    return null;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:23,代码来源:TopologyWebAppDeploymentProducer.java

示例4: deployApp

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
private void deployApp() throws Exception {
    WARArchive appDeployment = ShrinkWrap.create(WARArchive.class, "tubewarder.war");
    appDeployment.addPackages(true, "net.weweave.tubewarder");
    appDeployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/persistence-"+getConfig().getDb()+".xml", TubewarderSwarm.class.getClassLoader()), "classes/META-INF/persistence.xml");
    if ("postgresql".equals(getConfig().getDb())) {
        appDeployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/" + getConfig().getDb() + "-mapping.xml", TubewarderSwarm.class.getClassLoader()), "classes/META-INF/postgresql-mapping.xml");
    }

    File[] libs = getAdditionalJars();
    for (File lib : libs) {
        appDeployment.addAsLibrary(lib, lib.getName());
    }

    appDeployment.addAllDependencies();
    appDeployment.staticContent();
    deploy(appDeployment);
}
 
开发者ID:weweave,项目名称:tubewarder,代码行数:18,代码来源:TubewarderSwarm.java

示例5: getImplicitDeployments

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Override
public List<Archive> getImplicitDeployments(TopologyWebAppFraction fraction) throws Exception {
    String context = System.getProperty(TopologyProperties.CONTEXT_PATH);
    if (context == null) context = DEFAULT_CONTEXT;

    List<Archive> list = new ArrayList<>();
    WARArchive war = ShrinkWrap.create(WARArchive.class, "topology-webapp.war");
    war.addAsWebInfResource(new StringAsset(getWebXml(fraction)), "web.xml");
    war.addClass(TopologySSEServlet.class);
    war.addModule("swarm.application");
    war.addModule("org.wildfly.swarm.topology");
    war.addAsWebResource(new ClassLoaderAsset("topology.js", this.getClass().getClassLoader()), "topology.js");
    war.setContextRoot(context);
    war.as(TopologyArchive.class);
    list.add(war);
    return list;
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:18,代码来源:TopologyWebAppConfiguration.java

示例6: createDeployment

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
    File[] libs = Maven.resolver()
            .loadPomFromFile("pom.xml")
            .importRuntimeDependencies()
            .addDependency(MavenDependencies.createDependency("eu.ggnet.dwoss:dwoss-mandator-sample", RUNTIME, false)) // The Sample Mandator is needed on many places.
            .addDependency(MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)) // Log4J API
            .addDependency(MavenDependencies.createDependency("org.assertj:assertj-core", RUNTIME, false)) // Fest assertion
            .resolve().withTransitivity().asFile();
    WebArchive war = ShrinkWrap.create(WebArchive.class, "stock-persistence-test.war")
            .addPackages(true,
                    Filters.exclude(PersistenceIT.class.getPackage(), // Compile safe package "eu.ggnet.dwoss.customer.itest"
                            ValidationTest.class.getPackage()), // Compile safe package "eu.ggnet.dwoss.customer.test"
                    "eu.ggnet.dwoss.stock")
            .addClass(MandatorSupportProducer.class) // The Datasource Configuration and the Static Producers
            .addClass(SampleDataSourceDefinition.class) // Alle Datasources. More than we need.
            .addClass(Coordinate.class) // Need this cause of the maven resolver is part of the deployment
            .addClass(ArquillianProjectArchive.class) // The local deployer configuration
            .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml")
            .addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties")
            .addAsWebInfResource("jboss-deployment-structure.xml") // Needed for jboss/wildfly h2 enablement
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(libs);
    return war;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:26,代码来源:ArquillianProjectArchive.java

示例7: createDeployment

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
    File[] libs = Maven.resolver()
            .loadPomFromFile("pom.xml")
            .importRuntimeDependencies()
            .addDependency(MavenDependencies.createDependency("eu.ggnet.dwoss:dwoss-mandator-sample", RUNTIME, false)) // The Sample Mandator is needed on many places.
            .addDependency(MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)) // Log4J API
            .addDependency(MavenDependencies.createDependency("org.assertj:assertj-core", RUNTIME, false)) // AssertJ Fluent Assertions
            .resolve().withTransitivity().asFile();
    WebArchive war = ShrinkWrap.create(WebArchive.class, "customer-persistence-test.war")
            .addPackages(true,
                    Filters.exclude(PersistenceIT.class.getPackage(), // Compile safe package "eu.ggnet.dwoss.customer.itest"
                            CustomerTest.class.getPackage()), // Compile safe package "eu.ggnet.dwoss.customer.test"
                    "eu.ggnet.dwoss.customer")
            .addClass(MandatorSupportProducer.class) // The Datasource Configuration and the Static Producers
            .addClass(SampleDataSourceDefinition.class) // Alle Datasources. More than we need.
            .addClass(Coordinate.class) // Need this cause of the maven resolver is part of the deployment
            .addClass(ArquillianProjectArchive.class) // The local deployer configuration
            .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml")
            .addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties")
            .addAsWebInfResource("jboss-deployment-structure.xml") // Needed for jboss/wildfly h2 enablement
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(libs);
    return war;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:26,代码来源:ArquillianProjectArchive.java

示例8: createDeployment

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
    File[] libs = Maven.resolver()
            .loadPomFromFile("pom.xml")
            .importRuntimeDependencies()
            .addDependency(MavenDependencies.createDependency("eu.ggnet.dwoss:dwoss-mandator-sample", RUNTIME, false)) // The Sample Mandator is needed on many places.
            .addDependency(MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)) // Log4J API
            .addDependency(MavenDependencies.createDependency("org.assertj:assertj-core", RUNTIME, false)) // AssertJ Fluent Assertions
            .resolve().withTransitivity().asFile();
    WebArchive war = ShrinkWrap.create(WebArchive.class, "uniqueunit-persistence-test.war")
            .addPackages(true,
                    Filters.exclude(PersistenceIT.class.getPackage(), // Compile safe package "eu.ggnet.dwoss.uniqueunit.itest"
                            UniqueUnitTest.class.getPackage()), // Compile safe package "eu.ggnet.dwoss.uniqueunit.test"
                    "eu.ggnet.dwoss.uniqueunit")
            .addClass(MandatorSupportProducer.class) // The Datasource Configuration and the Static Producers
            .addClass(SampleDataSourceDefinition.class) // Alle Datasources. More than we need.
            .addClass(Coordinate.class) // Need this cause of the maven resolver is part of the deployment
            .addClass(ArquillianProjectArchive.class) // The local deployer configuration
            .addClass(UniqurUnitItHelper.class)
            .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml")
            .addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties")
            .addAsWebInfResource("jboss-deployment-structure.xml") // Needed for jboss/wildfly h2 enablement
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(libs);
    return war;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:27,代码来源:ArquillianProjectArchive.java

示例9: createDeployment

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
    File[] libs = Maven.resolver()
            .loadPomFromFile("pom.xml")
            .importRuntimeDependencies()
            .addDependency(MavenDependencies.createDependency("eu.ggnet.dwoss:dwoss-mandator-sample", RUNTIME, false)) // The Sample Mandator is needed on many places.
            .addDependency(MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)) // Log4J API
            .resolve().withTransitivity().asFile();

    return ShrinkWrap.create(WebArchive.class, "rights-persistence-test.war")
            .addPackages(true, Filters.exclude(getPackage("eu.ggnet.dwoss.rights.itest")), "eu.ggnet.dwoss.rights")
            .addPackages(true, "org.assertj") // Need this for AssertJ Assertations
            .addClass(MandatorSupportProducer.class) // The Datasource Configuration and the Static Producers
            .addClass(SampleDataSourceDefinition.class) // Alle Datasources. More than we need.
            .addClass(Coordinate.class) // Need this cause of the maven resolver is part of the deployment
            .addClass(ArquillianProjectArchive.class)
            .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml")
            .addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties")
            .addAsWebInfResource("jboss-deployment-structure.xml") // Needed for jboss/wildfly h2 enablement
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(libs);
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:23,代码来源:ArquillianProjectArchive.java

示例10: createDeployment

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
    File[] libs = Maven.resolver()
            .loadPomFromFile("pom.xml")
            .importRuntimeDependencies()
            .addDependency(MavenDependencies.createDependency("eu.ggnet.dwoss:dwoss-mandator-sample", RUNTIME, false)) // The Sample Mandator is needed on many places.
            .addDependency(MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)) // Log4J API
            .addDependency(MavenDependencies.createDependency("org.assertj:assertj-core", RUNTIME, false)) // Fest assertion
            .resolve().withTransitivity().asFile();
    WebArchive war = ShrinkWrap.create(WebArchive.class, "redtape-persistence-test.war")
            .addPackages(true,
                    Filters.exclude(PersistenceIT.class.getPackage(), // Compile safe package "eu.ggnet.dwoss.redtape.itest"
                            PositionTest.class.getPackage()), // Compile safe package "eu.ggnet.dwoss.redtape.test"
                    "eu.ggnet.dwoss.redtape")
            .addClass(MandatorSupportProducer.class) // The Datasource Configuration and the Static Producers
            .addClass(Coordinate.class) // Need this cause of the maven resolver is part of the deployment
            .addClass(SampleDataSourceDefinition.class) // Alle Datasources. More than we need.
            .addClass(ArquillianProjectArchive.class) // The local deployer configuration
            .addClass(RedTapeHelper.class)
            .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml")
            .addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties")
            .addAsWebInfResource("jboss-deployment-structure.xml") // Needed for jboss/wildfly h2 enablement
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(libs);
    return war;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:27,代码来源:ArquillianProjectArchive.java

示例11: createDeployment

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
    File[] libs = Maven.resolver()
            .loadPomFromFile("pom.xml")
            .importRuntimeDependencies()
            .addDependency(MavenDependencies.createDependency("eu.ggnet.dwoss:dwoss-mandator-sample", RUNTIME, false)) // The Sample Mandator is needed on many places.
            .addDependency(MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)) // Log4J API
            .addDependency(MavenDependencies.createDependency("org.assertj:assertj-core", RUNTIME, false)) // Fest assertion
            .resolve().withTransitivity().asFile();
    WebArchive war = ShrinkWrap.create(WebArchive.class, "report-persistence-test.war")
            .addPackages(true,
                    Filters.exclude(PersistenceIT.class.getPackage(), // Compile safe package "eu.ggnet.dwoss.redtape.itest"
                            ReportTest.class.getPackage()), // Compile safe package "eu.ggnet.dwoss.redtape.test"
                    "eu.ggnet.dwoss.report")
            .addClass(MandatorSupportProducer.class) // The Datasource Configuration and the Static Producers
            .addClass(Coordinate.class) // Need this cause of the maven resolver is part of the deployment
            .addClass(ArquillianProjectArchive.class) // The local deployer configuration
            .addClass(ReportLineItHelper.class) // Helper Bean
            .addClass(SampleDataSourceDefinition.class)
            .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml")
            .addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties")
            .addAsWebInfResource("jboss-deployment-structure.xml") // Needed for jboss/wildfly h2 enablement
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(libs);
    return war;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:27,代码来源:ArquillianProjectArchive.java

示例12: createDeployment

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
    // Compile Safe Packages.
    Package projectPackage = Searcher.class.getPackage();

    File[] libs = Maven.resolver()
            .loadPomFromFile("pom.xml")
            .importRuntimeDependencies()
            .addDependency(MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)) // Log4J API
            .addDependency(MavenDependencies.createDependency("org.assertj:assertj-core", RUNTIME, false)) // AssertJ Fluent Assertions
            .resolve().withTransitivity().asFile();
    WebArchive war = ShrinkWrap.create(WebArchive.class, "misc-core-test.war")
            .addPackages(true, projectPackage)
            .addClass(Coordinate.class) // Need this cause of the maven resolver is part of the deployment
            .addClass(ArquillianProjectArchive.class) // The local deployer configuration
            .addClass(CustomerSearchProviderStub.class)
            .addClass(UniqueUnitSearchProviderStub.class)
            .addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties")
            .addAsWebInfResource("jboss-deployment-structure.xml") // Needed for jboss/wildfly h2 enablement
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(libs);
    return war;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:24,代码来源:ArquillianProjectArchive.java

示例13: createDeployment

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
@Deployment
public static WebArchive createDeployment() {
    // Compile Safe Packages.
    Package projectPackage = SampleGeneratorOperation.class.getPackage();

    File[] libs = Maven.resolver()
            .loadPomFromFile("pom.xml")
            .importRuntimeDependencies()
            .addDependency(MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)) // Log4J API
            .addDependency(MavenDependencies.createDependency("org.assertj:assertj-core", RUNTIME, false)) // AssertJ Fluent Assertions
            .resolve().withTransitivity().asFile();
    WebArchive war = ShrinkWrap.create(WebArchive.class, "sample-persistence-test.war")
            .addPackages(true, projectPackage.getName())
            .addClass(Coordinate.class) // Need this cause of the maven resolver is part of the deployment
            .addClass(SampleDataSourceDefinition.class) // Alle Datasources. More than we need.
            // Testresources.
            .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml")
            .addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties")
            .addAsWebInfResource("jboss-deployment-structure.xml") // Needed for jboss/wildfly h2 enablement
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(libs);
    return war;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:24,代码来源:SampleGeneratorIT.java

示例14: storeMiscPackageContentsFromDirectory

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
private static void storeMiscPackageContentsFromDirectory(URL directory, String packagePath,
                                                          ClassLoader classLoader, JavaArchive archive) {
    try {
        File file = new File(directory.toURI());
        File[] children;
        if (file.isDirectory() && (children = file.listFiles()) != null) {
            for (File child : children) {
                if (!child.isDirectory() && !child.getName().endsWith(".class")) {
                    String name = packagePath + '/' + child.getName() ;
                    archive.addAsResource(new ClassLoaderAsset(name, classLoader), name);
                }

            }
        }
    } catch (URISyntaxException | IllegalArgumentException e) {
        // ignore; sometimes the package is also visible on the classpath inside other jars
        // resulting in a URL that cannot be used to create a file
    }

}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:ExtensionUtils.java

示例15: storeMiscPackageContentsFromArchive

import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; //导入依赖的package包/类
private static void storeMiscPackageContentsFromArchive(String archivePath, String packagePath,
                                                          ClassLoader classLoader, JavaArchive archive) throws IOException {

    try {
        if (archivePath.startsWith("file:")) {
            archivePath = archivePath.substring(5);
        }
        ZipFile zip = new ZipFile(archivePath);
        Enumeration<? extends ZipEntry> entries = zip.entries();
        while (entries.hasMoreElements()) {
            ZipEntry entry = entries.nextElement();
            String name = entry.getName();
            if (name.startsWith(packagePath) && !name.endsWith(".class")
                    && !name.substring(packagePath.length() + 1).contains("/")
                    && name.charAt(name.length() - 1) != '/') {
                archive.addAsResource(new ClassLoaderAsset(name, classLoader), name);
            }
        }
    } catch (ZipException e) {
        throw new RuntimeException("Error handling file " + archivePath, e);
    }

}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:ExtensionUtils.java


注:本文中的org.jboss.shrinkwrap.api.asset.ClassLoaderAsset类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。