jbossPort = args[16];
jbossJdbcModuleName = args[17];
jbossAdminUsername = args[18];
jbossAdminPassword = args[19];
final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
handler.logOutput("Configure web.xml file according to " + selectedContainer + " properties", true);
InstallLog.getInstance().info("Configure web.xml file according to " + selectedContainer + " properties");
if (withDataSource) {
fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + CoreWebXml.PATH), CoreWebXml.
withDataSource());
switch (selectedContainer) {
case JBOSS:
fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + CoreWebXml.PATH),
CoreWebXml.withDataSourceForJBoss());
fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId
+ PersistenceContextEMFactoryXml.PATH), PersistenceContextEMFactoryXml.FILE);
fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId
+ JBossDeploymentStructureXml.PATH),
String.format(JBossDeploymentStructureXml.FILE, jbossJdbcModuleName));
break;
case GLASSFISH:
fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + GlassfishCoreWebXml.PATH),
GlassfishCoreWebXml.withDataSource());
break;
}
}
final MavenUtils mavenUtils = new MavenUtils(mavenDir, handler);
mavenUtils.createPackage(installPath + "/" + artifactId, confDirectory, logsDirectory, bundlesDirectory);
switch (selectedContainer) {
case TOMCAT:
final Tomcat tomcat = new Tomcat(
tomcatSsl, tomcatHost, tomcatPort, installPath, artifactId, tomcatUser, tomcatPassword, handler);
boolean deployCoreResult = tomcat.deployCore();
if (deployCoreResult) {
handler.logOutput("Core successfully deployed ", true);
InstallLog.getInstance().info("Core successfully deployed ");
} else {
final String messageError = "Deploy core on Tomcat failed";
handler.emitError(messageError, messageError);
InstallLog.getInstance().error(messageError);
}
boolean deployConsoleResult = tomcat.deployConsole();
if (deployConsoleResult) {
handler.logOutput("Console successfully deployed ", true);
InstallLog.getInstance().info("Console successfully deployed ");
} else {
final String messageError = "Deploy console on Tomcat failed";
handler.emitError(messageError, messageError);
InstallLog.getInstance().error(messageError);
}
break;
case JBOSS:
final JBoss jBoss = new JBoss(
jbossSsl, jbossHost, jbossPort, jbossAdminUsername,
jbossAdminPassword, installPath, artifactId, handler);
boolean deployCoreJboss = jBoss.deployCore();
if (deployCoreJboss) {
handler.logOutput("Core successfully deployed ", true);
InstallLog.getInstance().info("Core successfully deployed ");
} else {
final String messageError = "Deploy core on JBoss failed";
handler.emitError(messageError, messageError);
InstallLog.getInstance().error(messageError);
}
boolean deployConsoleJBoss = jBoss.deployConsole();
if (deployConsoleJBoss) {
handler.logOutput("Console successfully deployed ", true);
InstallLog.getInstance().info("Console successfully deployed ");
} else {
final String messageError = "Deploy console on JBoss failed";
handler.emitError(messageError, messageError);
InstallLog.getInstance().error(messageError);
}
break;
case GLASSFISH:
final String createJavaOptCommand = "sh " + glassfishDir + Glassfish.CREATE_JAVA_OPT_COMMAND;
fileSystemUtils.exec(createJavaOptCommand, null);
final Glassfish glassfish = new Glassfish(installPath, artifactId);
fileSystemUtils.exec("sh " + glassfishDir + Glassfish.DEPLOY_COMMAND + glassfish.deployCore(), null);
fileSystemUtils.exec("sh " + glassfishDir + Glassfish.DEPLOY_COMMAND + glassfish.deployConsole(), null);
break;
}
}