Examples of AntExecutor


Examples of org.openbravo.erpCommon.utility.AntExecutor

   */
  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");
View Full Code Here

Examples of org.openbravo.erpCommon.utility.AntExecutor

   * @throws ServletException
   */
  private void updateLog(HttpServletResponse response, VariablesSecureApp vars) throws IOException,
      ServletException {
    try {
      final AntExecutor ant = (AntExecutor) vars.getSessionObject("ApplyModules|Log");
      if (ant != null)
        ant.setPrintWriter(response.getWriter());
    } catch (final Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of org.openbravo.erpCommon.utility.AntExecutor

    String title = "";
    String description = "";
    final String strLanguage = vars.getLanguage();

    try {
      final AntExecutor ant = (AntExecutor) vars.getSessionObject("ApplyModules|Log");
      if (ant != null)
        description = ant.getErr();
      if (description.startsWith("SuccessRebuild")) {
        type = "Success";
        title = Utility.messageBD(this, type, strLanguage);
        description = "<![CDATA[" + Utility.messageBD(this, description, strLanguage) + "]]>";
      } else {
View Full Code Here

Examples of org.openbravo.erpCommon.utility.AntExecutor

    final String srcPath = args[0];
    final File srcDir = new File(srcPath);
    final File baseDir = srcDir.getParentFile();
    try {
      log.debug("Restarting tomcat with basedir " + baseDir);
      final AntExecutor antExecutor = new AntExecutor(baseDir.getAbsolutePath());
      antExecutor.runTask("tomcat.restart.do");
    } catch (final Exception e) {
      e.printStackTrace(System.err);
      throw new OBException(e);
    }
  }
View Full Code Here

Examples of org.openbravo.erpCommon.utility.AntExecutor

  public static void restart() {
    final String baseDirPath = OBPropertiesProvider.getInstance().getOpenbravoProperties()
        .getProperty("source.path");
    try {
      log.debug("Restarting tomcat with basedir " + baseDirPath);
      final AntExecutor antExecutor = new AntExecutor(baseDirPath);
      antExecutor.runTask("tomcat.restart");
    } catch (final Exception e) {
      e.printStackTrace(System.err);
      throw new OBException(e);
    }
  }
View Full Code Here

Examples of org.openbravo.erpCommon.utility.AntExecutor

    final String srcPath = args[0];
    final File srcDir = new File(srcPath);
    final File baseDir = srcDir.getParentFile();
    try {
      log.debug("Reloading context with basedir " + baseDir);
      final AntExecutor antExecutor = new AntExecutor(baseDir.getAbsolutePath());
      antExecutor.runTask("tomcat.reload.do");
    } catch (final Exception e) {
      e.printStackTrace(System.err);
      throw new OBException(e);
    }
  }
View Full Code Here

Examples of org.openbravo.erpCommon.utility.AntExecutor

  public static void reload() {
    final String baseDirPath = OBPropertiesProvider.getInstance().getOpenbravoProperties()
        .getProperty("source.path");
    try {
      log.debug("Reloading context with basedir " + baseDirPath);
      final AntExecutor antExecutor = new AntExecutor(baseDirPath);
      antExecutor.runTask("tomcat.reload");
    } catch (final Exception e) {
      e.printStackTrace(System.err);
      throw new OBException(e);
    }
  }
View Full Code Here

Examples of org.openbravo.erpCommon.utility.AntExecutor

  public static void main(String[] args) {
    final String srcPath = args[0];
    final File srcDir = new File(srcPath);
    final File baseDir = srcDir.getParentFile();
    try {
      final AntExecutor antExecutor = new AntExecutor(baseDir.getAbsolutePath());
      antExecutor.runTask("apply.module.forked");
    } catch (final Exception e) {
      e.printStackTrace(System.err);
      throw new OBException(e);
    }
  }
View Full Code Here

Examples of org.openbravo.erpCommon.utility.AntExecutor

  protected void doTest(String task, String additionalPath) {
    log.info("Running ant task " + task);
    final PrintWriter outputLogWriter = new PrintWriter(System.err);

    try {
      final AntExecutor ant = new AntExecutor(getProperty("source.path")
          + (additionalPath != null ? "/" + additionalPath : ""));
      ant.setOBPrintStreamLog(System.err);
      // ant.setLogLevel(Project.MSG_INFO);
      // ant.setOBPrintStreamLog(null);// outputLogWriter);
      ant.runTask(task);
      final String result = ant.getErr();
      if (result.indexOf("Success") != -1) {
        return;
      } else {
        System.err.println(result);
        fail(result);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.