use of org.wildfly.swarm.flyway.FlywayFraction 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());
}
}
}
Aggregations