swarm = new Swarm(args); swarm.start(); if (System.getProperty("thorntail.inhibit.default-deployment") == null) { swarm.deploy(); if (System.getProperty("thorntail.inhibit.auto-stop") == null) { t.printStackTrace(); tryToStopAfterStartupError(t, swarm); displayUsage();
/** * Start the container with a deployment. * * <p>Effectively calls {@code start().deploy(deployment)}</p> * * @param deployment The deployment to deploy. * @return The container. * @throws Exception if an error occurs. * @see #start() * @see #deploy(Archive) */ public Swarm start(Archive<?> deployment) throws Exception { return start().deploy(deployment); }
public static void main(String[] args) throws Exception { Swarm container = new Swarm(); System.out.println("\tBuilding kie server deployable..."); JAXRSArchive deployment = createDeployment(container); 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); } }
public static void main(String... args) throws Exception { Swarm container = new Swarm(); container.fraction(ContainerUtils.loggingFraction()); JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class); deployment.addPackage(Main.class.getPackage()); deployment.as(RibbonArchive.class).advertise("pricing"); deployment.as(Secured.class); ContainerUtils.addExternalKeycloakJson(deployment); container.start(); container.deploy(deployment); } }
@RunWith(Arquillian.class) public class SomeTest { @Deployment public static JavaArchive createTestArchive() { /* ... */ } @CreateSwarm public static Swarm newContainer() throws Exception { Swarm swarm = new Swarm(); // configure your swarm thingy return swarm; }
/** Main entry-point. * * @param args Ignored. * @throws Exception if an error occurs. */ 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" ); } Module bootstrap = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("swarm.application")); ServiceLoader<ContainerFactory> factory = bootstrap.loadService(ContainerFactory.class); Iterator<ContainerFactory> factoryIter = factory.iterator(); if ( ! factoryIter.hasNext() ) { simpleMain( args ); } else { factoryMain( factoryIter.next(), args ); } }
this.webContent = Swarm.artifact(content); } catch (Exception e) { e.printStackTrace();
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; } }
public static void main(String[] args) throws Exception { Swarm container = new Swarm(); container.fraction(new DatasourcesFraction() .jdbcDriver("h2", (d) -> { d.driverClassName("org.h2.Driver"); ); container.fraction(TransactionsFraction.createDefaultFraction()); container.start(); container.deploy(deployment);
/** * Start the container with a deployment. * * <p>Effectively calls {@code start().deploy(deployment)}</p> * * @param deployment The deployment to deploy. * @return The container. * @throws Exception if an error occurs. * @see #start() * @see #deploy(Archive) */ public Swarm start(Archive<?> deployment) throws Exception { return start().deploy(deployment); }
public static void simpleMain(String...args) throws Exception { Container container = new Swarm(args); container.start(); container.deploy(); }
/** * Main entry-point. * * @param args Ignored. * @throws Exception if an error occurs. */ 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"); } Module bootstrap = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("swarm.application")); ServiceLoader<ContainerFactory> factory = bootstrap.loadService(ContainerFactory.class); Iterator<ContainerFactory> factoryIter = factory.iterator(); if (!factoryIter.hasNext()) { simpleMain(args); } else { factoryMain(factoryIter.next(), args); } }
public void deploy() throws Exception { List<SimpleKey> subkeys = configView.simpleSubkeys(ConfigKey.of("thorntail", "deployment")); for (SimpleKey subkey : subkeys) { String spec = subkey.name(); if (!spec.contains(":")) { // TODO Should we really silently ignore this? Rather warn the user about a problem in his config? continue; } String[] parts = spec.split(":"); String groupId = parts[0]; int p = parts[1].lastIndexOf('.'); String artifactId; String packaging; if (p == -1) { artifactId = parts[1]; packaging = "jar"; } else { artifactId = parts[1].substring(0, p); packaging = parts[1].substring(p + 1); } JavaArchive artifact = Swarm.artifact(groupId + ":" + artifactId + ":" + packaging + ":*", artifactId + "." + packaging); deployer.get().deploy(artifact, spec); } } }
public static void main(String... args) throws Exception { Swarm container = new Swarm(); container.fraction(ContainerUtils.loggingFraction()); container.fraction(new JPAFraction() .defaultDatasource("LibraryDS")); JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class); deployment.addPackage(Main.class.getPackage()); deployment.as(RibbonArchive.class).advertise("library"); deployment.as(Secured.class) .protect("/items") .withMethod("GET") .withRole("*"); ContainerUtils.addExternalKeycloakJson(deployment); deployment.add(new ClassLoaderAsset("META-INF/persistence.xml", Main.class.getClassLoader()), "WEB-INF/classes/META-INF/persistence.xml"); deployment.add(new ClassLoaderAsset("project-stages.yml", Main.class.getClassLoader()), "WEB-INF/classes/project-stages.yml"); deployment.addAllDependencies(); container.start(); container.deploy(deployment); } }
swarm = new Swarm(args); swarm.start(); if (System.getProperty("thorntail.inhibit.default-deployment") == null) { swarm.deploy(); if (System.getProperty("thorntail.inhibit.auto-stop") == null) { t.printStackTrace(); tryToStopAfterStartupError(t, swarm); displayUsage();
/** * Start the container with a deployment. * * <p>Effectively calls {@code start().deploy(deployment)}</p> * * @param deployment The deployment to deploy. * @return The container. * @throws Exception if an error occurs. * @see #start() * @see #deploy(Archive) */ public Swarm start(Archive<?> deployment) throws Exception { return start().deploy(deployment); }
/** * Main entry-point. * * @param args Ignored. * @throws Exception if an error occurs. */ 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"); } Module bootstrap = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("swarm.application")); ServiceLoader<ContainerFactory> factory = bootstrap.loadService(ContainerFactory.class); Iterator<ContainerFactory> factoryIter = factory.iterator(); if (!factoryIter.hasNext()) { simpleMain(args); } else { factoryMain(factoryIter.next(), args); } }
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(":")) { // TODO Should we really silently ignore this? Rather warn the user about a problem in his config? continue; } String[] parts = spec.split(":"); String groupId = parts[0]; int p = parts[1].lastIndexOf('.'); String artifactId; String packaging; if (p == -1) { artifactId = parts[1]; packaging = "jar"; } else { artifactId = parts[1].substring(0, p); packaging = parts[1].substring(p + 1); } JavaArchive artifact = Swarm.artifact(groupId + ":" + artifactId + ":" + packaging + ":*", artifactId + "." + packaging); deployer.get().deploy(artifact, spec); } } }
swarm = new Swarm(args); swarm.start(); if (System.getProperty("swarm.inhibit.default-deployment") == null) { swarm.deploy(); if (System.getProperty("swarm.inhibit.auto-stop") == null) { t.printStackTrace(); tryToStopAfterStartupError(t, swarm); displayUsage();