if (LOGGER.isErrorEnabled()) {
LOGGER.error(
"Failed to create the directory: " + containerHome + ". Details: " + exceptionOnMkDir.getMessage(),
exceptionOnMkDir);
}
throw new ConfigurationException("Failed to create the directory: " + containerHome + ". Details: "
+ exceptionOnMkDir.getMessage(), exceptionOnMkDir);
}
}
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Installing " + containerName + "...");
LOGGER.info("Downloading container from: " + remoteLocation);
LOGGER.info("Container file: " + containerFile);
}
/*
* Download and configure the container.
*/
String installDir;
try {
final URL remoteLocationUrl = new URL(this.remoteLocation + containerFile);
installDir = StringUtils.substringBeforeLast(StringUtils.chomp(containerHome, "/"), "/");
final ZipURLInstaller installer = new ZipURLInstaller(remoteLocationUrl, installDir, installDir);
installer.install();
} catch (final MalformedURLException e) {
throw new DeployException("Failed to download container!", e);
}
/*
* Rename the install directory to the container home directory so it
* doesn't matter what the name is of the zip file and avoid case
* sensitive issues on Linux.
*/
final String containerDir = StringUtils.stripEnd(containerFile, ".zip");
final File installedDir = new File(installDir + "/" + containerDir + "/");
final File destenationDir = new File(containerHome);
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Renaming: " + installedDir.getPath());
LOGGER.info("To: " + destenationDir.getPath());
}
final boolean renamed = installedDir.renameTo(destenationDir);
if (!renamed) {
final String msg = "Failed to rename container install directory to home directory name!";
if (LOGGER.isErrorEnabled()) {
LOGGER.error(msg);
}
throw new ConfigurationException(msg);
}
/*
* Setup the system properties.
*/