Changeset 30013

Show
Ignore:
Timestamp:
10.07.2015 20:47:45 (4 years ago)
Author:
ak19
Message:

ant restart calls both stop and start, which tries to stop and start both the derby and the tomcat, all in a single ant command. Derby stop and start both do a check to see if the derbyserver is running and set a property. Tomcat stop and start similarly both do a check to see if the tomcat server is running and set a property. Since a property is set obly once during a single ant invocation, two properties are needed to store the stop check and the start check for tomcat respectively, and two properties are needed for the stop check and start check for the derbyserver respectively.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/build.xml

    r30012 r30013  
    797797  </target> 
    798798 
     799  <!-- Need a copy of the check-derby-running target with a distinct property, because ant restart runs  
     800       both stop and start, which stop and start derby respectively. Both  need check the derby socket. 
     801       Because each property can be set only once during an invocation with ant, ant restart will need  
     802       two check-derbyserver properties, one for each derby check. --> 
     803  <target name="check-derbyserver-started"> 
     804    <condition property="derby.isstarted" value="true" else="false"> 
     805      <socket server="${derby.server}" port="${derby.server.port}"/> 
     806    </condition> 
     807    <echo>Derby is running: ${derby.isstarted}</echo> 
     808  </target> 
     809 
     810 
     811  <!-- Unused --> 
    799812  <target name="start-derby-java" depends="check-derbyserver-running"> 
    800813    <if><bool><not><istrue value="${derby.isrunning}"/></not></bool> 
     
    810823  </target> 
    811824   
     825  <target name="start-derby" depends="check-derbyserver-started"> 
     826    <if><bool><not><istrue value="${derby.isstarted}"/></not></bool> 
     827      <echo>About to launch derby on ${derby.server}:${derby.server.port}</echo> 
     828      <antcall target="force-start-derby"/> 
     829      <else> 
     830    <echo>Derby networked server ALREADY RUNNING on ${derby.server}:${derby.server.port}</echo> 
     831      </else> 
     832    </if> 
     833  </target> 
     834 
    812835  <!-- Using derby 10.1.2.1 
    813836       See db-derby-10.1.2.1-bin/docs/html/adminguide/index.html --> 
    814   <target name="start-derby" depends="check-derbyserver-running"> 
    815     <if><bool><not><istrue value="${derby.isrunning}"/></not></bool> 
    816       <echo>About to launch derby on ${derby.server}:${derby.server.port}</echo> 
     837  <target name="force-start-derby"> 
    817838      <property name="derby.server.classpath.prop" refid="derby.server.classpath" /> 
    818839       
     
    824845    <arg value="${derby.server.port}"/> 
    825846      </exec> 
    826       <else> 
    827     <echo>Derby networked server ALREADY RUNNING on ${derby.server}:${derby.server.port}</echo> 
    828       </else> 
    829     </if> 
     847 
    830848  </target> 
    831849 
     
    15141532  </target>   
    15151533   
    1516  
    1517   <!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ --> 
    1518   <target name="start-tomcat" description="Startup only Tomcat" depends="init,check-tomcat-running" if="tomcat.islocal"> 
    1519     <if><bool><istrue value="${tomcat.isrunning}"/></bool> 
     1534  <target name="start-tomcat" description="Startup only Tomcat" depends="check-tomcat-started"> 
     1535 
     1536    <if><bool><istrue value="${tomcat.isstarted}"/></bool> 
    15201537      <echo>**************************************</echo> 
    15211538      <echo>A WEB SERVER IS ALREADY RUNNING ON http://${tomcat.server}:${tomcat.port}. NOT STARTING.</echo> 
    15221539      <echo>**************************************</echo> 
    15231540      <else> 
     1541    <antcall target="force-start-tomcat"/> 
     1542      </else> 
     1543      </if> 
     1544  </target> 
     1545 
     1546  <!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ --> 
     1547  <target name="force-start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal"> 
     1548 
    15241549    <property name="tomcat.classpath" refid="local.tomcat.classpath"/> 
    15251550    <property name="tomcat.path" refid="local.tomcat.path"/> 
     
    15711596    </waitfor> 
    15721597 
    1573    </else> 
    1574    </if> 
    15751598  </target> 
    15761599 
     
    16221645    </condition> 
    16231646  </target> 
     1647   
     1648  <!-- Need a copy of the check-tomcat-running target with a distinct property, because ant restart runs  
     1649       both stop and start, both of which need to do tomcat checks. Each property can be set only once during  
     1650       an invocation with ant. So ant restart will need two properties to store each of the tomcat checks --> 
     1651  <target name="check-tomcat-started"> 
     1652    <condition property="tomcat.isstarted"> 
     1653      <http url="http://${tomcat.server}:${tomcat.port}"/> 
     1654    </condition> 
     1655  </target> 
     1656 
     1657 
    16241658 
    16251659  <!-- stop-tomcat checks if the tomcat server is already running. If it appears to be running 
     
    16501684  </target> 
    16511685 
    1652   <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/> 
     1686  <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,force-start-tomcat"/> 
    16531687 
    16541688  <target name="setup-catalina-ant-tasks"> 
     
    18441878    <istrue value="${tomcat.isrunning}"/> 
    18451879    </bool> 
    1846       <antcall target="start-tomcat"/> 
     1880      <antcall target="force-start-tomcat"/> 
    18471881    </if> 
    18481882    --> 
     
    19311965  <target name="deploy-localsite" depends="init"  
    19321966    description="Deploy the SOAP server for localsite. Will start and stop Tomcat."> 
    1933     <antcall target="start-tomcat"/> 
     1967    <antcall target="force-start-tomcat"/> 
    19341968    <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo> 
    19351969    <antcall target="create-deployment-files">