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


Java Swarm类代码示例

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


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

示例1: main

import org.wildfly.swarm.Swarm; //导入依赖的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: main

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	Swarm container = new Swarm();

    System.out.println("\tBuilding kie server deployable...");
    JAXRSArchive deployment = createDeployment(container);

    container.fraction(
        new LoggingFraction()
            .consoleHandler("CONSOLE", c -> {
                c.level(Level.INFO);
                c.formatter("%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n");
            })
            .rootLogger(Level.INFO, "CONSOLE")
    );
    
    System.out.println("\tStaring Wildfly Swarm....");
    container.start();    
    
    System.out.println("\tConfiguring kjars to be auto deployed to server " + Arrays.toString(args));
    installKJars(args);
    
    System.out.println("\tDeploying kie server ....");
    container.deploy(deployment);
}
 
开发者ID:jesuino,项目名称:kie-ml,代码行数:25,代码来源:KieServerMain.java

示例3: createDeployment

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
protected static JAXRSArchive createDeployment(Swarm container) throws Exception {
    System.out.println("\tConfiguration folder is " + configFolder);
    
    LoginModule<?> loginModule = new LoginModule<>("UsersRoles");
    loginModule.flag(Flag.REQUIRED)
    .code("UsersRoles")
    .moduleOption("usersProperties", configFolder + "/security/application-users.properties")
    .moduleOption("rolesProperties", configFolder + "/security/application-roles.properties");
    
    SecurityDomain<?> security = new SecurityDomain<>("other")
            .classicAuthentication(new ClassicAuthentication<>()
                    .loginModule(loginModule)); 
    container.fraction(new SecurityFraction().securityDomain(security));

    JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "kie-server.war");
    deployment.staticContent();
    deployment.addAllDependencies();
    deployment.addAsWebInfResource(new File(configFolder + "/web/web.xml"), "web.xml");
    deployment.addAsWebInfResource(new File(configFolder + "/web/jboss-web.xml"), "jboss-web.xml");
    
            
    return deployment;
    
}
 
开发者ID:jesuino,项目名称:kie-ml,代码行数:25,代码来源:AbstractKieServerMain.java

示例4: newContainer

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
@CreateSwarm
public static Swarm newContainer() throws Exception {
    return new Swarm()
            .outboundSocketBinding("standard-sockets",
                    new OutboundSocketBinding("remote-activemq")
                            .remoteHost("localhost")
                            .remotePort(61616))
            .fraction(new MessagingFraction()
                    .server("default", server -> {
                        server.remoteConnector("remote-activemq", connector -> {
                            connector.socketBinding("remote-activemq");
                        });
                        server.pooledConnectionFactory("remote", factory -> {
                            factory.connectors("remote-activemq");
                            factory.entry("java:/jms/remoteCF");
                        });
                    })
            );
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:20,代码来源:RemoteMessagingArquillianTest.java

示例5: testDeploymentFailure

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
@Test
public void testDeploymentFailure() throws Exception {
    Swarm swarm = new Swarm();
    swarm.start();
    JARArchive a = ShrinkWrap.create(JARArchive.class, "bad-deployment.jar");
    a.addModule("com.i.do.no.exist");
    try {
        swarm.deploy(a);
        fail("should have throw a DeploymentException");
    } catch (DeploymentException e) {
        // expected and correct
        assertThat(e.getArchive()).isSameAs(a);
        assertThat(e.getMessage()).contains("org.jboss.modules.ModuleNotFoundException: com.i.do.no.exist");
    } finally {
        swarm.stop();
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:18,代码来源:DeploymentFailureTest.java

示例6: getContainer

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
@CreateSwarm
public static Swarm getContainer() throws Exception {
    Swarm container = new Swarm();
    container.fraction(new JAXRSFraction());
    container.fraction(new MonitorFraction().securityRealm("TestRealm"));
    container.fraction(
            new ManagementFraction()
                    .securityRealm("TestRealm", (realm) -> {
                        realm.inMemoryAuthentication((authn) -> {
                            authn.add(new Properties() {{
                                put("admin", "password");
                            }}, true);
                        });
                        realm.inMemoryAuthorization();
                    })
    );

    return container;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:20,代码来源:MonitorSecurityTest.java

示例7: newContainer

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
@CreateSwarm
public static Swarm newContainer() throws Exception {
    System.out.println("Log file: " + LOG_FILE);

    return new Swarm()
            .fraction(
                    new LoggingFraction()
                            .defaultColorFormatter()
                            .consoleHandler(Level.INFO, "COLOR_PATTERN")
                            .fileHandler("FILE", f -> {

                                Map<String, String> fileProps = new HashMap<>();
                                fileProps.put("path", LOG_FILE);
                                f.file(fileProps);
                                f.level(Level.INFO);
                                f.formatter("%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n");

                            })
                            .rootLogger(Level.INFO, "CONSOLE", "FILE")
            )
            .fraction(new ZipkinFraction("wildfly-swarm-service"));
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:23,代码来源:ZipkinJAXRSTest.java

示例8: newContainer

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
@CreateSwarm
public static Swarm newContainer() throws Exception {
    return new Swarm()
            .fraction(
                    ManagementFraction.createDefaultFraction()
                            .httpInterfaceManagementInterface((iface) -> {
                                iface.securityRealm("ManagementRealm");
                            })
                            .securityRealm("ManagementRealm", (realm) -> {
                                realm.inMemoryAuthentication((authn) -> {
                                    authn.add(new Properties() {{
                                        put("bob", "9b511b00aa7f2265621e38d2cf665f2f");
                                    }});
                                });
                                realm.inMemoryAuthorization();
                            })
            );
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:19,代码来源:ArqSecuredManagementInterfaceWithPrecomputedPropertiesTest.java

示例9: newContainer

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
@CreateSwarm
public static Swarm newContainer() throws Exception {
    return new Swarm()
            .fraction(
                    ManagementFraction.createDefaultFraction()
                            .httpInterfaceManagementInterface((iface) -> {
                                iface.securityRealm("TestRealm");
                            })
                            .securityRealm("TestRealm", (realm) -> {
                                realm.inMemoryAuthentication((authn) -> {
                                    authn.add("bob", "tacos!", true);
                                });
                                realm.inMemoryAuthorization((authz) -> {
                                    authz.add("bob", "admin");
                                });
                            })
            );
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:19,代码来源:ArqSecuredManagementInterfaceTest.java

示例10: newContainer

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
@CreateSwarm
public static Swarm newContainer() throws Exception {
    return new Swarm()
            .fraction(
                    ManagementFraction.createDefaultFraction()
                            .httpInterfaceManagementInterface((iface) -> {
                                iface.securityRealm("ManagementRealm");
                            })
                            .securityRealm("ManagementRealm", (realm) -> {
                                realm.inMemoryAuthentication((authn) -> {
                                    authn.add(new Properties() {{
                                        put("bob", "tacos!");
                                    }}, true);
                                });
                                realm.inMemoryAuthorization();
                            })
            );
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:19,代码来源:ArqSecuredManagementInterfaceWithPropertiesTest.java

示例11: main

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
public static void main(String... args) throws Exception {
    swarm = new Swarm(args);

    swarm.fraction(
            new DatasourcesFraction()
                    .jdbcDriver("h2", (d) -> {
                        d.driverClassName("org.h2.Driver");
                        d.xaDatasourceClass("org.h2.jdbcx.JdbcDataSource");
                        d.driverModuleName("com.h2database.h2");
                    })
                    .dataSource("ExampleDS", (ds) -> {
                        ds.driverName("h2");
                        ds.connectionUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");
                        ds.userName("sa");
                        ds.password("sa");
                    })
    );

    swarm.start().deploy();
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:Main.java

示例12: main

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
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);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:Main.java

示例13: newContainer

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
@CreateSwarm
public static Swarm newContainer() throws Exception {
    return new Swarm()
            .fraction(
                    new LoggingFraction().periodicSizeRotatingFileHandler("FILE", (h) -> {
                        h.level(Level.INFO)
                                .append(true)
                                .suffix(".yyyy-MM-dd")
                                .rotateSize("30m")
                                .enabled(true)
                                .encoding("UTF-8")
                                .maxBackupIndex(2);
                        Map<String, String> fileSpec = new HashMap<>();
                        fileSpec.put("path", logFile);
                        h.file(fileSpec);
                    }).logger("br.org.sistemafieg.cliente", (l) -> {
                        l.level(Level.INFO)
                                .handler("FILE");
                    }));
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:SWARM553Test.java

示例14: main

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
public static void main(String... args) throws Exception {
    if (System.getProperty("boot.module.loader") == null) {
        System.setProperty("boot.module.loader", "org.wildfly.swarm.bootstrap.modules.BootModuleLoader");
    }

    String clsName = System.getProperty(ANNOTATED_CLASS_NAME);

    Class<?> cls = Class.forName(clsName);

    Method[] methods = cls.getMethods();

    for (Method method : methods) {
        if (!Modifier.isStatic(method.getModifiers())) {
            continue;
        }

        CreateSwarm anno = method.getAnnotation(CreateSwarm.class);
        if (anno == null) {
            continue;
        }

        boolean startEagerly = anno.startEagerly();
        ((Swarm) method.invoke(null)).start().deploy();
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:26,代码来源:AnnotationBasedMain.java

示例15: deploy

import org.wildfly.swarm.Swarm; //导入依赖的package包/类
public void deploy() throws Exception {
    List<SimpleKey> subkeys = configView.simpleSubkeys(ConfigKey.of("swarm", "deployment"));

    for (SimpleKey subkey : subkeys) {
        String spec = subkey.name();
        if (spec.contains(":")) {
            String[] parts = spec.split(":");
            String groupId = parts[0];
            parts = parts[1].split("\\.");
            String artifactId = parts[0];
            String packaging = parts[1];

            JavaArchive artifact = Swarm.artifact(groupId + ":" + artifactId + ":" + packaging + ":*", artifactId + "." + packaging);
            deployer.get().deploy(artifact, spec);
        }
    }

}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:19,代码来源:ArtifactDeployer.java


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