use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.
the class ArquillianTest method createDeployment.
@Deployment
public static Archive createDeployment() throws Exception {
WARArchive deployment = ShrinkWrap.create(WARArchive.class, "services.war");
deployment.addClass(ServicesServlet.class);
deployment.addClass(TransformerServlet.class);
return deployment;
}
use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.
the class FlywayMigrationArchivePreparer method process.
@Override
public void process() {
if (archive.getName().endsWith(".war")) {
WARArchive webArchive = archive.as(WARArchive.class);
WebXmlAsset webXml = webArchive.findWebXmlAsset();
webXml.addListener("org.wildfly.swarm.flyway.deployment.FlywayMigrationServletContextListener");
FlywayFraction flywayFraction = flywayFractionInstance.get();
if (flywayFraction.usePrimaryDataSource()) {
String dataSourceJndi = getDatasourceNameJndi();
webXml.setContextParam(FlywayMigrationServletContextListener.FLYWAY_JNDI_DATASOURCE, dataSourceJndi);
} else {
webXml.setContextParam(FlywayMigrationServletContextListener.FLYWAY_JDBC_URL, flywayFraction.jdbcUrl());
webXml.setContextParam(FlywayMigrationServletContextListener.FLYWAY_JDBC_USER, flywayFraction.jdbcUser());
webXml.setContextParam(FlywayMigrationServletContextListener.FLYWAY_JDBC_PASSWORD, flywayFraction.jdbcPassword());
}
}
}
use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.
the class JaegerInstaller method process.
@Override
public void process() throws Exception {
JaegerFraction fraction = jaegerFractionInstance.get();
logger.info("Determining whether to install Jaeger integration or not.");
logger.info("JaegerFraction instance: " + fraction);
if (archive.getName().endsWith(".war")) {
logger.logf(Logger.Level.INFO, "Installing the Jaeger integration for the deployment %s", archive.getName());
WARArchive webArchive = archive.as(WARArchive.class);
WebXmlAsset webXml = webArchive.findWebXmlAsset();
logger.logf(Logger.Level.INFO, "Adding the listener org.wildfly.swarm.jaeger.deployment.JaegerInitializer");
webXml.addListener("org.wildfly.swarm.jaeger.deployment.JaegerInitializer");
setContextParamIfNotNull(webXml, JAEGER_SERVICE_NAME, fraction.getServiceName());
setContextParamIfNotNull(webXml, JAEGER_SERVICE_NAME, fraction.getServiceName());
setContextParamIfNotNull(webXml, JAEGER_SAMPLER_TYPE, fraction.getSamplerType());
setContextParamIfNotNull(webXml, JAEGER_SAMPLER_PARAM, fraction.getSamplerParameter());
setContextParamIfNotNull(webXml, JAEGER_SAMPLER_MANAGER_HOST_PORT, fraction.getSamplerManagerHost());
setContextParamIfNotNull(webXml, JAEGER_REPORTER_LOG_SPANS, fraction.getReporterLogSpans());
setContextParamIfNotNull(webXml, JAEGER_AGENT_HOST, fraction.getAgentHost());
setContextParamIfNotNull(webXml, JAEGER_AGENT_PORT, fraction.getAgentPort());
setContextParamIfNotNull(webXml, JAEGER_REPORTER_FLUSH_INTERVAL, fraction.getReporterFlushInterval());
setContextParamIfNotNull(webXml, JAEGER_REPORTER_MAX_QUEUE_SIZE, fraction.getReporterMaxQueueSize());
webXml.setContextParam("skipOpenTracingResolver", "true");
}
}
use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.
the class SwaggerArchivePreparer method process.
@Override
public void process() {
if (this.deploymentContext != null && this.deploymentContext.isImplicit()) {
return;
}
if (archive.getName().endsWith(".war")) {
// Create a JAX-RS deployment archive
WARArchive deployment = archive.as(WARArchive.class);
deployment.addModule("io.swagger");
// Make the deployment a swagger archive
SwaggerArchive swaggerArchive = deployment.as(SwaggerArchive.class);
// SWARM-1667: Add the custom CDI extension to the deployment to provide a workaround solution.
deployment.addModule("org.wildfly.swarm.swagger", "deployment");
deployment.addAsServiceProvider(Extension.class.getName(), "org.wildfly.swarm.swagger.deployment.SwaggerExtension");
if (this.title != null) {
swaggerArchive.setTitle(this.title);
}
if (this.description != null) {
swaggerArchive.setDescription(this.description);
}
if (this.packages != null && !this.packages.isEmpty()) {
swaggerArchive.setResourcePackages(this.packages.toArray(new String[this.packages.size()]));
}
if (this.tosUrl != null) {
swaggerArchive.setTermsOfServiceUrl(this.tosUrl);
}
if (this.license != null) {
swaggerArchive.setLicense(this.license);
}
if (this.licenseUrl != null) {
swaggerArchive.setLicenseUrl(this.licenseUrl);
}
if (this.version != null) {
swaggerArchive.setVersion(this.version);
}
if (this.schemes != null && !this.schemes.isEmpty()) {
swaggerArchive.setSchemes(this.schemes.toArray(new String[this.schemes.size()]));
}
if (this.host != null) {
swaggerArchive.setHost(this.host);
}
// get the context root from the deployment and tell swagger about it
if (this.root != null) {
swaggerArchive.setContextRoot(this.root);
} else {
if (!swaggerArchive.hasContextRoot()) {
if (deployment.getContextRoot() != null) {
swaggerArchive.setContextRoot(deployment.getContextRoot());
} else {
swaggerArchive.setContextRoot(contextPath.get());
}
}
}
// org.wildfly.swarm package space
if (!swaggerArchive.hasResourcePackages()) {
String packageName = null;
for (Map.Entry<ArchivePath, Node> entry : deployment.getContent().entrySet()) {
final ArchivePath key = entry.getKey();
if (key.get().endsWith(".class")) {
String parentPath = key.getParent().get();
parentPath = parentPath.replaceFirst("/", "");
String parentPackage = parentPath.replaceFirst(".*/classes/", "");
parentPackage = parentPackage.replaceAll("/", ".");
if (parentPackage.startsWith("org.wildfly.swarm")) {
SwaggerMessages.MESSAGES.ignoringPackage(parentPackage);
} else {
packageName = parentPackage;
break;
}
}
}
if (packageName == null) {
SwaggerMessages.MESSAGES.noEligiblePackages(archive.getName());
} else {
SwaggerMessages.MESSAGES.configureSwaggerForPackage(archive.getName(), packageName);
swaggerArchive.setResourcePackages(packageName);
}
} else {
SwaggerMessages.MESSAGES.configureSwaggerForSeveralPackages(archive.getName(), Arrays.asList(swaggerArchive.getResourcePackages()));
}
// Now add the swagger resources to our deployment
deployment.addClass(io.swagger.jaxrs.listing.ApiListingResource.class);
deployment.addClass(io.swagger.jaxrs.listing.SwaggerSerializers.class);
}
}
use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.
the class ODataWarDeploymentProducer method odataWar.
@Produces
public Archive odataWar() throws Exception {
// TODO: Keycloak Integration for security (see Jolokia project)
WARArchive war = ShrinkWrap.create(WARArchive.class, "odata.war").setContextRoot(this.fraction.getContext()).setWebXML(this.getClass().getResource("/web.xml"));
war.addModule("org.jboss.teiid.olingo");
return war;
}
Aggregations