catalinaHome = SystemEnvironmentVariables.getEnvironmentVariable("CATALINA_HOME");
logger.debug("\"CATALINA_HOME\" = " + catalinaHome);
} catch (IOException e) {
logger.error("Unable to prepare " + sysName + " system. Error message is \"" + e.getLocalizedMessage() + "\"");
throw new CannotPrepareSystemException(sysName, e.getLocalizedMessage());
}
catalina_sh_name = catalinaHome + File.separator + scriptName;
// Verifico l'esistenza e la possibilita' di leggere e scrivere
catalina_file = new File(catalina_sh_name);
if (! catalina_file.exists()) {
logger.error("File \"" + catalina_sh_name + "\" non exists. Unable to proceed.");
throw new CannotPrepareSystemException(sysName, "File \"" + catalina_sh_name + "\" non exists. Unable to proceed.");
} else if (! catalina_file.canRead()) {
logger.error("Can't read \"" + catalina_sh_name + "\". Unable to proceed.");
throw new CannotPrepareSystemException(sysName, "Can't read \"" + catalina_sh_name + "\". Unable to proceed.");
} else if (! catalina_file.canWrite()) {
logger.error("Can't write to \"" + catalina_sh_name + "\". Unable to proceed.");
throw new CannotPrepareSystemException(sysName, "Can't write to \"" + catalina_sh_name + "\". Unable to proceed.");
}
// Ora modifico il file
try {
File catalinaBak_file = new File(catalina_sh_name + ".BAK");
if (! catalina_file.renameTo(catalinaBak_file)) {
logger.error("Unable to rename " + catalina_sh_name);
throw new CannotPrepareSystemException(sysName, "Unable to rename " + catalina_sh_name);
}
modifyScript(catalinaBak_file,catalina_file,cfg,dataMgr);
changePermissions(catalina_file);
} catch (IOException e) {
logger.error("Unable to prepare " + sysName + " system. Error message is \"" + e.getLocalizedMessage() + "\"");
throw new CannotPrepareSystemException(sysName, e.getLocalizedMessage());
}
logger.trace("Physical Activator for Tomca5 has prepared the system");
catalina_file = null;