fixed issue 39141: removed ant tomcat.reload task
authorAsier Lostalé <asier.lostale@openbravo.com>
Thu, 11 Oct 2018 09:26:50 +0200
changeset 34838 faf7ea329834
parent 34837 cd8309678ebc
child 34839 44a01083360d
fixed issue 39141: removed ant tomcat.reload task

This task is unused for years now.
build.xml
src/org/openbravo/service/system/ReloadContext.java
--- a/build.xml	Thu Oct 11 08:57:47 2018 +0200
+++ b/build.xml	Thu Oct 11 09:26:50 2018 +0200
@@ -844,25 +844,6 @@
     </java>
   </target>
 
-  <!-- 
-		This task is called from the Openbravo ui, it spawns a java call which again
-		calls the tomcat.reload.do task as a spawned task.
-	-->
-  <target name="tomcat.reload" description="Reload the Openbravo context">
-    <echo message="Reloading webapp..." />
-    <java classname="org.openbravo.service.system.ReloadContext" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" spawn="true" fork="true">
-      <arg line="${base.src}" />
-      <classpath refid="project.class.path" />
-    </java>
-  </target>
-
-  <target name="tomcat.reload.do">
-    <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
-      <classpath refid="project.class.path" />
-    </taskdef>
-    <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" />
-  </target>
-
   <target name="tomcat.list">
     <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
       <classpath refid="project.class.path" />
--- a/src/org/openbravo/service/system/ReloadContext.java	Thu Oct 11 08:57:47 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- *************************************************************************
- * The contents of this file are subject to the Openbravo  Public  License
- * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
- * Version 1.1  with a permitted attribution clause; you may not  use this
- * file except in compliance with the License. You  may  obtain  a copy of
- * the License at http://www.openbravo.com/legal/license.html 
- * Software distributed under the License  is  distributed  on  an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific  language  governing  rights  and  limitations
- * under the License. 
- * The Original Code is Openbravo ERP. 
- * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008-2010 Openbravo SLU 
- * All Rights Reserved. 
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-
-package org.openbravo.service.system;
-
-import java.io.File;
-
-import org.apache.log4j.Logger;
-import org.openbravo.base.exception.OBException;
-import org.openbravo.base.session.OBPropertiesProvider;
-
-/**
- * Reloads the tomcat using the tomcat reload ant task.
- * 
- * @author mtaal
- */
-public class ReloadContext {
-  private static final Logger log = Logger.getLogger(ReloadContext.class);
-
-  /**
-   * Method is called from the tomcat.reload tasks, this method again starts the tomcat.reload.do
-   * task.Note: this method should always use the AntExecutor in org.openbravo.erpCommon.utility, to
-   * prevent problems when upgrading Core to a newer version
-   * 
-   * @param args
-   *          arg[0] contains the source path
-   * @throws Exception
-   */
-  @SuppressWarnings("deprecation")
-  public static void main(String[] args) throws Exception {
-    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 org.openbravo.erpCommon.utility.AntExecutor antExecutor = new org.openbravo.erpCommon.utility.AntExecutor(
-          baseDir.getAbsolutePath());
-      antExecutor.runTask("tomcat.reload.do");
-    } catch (final Exception e) {
-      throw new OBException(e);
-    }
-  }
-
-  /**
-   * Restarts the tomcat server. Assumes the the Openbravo.properties are available through the
-   * {@link OBPropertiesProvider}.Note: this method should always use the AntExecutor in
-   * org.openbravo.erpCommon.utility, to prevent problems when upgrading Core to a newer version
-   */
-  @SuppressWarnings("deprecation")
-  public static void reload() {
-    final String baseDirPath = OBPropertiesProvider.getInstance().getOpenbravoProperties()
-        .getProperty("source.path");
-    try {
-      log.debug("Reloading context with basedir " + baseDirPath);
-      final org.openbravo.erpCommon.utility.AntExecutor antExecutor = new org.openbravo.erpCommon.utility.AntExecutor(
-          baseDirPath);
-      antExecutor.runTask("tomcat.reload");
-    } catch (final Exception e) {
-      throw new OBException(e);
-    }
-  }
-}