*/
private void startApply(HttpServletResponse response, VariablesSecureApp vars)
throws IOException, ServletException {
// final PrintStream oldOut=System.out;
try {
final AntExecutor ant = new AntExecutor(vars.getSessionValue("#sourcePath"));
String fileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + "-apply.log";
// final OBPrintStream obps=new OBPrintStream(new
// PrintStream(response.getOutputStream()));
// System.setOut(obps);
// ant.setOBPrintStreamLog(response.getWriter());
final PrintStream out = new PrintStream(response.getOutputStream());
ant.setOBPrintStreamLog(new PrintStream(out));
fileName = ant.setLogFile(fileName);
// obps.setLogFile(new File(fileName+".db"));
ant.setLogFileInOBPrintStream(new File(fileName));
vars.setSessionObject("ApplyModules|Log", ant);
// do not execute tranlsation process (all entries should be already in the module)
ant.setProperty("tr", "no");
final Vector<String> tasks = new Vector<String>();
final String unnappliedModules = getUnnapliedModules();
if (ApplyModulesData.isUpdatingCoreOrTemplate(this)) {
tasks.add("update.database");
tasks.add("core.lib");
tasks.add("wad.lib");
tasks.add("trl.lib");
tasks.add("compile.complete.deploy");
ant.setProperty("apply.on.create", "true");
} else {
if (ApplyModulesData.compileCompleteNeeded(this)) {
// compile complete is needed for templates because in this case it is not needed which
// elements belong to the template and for uninistalling modules in order to remove old
// files and references
ant.setProperty("apply.modules.complete.compilation", "true");
}
ant.setProperty("force", "true");
tasks.add("apply.modules");
ant.setProperty("module", unnappliedModules);
}
ant.runTask(tasks);
ant.setFinished(true);
if (ant.hasErrorOccured()) {
createModuleLog(false, ant.getErr());
} else {
createModuleLog(true, null);
}
response.setContentType("text/plain; charset=UTF-8");