costin 2002/10/24 12:10:30 Modified: catalina/src/bin catalina.xml Log: Merged the startup code from build2.xml. The 3 startup methods are independent ( launcher, java exec and task ). Of particular interest ( I think ) are the 2 run targets. "run" will load catalina in-process and _return_ imediately after the init block is done - i.e. you no longer need the sleep. ( same thing that is used for example by anteater to start tomcat33). This is still not completed - and will need to be integrated with the launcher. Revision Changes Path 1.5 +129 -32 jakarta-tomcat-catalina/catalina/src/bin/catalina.xml Index: catalina.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/bin/catalina.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- catalina.xml 14 Aug 2002 15:43:04 -0000 1.4 +++ catalina.xml 24 Oct 2002 19:10:30 -0000 1.5 @@ -1,23 +1,18 @@ <!-- - - XML file for launching Catalina applications using the Launcher. - - To run any of the applications in the JDB debugger, execute the Launcher with - a "-Ddebug=true" argument. - - To run any of the applications in JPDA mode, execute the Launcher with a - "-Djpda=true" argument. - + XML file for launching Catalina applications using ant. --> <project name="Catalina Launcher" default="catalina" basedir="."> + <property file="${user.home}/.tomcat5.properties"/> <!-- Set the application home to the parent directory of this directory --> <property name="catalina.home" location="${basedir}/.."/> <property name="bootstrap.jar" location="${catalina.home}/bin/bootstrap.jar"/> <!-- Import the user's custom properties --> - <property file="${catalina.home}/bin/catalina.properties"/> + <property file="${catalina.home}/bin/catalina.properties"/> <!-- XXX shold it be conf ?? --> + <property file="${catalina.home}/conf/catalina.properties"/> <!-- XXX shold it be conf ?? --> + <!-- Set user configurable properties --> <property name="jsse.home" location="${catalina.home}"/> @@ -26,41 +21,82 @@ <property name="catalina.out" location="${catalina.base}/logs/catalina.out"/> <property name="catalina.policy" location="${catalina.base}/conf/catalina.policy"/> <property name="catalina.jvm.args" value=""/> + <property name="catalina.source.path" value="${catalina.home}/../../jakarta-servletapi-5/src/share:${catalina.home}/../../jakarta-tomcat-jasper/jasper2/src/share:${catalina.home}/../../jakarta-tomcat-connectors/coyote/src/java:${catalina.home}/../../jakarta-tomcat-catalina/catalina/src/share"/> + <!-- Build the classpath relative to the application home --> <path id="base.class.path"> <pathelement location="${bootstrap.jar}"/> <pathelement path="${jsse.home}/lib/jsse.jar:${jsse.home}/lib/jcert.jar:${jsse.home}/lib/jnet.jar"/> </path> - <!-- Build the sysproperties relative to the application home --> - <syspropertyset id="base.sys.properties"> - <sysproperty key="java.endorsed.dirs" file="${catalina.home}/common/endorsed"/> - <sysproperty key="java.io.tmpdir" file="${catalina.tmpdir}"/> - <sysproperty key="catalina.home" file="${catalina.home}"/> - <sysproperty key="catalina.base" file="${catalina.base}"/> - </syspropertyset> - - <!-- Build the standard jvmargs --> - <jvmargset id="base.jvm.args"> - <jvmarg line="${catalina.jvm.args}"/> - <jvmarg value="-Xdebug" if="jpda.settings"/> - <jvmarg value="-Xrunjdwp:${jpda.settings}" if="jpda.settings"/> - <jvmarg value="-sourcepath" if="jdb"/> - <jvmarg path="${catalina.source.path}" if="jdb"/> - </jvmargset> + <property name="basedir" location="."/> + + <property name="tools.jar" location="${java.home}/../lib/tools.jar" /> + + <path id="tomcatcp" > + <pathelement location="${catalina.home}/bin/bootstrap.jar"/> + <fileset dir="${catalina.home}/common/lib" includes="*.jar"/> + <fileset dir="${catalina.home}/server/lib" includes="*.jar"/> + <pathelement location="${catalina.home}/common/classes"/> + <!-- + <pathelement location="${ant.home}/lib/xercesImpl.jar" /> + <pathelement location="${ant.home}/lib/xml-apis.jar" /> + --> + <pathelement location="${ant.home}/lib/ant.jar" /> + <pathelement location="${tools.jar}" /> + </path> + + + <!-- =================== Initialization/helpers ================== --> + + + <target name="init" + description="Display configuration and conditional compilation flags"> + </target> + + <target name="init-launcher" > + <!-- Build the sysproperties relative to the application home --> + <syspropertyset id="base.sys.properties"> + <sysproperty key="java.endorsed.dirs" file="${catalina.home}/common/endorsed"/> + <sysproperty key="java.io.tmpdir" file="${catalina.tmpdir}"/> + <sysproperty key="catalina.home" file="${catalina.home}"/> + <sysproperty key="catalina.base" file="${catalina.base}"/> + </syspropertyset> + + <!-- Build the standard jvmargs --> + <jvmargset id="base.jvm.args"> + <jvmarg line="${catalina.jvm.args}"/> + <jvmarg value="-Xdebug" if="jpda.settings"/> + <jvmarg value="-Xrunjdwp:${jpda.settings}" if="jpda.settings"/> + <jvmarg value="-sourcepath" if="jdb"/> + <jvmarg path="${catalina.source.path}" if="jdb"/> + </jvmargset> + </target> + + <target name="echo-config" > + <echo>TOMCAT_HOME=${catalina.home}</echo> + <echo>CLASSPATH=${toString:tomcatcp}</echo> + </target> + + <target name="help" > + <echo> + To run any of the applications in the JDB debugger, execute the Launcher with + a "-Ddebug=true" argument. + + To run any of the applications in JPDA mode, execute the Launcher with a + "-Djpda=true" argument. + </echo> + </target> <!-- Target that sets JDB properties when the "debug" property is set --> <target name="setjdb" description="Set JDB properties" if="debug"> - <property name="jdb" value="true"/> - </target> <!-- Target that sets JPDA properties when the "jpda" property is set --> <target name="setjpda" description="Set JPDA properties" if="jpda"> - <condition property="jpda.transport" value="dt_shmem"> <os family="windows"/> </condition> @@ -79,12 +115,13 @@ </condition> <property name="jpda.suspend" value="y"/> <property name="jpda.settings" value="transport=${jpda.transport},address=${jpda.address},server=y,suspend=${jpda.suspend}"/> - </target> + <!-- =================== Launcher-based ================== --> + <!-- Target that executes Catalina --> <target name="catalina" description="Execute Catalina" - depends="setjdb,setjpda"> + depends="init-launcher,setjdb,setjpda" > <!-- Set default title for minimized window --> <property name="catalina.window.title" value="Catalina"/> @@ -117,7 +154,7 @@ <!-- Target that executes the Catalina tool wrapper --> <target name="tool-wrapper" description="Execute Catalina tool wrapper" - depends="setjdb,setjpda"> + depends="setjdb,setjpda" > <!-- Launch Catalina tool wrapper --> <launch classname="org.apache.catalina.startup.Tool" @@ -131,5 +168,65 @@ </launch> </target> + + <!-- ======================= Ant task based ================ --> + + + <target name="run-wait" depends="echo-config" + description="Start tomcat as a task and wait for it to end"> + <taskdef name="tomcat5" + classname="org.apache.catalina.startup.CatalinaService" + classpathref="tomcatcp" /> + + <tomcat5 do="start" home="${catalina.home}" wait="true" compiler="jikes"/> + <!-- the task will not end until tomcat shutdown is received --> + + <echo message="==================== Tomcat5 stoped ==================== "/> + </target> + + <target name="run" depends="echo-config" + description="Start tomcat as a task and return"> + <taskdef name="tomcat5" + classname="org.apache.catalina.startup.CatalinaService" + classpathref="tomcatcp" /> + + <tomcat5 do="start" home="${catalina.home}" wait="false" compiler="jikes"/> + + <!-- the task will end when tomcat is initialised. You can now use it in + other tasks --> + + <echo message="==================== Tomcat5 running ==================== "/> + </target> + + <!-- ======================= Exec/java ================ --> + + <target name="java-start" depends="echo-config" + description="Run tomcat in-process and wait for it to end, using java task" > + + <java classname="org.apache.catalina.startup.CatalinaService" fork="false"> + <classpath refid="tomcatcp" /> + <arg value="start" /> + <sysproperty key="catalina.home" value="${catalina.home}"/> + <sysproperty key="build.compiler" value="jikes"/> + <sysproperty key="java.endorsed.dirs" value="${ant.home}/lib:${java.home}/lib"/> + </java> + + <echo message="==================== Tomcat5 up and running ==================== "/> + </target> + + <target name="java-fork" depends="echo-config" + description="Fork a tomcat java process and wait for it to end"> + + <java classname="org.apache.catalina.startup.CatalinaService" fork="true"> + <classpath refid="tomcatcp" /> + <arg value="start" /> + <sysproperty key="catalina.home" value="${catalina.home}"/> + <sysproperty key="build.compiler" value="jikes"/> + <sysproperty key="java.endorsed.dirs" value="${ant.home}/lib:${java.home}/lib"/> + </java> + + <echo message="==================== Tomcat5 up and running ==================== "/> + </target> + </project>
-- To unsubscribe, e-mail: <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>