@Override public void prepareArchive(Archive a) { if ( this.deploymentModules != null ) { for (String each : this.deploymentModules) { int colonLoc = each.indexOf(':'); if ( colonLoc > 0 ) { String moduleName = each.substring(0, colonLoc ); String moduleSlot = each.substring(colonLoc+1); a.as(JARArchive.class).addModule( moduleName, moduleSlot ); } else { String moduleName = each; a.as(JARArchive.class).addModule( moduleName ); } } } }
protected TopologyArchive doAdvertise() { if (!as(ServiceActivatorArchive.class).containsServiceActivator(SERVICE_ACTIVATOR_CLASS_NAME)) { as(ServiceActivatorArchive.class).addServiceActivator(SERVICE_ACTIVATOR_CLASS_NAME); //as(JARArchive.class).addModule("org.wildfly.swarm.topology", "deployment"); } StringBuilder registrationConf = new StringBuilder(); List<String> names = getServiceNames(); for (String name : names) { Collection<String> tags = tagsByService.getOrDefault(name, Collections.emptyList()); registrationConf.append(name); if (!tags.isEmpty()) { registrationConf.append(" ") .append( tags.stream().collect(Collectors.joining(TAG_SEPARATOR)) ); } registrationConf.append("\n"); } as(JARArchive.class).add(new StringAsset(registrationConf.toString()), REGISTRATION_CONF); return this; }
private Archive<?> loadFromDirectory(File directory) throws IOException { JARArchive archive = ShrinkWrap.create(JARArchive.class); archive.as(ExplodedImporter.class).importDirectory(directory); return archive; }
URL resource = module.getExportedResource("swagger-ui.jar"); JARArchive webJar = ShrinkWrap.create(JARArchive.class); webJar.as(ZipImporter.class).importFrom(resource.openStream()); Map<ArchivePath, Node> content = webJar.getContent(); MatchResult result = matcher.toMatchResult(); String newPath = "/META-INF/resources/" + result.group(2); relocatedJar.add(asset, newPath);
Node node = archive.as(JARArchive.class).get("WEB-INF/web.xml"); if (node == null) { webXmlAsset = new WebXmlAsset(); archive.as(JARArchive.class).add(webXmlAsset); } else { Asset asset = node.getAsset(); if (!(asset instanceof WebXmlAsset)) { webXmlAsset = new WebXmlAsset(asset.openStream()); archive.as(JARArchive.class).add(webXmlAsset); } else { webXmlAsset = (WebXmlAsset) asset;
types.add(AnnotationBasedMain.class); archive.as(JARArchive.class).addModule("org.wildfly.swarm.container"); archive.as(JARArchive.class).addModule("org.wildfly.swarm.configuration"); } else { throw new IllegalArgumentException( } catch (UnsupportedOperationException e) { archive.as(JARArchive.class).addClasses(types.toArray(new Class[types.size()]));
@Override public boolean hasAdvertised() { return as(JARArchive.class).get(REGISTRATION_CONF) != null; }
public static void dumpJBossDeploymentStructure(Archive archive) { System.err.println("--- start jboss-deployment-structure.xml"); JBossDeploymentStructureAsset asset = archive.as(JARArchive.class).getDescriptorAsset(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(asset.openStream()))) { reader.lines().forEach(line -> System.err.println(line)); } catch (IOException e) { e.printStackTrace(); } System.err.println("--- end jboss-deployment-structure.xml"); } }
URL resource = module.getExportedResource("swagger-ui.jar"); JARArchive webJar = ShrinkWrap.create(JARArchive.class); webJar.as(ZipImporter.class).importFrom(resource.openStream()); Map<ArchivePath, Node> content = webJar.getContent(); MatchResult result = matcher.toMatchResult(); String newPath = "/META-INF/resources/" + result.group(2); relocatedJar.add(asset, newPath);
/** * Constructs a new instance using the underlying specified archive, which is required * * @param archive */ public SecuredImpl(ArchiveBase<?> archive) { super(archive); Node node = getArchive().as(JARArchive.class).get("WEB-INF/web.xml"); if (node == null) { this.asset = new WebXmlAsset(); getArchive().as(JARArchive.class).add(this.asset); } else { Asset asset = node.getAsset(); if (!(asset instanceof WebXmlAsset)) { this.asset = new WebXmlAsset(asset.openStream()); getArchive().as(JARArchive.class).add(this.asset); } else { this.asset = (WebXmlAsset) asset; } } // Setup web.xml this.asset.setContextParam("resteasy.scan", "true"); this.asset.setLoginConfig("KEYCLOAK", "ignored"); }
/** * Constructs a new instance using the underlying specified archive, which is required * * @param archive */ public TopologyArchiveImpl(ArchiveBase<?> archive) throws IOException { super(archive); Node regConf = as(JARArchive.class).get(REGISTRATION_CONF); if (regConf != null && regConf.getAsset() != null) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(regConf.getAsset().openStream()))) { reader.lines().forEach(this::parseConfigLine); } } }
public static void dumpJBossDeploymentStructure(Archive archive) { System.err.println("--- start jboss-deployment-structure.xml"); JBossDeploymentStructureAsset asset = archive.as(JARArchive.class).getDescriptorAsset(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(asset.openStream()))) { reader.lines().forEach(line -> System.err.println(line)); } catch (IOException e) { e.printStackTrace(); } System.err.println("--- end jboss-deployment-structure.xml"); } }
private void registerContainerFactory(Archive<?> archive, Class<?> clazz) { archive.as(JavaArchive.class) .addAsServiceProvider("org.wildfly.swarm.ContainerFactory", clazz.getName()) .addClass(clazz); archive.as(JARArchive.class).addModule("org.wildfly.swarm.container"); archive.as(JARArchive.class).addModule("org.wildfly.swarm.configuration"); }
/** * Constructs a new instance using the underlying specified archive, which is required * * @param archive */ public SecuredImpl(ArchiveBase<?> archive) { super(archive); Node node = getArchive().as(JARArchive.class).get("WEB-INF/web.xml"); if (node == null) { this.asset = new WebXmlAsset(); getArchive().as(JARArchive.class).add(this.asset); } else { Asset asset = node.getAsset(); if (!(asset instanceof WebXmlAsset)) { this.asset = new WebXmlAsset(asset.openStream()); getArchive().as(JARArchive.class).add(this.asset); } else { this.asset = (WebXmlAsset) asset; } } // Setup web.xml this.asset.setContextParam("resteasy.scan", "true"); this.asset.setLoginConfig("KEYCLOAK", "ignored"); }
private Archive<?> loadFromDirectory(File directory) throws IOException { JARArchive archive = ShrinkWrap.create(JARArchive.class); archive.as(ExplodedImporter.class).importDirectory(directory); return archive; }
public static void dumpJBossDeploymentStructure(Archive archive) { System.err.println("--- start jboss-deployment-structure.xml"); JBossDeploymentStructureAsset asset = archive.as(JARArchive.class).getDescriptorAsset(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(asset.openStream()))) { reader.lines().forEach(line -> System.err.println(line)); } catch (IOException e) { e.printStackTrace(); } System.err.println("--- end jboss-deployment-structure.xml"); } }
public void process() { if (archive.get("META-INF/arquillian-testable") == null) { return; } archive.add(new StringAsset(archive.getName()), "META-INF/arquillian-testable"); archive.as(JARArchive.class) .addModule("org.wildfly.swarm.arquillian.adapter"); archive.as(JARArchive.class) .addModule("org.wildfly.swarm.arquillian", "deployment"); archive.as(ServiceActivatorArchive.class) .addServiceActivator("org.wildfly.swarm.arquillian.deployment.TestableArchiveServiceActivator"); }
} else { try (InputStream contentStream = entry.getValue().getAsset().openStream()) { JARArchive jarArchive = ShrinkWrap.create(JARArchive.class, entry.getKey().get()).as(ZipImporter.class).importFrom(contentStream) .as(JARArchive.class); index(jarArchive, indexes);
public void process() { if (archive.get("META-INF/arquillian-testable") == null) { return; } archive.add(new StringAsset(archive.getName()), "META-INF/arquillian-testable"); archive.as(JARArchive.class) .addModule("org.wildfly.swarm.arquillian.adapter"); archive.as(JARArchive.class) .addModule("org.wildfly.swarm.arquillian", "deployment"); archive.as(ServiceActivatorArchive.class) .addServiceActivator("org.wildfly.swarm.arquillian.deployment.TestableArchiveServiceActivator"); }
} else { try (InputStream contentStream = entry.getValue().getAsset().openStream()) { JARArchive jarArchive = ShrinkWrap.create(JARArchive.class, entry.getKey().get()).as(ZipImporter.class).importFrom(contentStream) .as(JARArchive.class); index(jarArchive, indexes);