From: <st...@us...> - 2008-05-23 16:57:30
|
Revision: 6544 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=6544&view=rev Author: steve_l Date: 2008-05-23 09:55:50 -0700 (Fri, 23 May 2008) Log Message: ----------- SFOS-870 Ant starttests have been commented out for some time SFOS-865 Setting the default port from Ant tasks doesn't appear to work Modified Paths: -------------- trunk/core/extras/ant/build.xml trunk/core/extras/ant/src/org/smartfrog/tools/ant/DeployingTaskBase.java trunk/core/extras/ant/src/org/smartfrog/tools/ant/IsDeployed.java trunk/core/extras/ant/src/org/smartfrog/tools/ant/PingTask.java trunk/core/extras/ant/src/org/smartfrog/tools/ant/PropertyFile.java trunk/core/extras/ant/src/org/smartfrog/tools/ant/SmartFrogSign.java trunk/core/extras/ant/src/org/smartfrog/tools/ant/SmartFrogTask.java trunk/core/extras/ant/src/org/smartfrog/tools/ant/StartApplication.java trunk/core/extras/ant/src/org/smartfrog/tools/ant/StartDaemon.java trunk/core/extras/ant/src/org/smartfrog/tools/ant/StopApplication.java trunk/core/extras/ant/src/org/smartfrog/tools/ant/ToUrlTask.java trunk/core/extras/ant/test/files/deploy.xml trunk/core/extras/ant/test/files/ping.xml trunk/core/extras/ant/test/files/start.xml trunk/core/extras/ant/test/files/test-common.xml trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/TaskTestBase.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/system/DeployTest.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/system/PingTest.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/system/RunTest.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/system/StartTest.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/system/StopDaemonTest.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/system/UndeployTest.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/unit/ConditionalSequenceTest.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/unit/FaultingWaitForTest.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/unit/FunctionalTestTaskTest.java trunk/core/extras/ant/test/org/smartfrog/tools/ant/test/unit/ToUrlTest.java Modified: trunk/core/extras/ant/build.xml =================================================================== --- trunk/core/extras/ant/build.xml 2008-05-23 15:39:52 UTC (rev 6543) +++ trunk/core/extras/ant/build.xml 2008-05-23 16:55:50 UTC (rev 6544) @@ -21,19 +21,20 @@ */ --> -<description> - Build file for Ant tasks for Smartfrog + <description> + Build file for Ant tasks for Smartfrog - To build and run the tests, you need ant-testutil.jar, which Ivy will retrieve - -</description> + To build and run the tests, you need ant-testutil.jar, which Ivy will retrieve + </description> + <property name="root.dir" location="../.."/> + <property name="system.tests" value="true"/> <property name="ivy.enabled" value="true"/> <property name="javac.include.ant" value="true"/> <!-- Import common stuff --> <import file="../../common.xml"/> -<!-- <import file="${root.dir}/common.xml"/>--> + <!-- <import file="${root.dir}/common.xml"/>--> <!-- ========================================================== --> @@ -46,43 +47,42 @@ /> <target name="zip" depends="prepare-for-dist" - description="Create a zip file distribution" > + description="Create a zip file distribution"> </target> <target name="tar" depends="prepare-for-dist" - description="Create a tar file distribution" > + description="Create a tar file distribution"> </target> <target name="installed" depends="common.installed,update-core" description="Place the system in a state in which the components are installed for reuse"/> - <!-- this is done so that the jarfile generated is bound to our project name with - no -components suffix--> +no -components suffix--> <property name="jarfile.suffix" value=""/> - - <target name="init" - depends="init-common,init-standard-output-dirs"> + + <target name="init" + depends="init-common,init-standard-output-dirs"> <property name="src.dir" location="src"/> <property name="target.name" value="${smartfrog.tasks.name}"/> - <property name="target.jar" location="${smartfrog.tasks.jar}" /> + <property name="target.jar" location="${smartfrog.tasks.jar}"/> <echo>building ${target.jar}</echo> - <property name="dist.tar" - location="${smartfrog.tasks.dist.dir}/${smartfrog.tasks.prefix}.tar" /> - <property name="dist.zip" - location="${smartfrog.tasks.dist.dir}/${smartfrog.tasks.prefix}.zip" /> - <property name="system.tests" value="true" /> + <property name="dist.tar" + location="${smartfrog.tasks.dist.dir}/${smartfrog.tasks.prefix}.tar"/> + <property name="dist.zip" + location="${smartfrog.tasks.dist.dir}/${smartfrog.tasks.prefix}.zip"/> + <echo level="verbose">system.tests=${system.tests}</echo> <condition property="system.tests.enabled"> <istrue value="${system.tests}"/> - </condition> - + </condition> + <echo>system.tests.enabled=${system.tests.enabled}</echo> <condition property="jar.name.correct"> <equals arg1="${jar.prefix}${ant.project.name}" - arg2="${smartfrog.tasks.prefix}"> + arg2="${smartfrog.tasks.prefix}"> </equals> </condition> <fail unless="jar.name.correct"> @@ -93,12 +93,12 @@ <!-- purge any existing task file, assuming it is not in use--> <delete file="${smartfrog.dist.lib.dir}/${smartfrog.tasks.name}" - failonerror="false" /> + failonerror="false"/> </target> <target name="javadoc" - depends="ready-to-javadoc" - unless="javadoc.disabled" + depends="ready-to-javadoc" + unless="javadoc.disabled" > <!-- Java Docs for all --> <echo message=""/> @@ -114,9 +114,9 @@ <tag name="ant.task" enabled="false"/> <tag name="ant.type" enabled="false"/> <tag name="todo" enabled="false"/> - <classpath > - <path refid="compile.classpath" /> - <path path="${java.class.path}" /> + <classpath> + <path refid="compile.classpath"/> + <path path="${java.class.path}"/> </classpath> <group title="SmartFrog Packages" packages="org.smartfrog.*"/> </sf-javadoc> @@ -128,65 +128,65 @@ <!-- existing version --> <!-- ========================================================== --> <target name="use-smartfrog-tasks" depends="package" - description="declare the classpath and imports for the smartfrog tasks"> + description="declare the classpath and imports for the smartfrog tasks"> <path id="smartfrog.tasks.classpath"> <path refid="smartfrog.core.classpath"/> <pathelement location="${build.classes.dir}"/> </path> - <typedef - resource="org/smartfrog/tools/ant/tasks.properties" - classpathref="smartfrog.tasks.classpath" - /> + <typedef + resource="org/smartfrog/tools/ant/tasks.properties" + classpathref="smartfrog.tasks.classpath" + /> </target> - + <target name="stopdaemon" depends="package,use-smartfrog-tasks"> - <sf-stopdaemon - classpathref="smartfrog.tasks.classpath"/> + <sf-stopdaemon port="${smartfrog.daemon.port}" + classpathref="smartfrog.tasks.classpath"/> </target> - + <target name="default" depends="package,published"/> <!--find the test util JAR --> <target name="find-testutil" depends="declare-classpaths"> - + <available property="testutil.found" - classname="org.apache.tools.ant.BuildFileTest" - classpathref="tests.compile.classpath" - ignoresystemclasses="false"/> + classname="org.apache.tools.ant.BuildFileTest" + classpathref="tests.compile.classpath" + ignoresystemclasses="false"/> </target> <target name="require-testutil" depends="find-testutil"> - <fail unless="testutil.found" >Could not find ${testutil.jar}</fail> + <fail unless="testutil.found">Could not find ${testutil.jar}</fail> </target> - + <target name="want-testutil" unless="testutil.found" depends="find-testutil"> <echo level="error"> - Ant testutil classes not found in ${tests.compile.classpath} - or ${testutil.jar} - The dependent stages of this build will be skipped. - To build this file, run "ant test-jar" in - ant's source directory, - Alternatively, retrieve it from Gump: - http://gump.covalent.net/jars/latest/ant/ - Note that the version of ant-testutil.jar should - match the version of ant used. + Ant testutil classes not found in ${tests.compile.classpath} + or ${testutil.jar} + The dependent stages of this build will be skipped. + To build this file, run "ant test-jar" in + ant's source directory, + Alternatively, retrieve it from Gump: + http://gump.covalent.net/jars/latest/ant/ + Note that the version of ant-testutil.jar should + match the version of ant used. </echo> </target> - <target name="compile-tests" + <target name="compile-tests" depends="init,package,use-smartfrog-tasks"> - - <sf-javac-with-ant - srcdir="${test.src.dir}" - destdir="${test.classes.dir}" - classpathref="tests.compile.classpath" - > + + <sf-javac-with-ant + srcdir="${test.src.dir}" + destdir="${test.classes.dir}" + classpathref="tests.compile.classpath" + > </sf-javac-with-ant> <copy-useful-files src="${test.src.dir}" dest="${test.classes.dir}"/> </target> - + <!-- run the tests note that StartTest and any other tests that rely on @@ -196,121 +196,123 @@ --> <target name="run-tests" depends="package-tests"> <property name="filter.trace" value="true"/> - <property name="junit.timeout" value="60000" /> - <sf-junit - errorProperty="test.failed" - failureProperty="test.failed" - includeantruntime="true" - filtertrace="${filter.trace}" - timeout="300000" - > - <classpath + <property name="junit.timeout" value="60000"/> + <sf-junit + errorProperty="test.failed" + failureProperty="test.failed" + includeantruntime="true" + filtertrace="${filter.trace}" + timeout="300000" + > + <classpath refid="tests.run.classpath"/> - <sysproperty key="test.files.dir" - value="${test.src.dir}/files" /> - <batchtest todir="${test.data.dir}" > + <sysproperty key="test.files.dir" + value="${test.src.dir}/files"/> + <test todir="${test.data.dir}" name="${testcase}" if="testcase"/> + <batchtest todir="${test.data.dir}" unless="testcase"> <fileset dir="${test.classes.dir}"> - <include name="**/unit/*Test.class" /> + <include name="**/unit/*Test.class"/> <include name="**/system/*Test.class" if="system.tests.enabled"/> - </fileset> + </fileset> </batchtest> </sf-junit> - </target> + </target> <target name="test" depends="run-tests" - description="run unit tests"> - + description="run unit tests"> + <echo>Test reports generated: + ${test.reports.dir}/index.html + </echo> <!-- generate the reports--> <sf-test-report data="${test.data.dir}" - reports="${test.reports.dir}" - failed="test.failed"/> + reports="${test.reports.dir}" + failed="test.failed"/> - </target> + </target> -<!-- ==================================================================== --> -<!-- this little section hacks into Ant's own SVN tree to hand off document - generation. It is nasty because the automated docgen is not quite production - ready --> - + <!-- ==================================================================== --> + <!-- this little section hacks into Ant's own SVN tree to hand off document + generation. It is nasty because the automated docgen is not quite production + ready --> + <!-- this target does the extra xdocs initialisation --> - <target name="init-xdocs" depends="init"> + <target name="init-xdocs" depends="init"> <property name="build.antdocs.dir" location="${build.dir}/xdocs"/> <property name="gen.dir" location="${build.antdocs.dir}/gen"/> <property name="gen.dir" location="${build.antdocs.dir}/gen"/> <property name="build.docs.dir" location="${build.antdocs.dir}/docs"/> - <property name="build.xdocs.dir" location="${build.antdocs.dir}/xdocs"/> - <property name="xdocs.dir" location="${env.ANT_HOME}/proposal/xdocs" /> - <property name="src.package" value="org/smartfrog/tools/ant/" /> + <property name="build.xdocs.dir" location="${build.antdocs.dir}/xdocs"/> + <property name="xdocs.dir" location="${env.ANT_HOME}/proposal/xdocs"/> + <property name="src.package" value="org/smartfrog/tools/ant/"/> <path id="xdoclet.extra.classpath"> <path refid="smartfrog.classpath"/> <pathelement location="${smartfrog.tasks.jar}"/> </path> <property name="xdoclet.extra.classpath.asprop" - refid="xdoclet.extra.classpath"/> - </target> + refid="xdoclet.extra.classpath"/> + </target> -<!-- probe for xdocs, which is only in SVN, not redist packages --> -<target name="probe-xdocs" depends="init-xdocs" > - <available property="xdocs.found" file="${xdocs.dir}/build.xml"/> -</target> + <!-- probe for xdocs, which is only in SVN, not redist packages --> + <target name="probe-xdocs" depends="init-xdocs"> + <available property="xdocs.found" file="${xdocs.dir}/build.xml"/> + </target> -<target name="want-xdocs" depends="probe-xdocs"> - <fail unless="xdocs.found"> - We need the proposal/xdocs source tree from Ant in ${env.ANT_HOME}/proposal/xdocs - </fail> -</target> + <target name="want-xdocs" depends="probe-xdocs"> + <fail unless="xdocs.found"> + We need the proposal/xdocs source tree from Ant in ${env.ANT_HOME}/proposal/xdocs + </fail> + </target> + <target name="xdocs" depends="want-xdocs,package" + description="Run xdoclet over the ant tasks to create doc pages" + if="xdocs.found"> + <echo> + running xdocs with classpath=${xdoclet.extra.classpath.asprop} + </echo> -<target name="xdocs" depends="want-xdocs,package" - description="Run xdoclet over the ant tasks to create doc pages" - if="xdocs.found"> - <echo> - running xdocs with classpath=${xdoclet.extra.classpath.asprop} - </echo> + <ant inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}" dir="${xdocs.dir}" + target="gen-and-prepare-for-docs"> + <property name="src.dir" location="${src.package}"/> + <property name="src.root" location="src"/> + <property name="xdoclet.extra.classpath" + value="${xdoclet.extra.classpath.asprop}"/> + <property name="gen.dir" location="${gen.dir}"/> + <property name="xdocs.dir" location="${build.xdocs.dir}"/> + <property name="build.docs.dir" location="${build.docs.dir}"/> + </ant> + </target> - <ant inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}" dir="${xdocs.dir}" - target="gen-and-prepare-for-docs"> - <property name="src.dir" location="${src.package}"/> - <property name="src.root" location="src"/> - <property name="xdoclet.extra.classpath" - value="${xdoclet.extra.classpath.asprop}"/> - <property name="gen.dir" location="${gen.dir}"/> - <property name="xdocs.dir" location="${build.xdocs.dir}"/> - <property name="build.docs.dir" location="${build.docs.dir}"/> - </ant> -</target> + <target name="dvsl" depends="xdocs" + description="use velocity to generate the docs"> + <ant inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}" dir="${xdocs.dir}/dvsl"> + <property name="src.dir" location="src/org/smartfrog/tools/ant/"/> + <property name="build.dir" location="${build.antdocs.dir}"/> + <property name="taskdocs.src" location="${gen.dir}"/> + <property name="xdocs.dir" location="${build.xdocs.dir}"/> + <property name="docs.dest" location="${build.docs.dir}"/> + </ant> + </target> + <!-- ==================================================================== --> + <!-- end xdocs support --> + <!-- ==================================================================== --> -<target name="dvsl" depends="xdocs" - description="use velocity to generate the docs"> - <ant inheritAll="${ant.inheritAll}" inheritRefs="${ant.inheritRefs}" dir="${xdocs.dir}/dvsl"> - <property name="src.dir" location="src/org/smartfrog/tools/ant/"/> - <property name="build.dir" location="${build.antdocs.dir}"/> - <property name="taskdocs.src" location="${gen.dir}"/> - <property name="xdocs.dir" location="${build.xdocs.dir}"/> - <property name="docs.dest" location="${build.docs.dir}"/> - </ant> -</target> -<!-- ==================================================================== --> -<!-- end xdocs support --> -<!-- ==================================================================== --> - <!-- do all prework --> -<target name="prepare-for-dist" depends="package"> - <copy todir="${dist.doc.dir}"> - <fileset dir="${doc.dir}"> - <include name="**/*.sxw"/> - <include name="**/*.sxi"/> - <include name="**/*.html"/> - </fileset> - </copy> - -</target> + <target name="prepare-for-dist" depends="package"> + <copy todir="${dist.doc.dir}"> + <fileset dir="${doc.dir}"> + <include name="**/*.sxw"/> + <include name="**/*.sxi"/> + <include name="**/*.html"/> + </fileset> + </copy> + </target> - <!--patch the new ant tasks into the core--> + + <!--patch the new ant tasks into the core--> <target name="update-core" depends="package"> <delete> <fileset dir="${root.dir}/smartfrog/lib" @@ -320,5 +322,4 @@ </target> - </project> Modified: trunk/core/extras/ant/src/org/smartfrog/tools/ant/DeployingTaskBase.java =================================================================== --- trunk/core/extras/ant/src/org/smartfrog/tools/ant/DeployingTaskBase.java 2008-05-23 15:39:52 UTC (rev 6543) +++ trunk/core/extras/ant/src/org/smartfrog/tools/ant/DeployingTaskBase.java 2008-05-23 16:55:50 UTC (rev 6544) @@ -30,14 +30,12 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; /** - * This class is used as an extended base for those tasks that do deployment, as it supports - * declaring of applications as nested elements. - * created 27-Feb-2004 15:27:47 + * This class is used as an extended base for those tasks that do deployment, as it supports declaring of applications + * as nested elements. created 27-Feb-2004 15:27:47 */ public abstract class DeployingTaskBase extends SmartFrogTask { @@ -59,6 +57,7 @@ /** * add a new application to the list. + * * @return the created application */ public Application createApplication() { @@ -97,8 +96,7 @@ } /** - * deploy the applications listed by creating a -a app descriptor list - * on the command line + * deploy the applications listed by creating a -a app descriptor list on the command line */ public void deployApplications() { verifyHostDefined(); @@ -109,11 +107,11 @@ String path = makePath(application); String subprocess = getSubprocess(); - addArg(application.getName() + ":" //NAME - + ACTION_DEPLOY + ":" //Action: DEPLOY,TERMINATE,DETACH,DETaTERM + addArg(application.getName() + ':' //NAME + + ACTION_DEPLOY + ':' //Action: DEPLOY,TERMINATE,DETACH,DETaTERM + path //URL - + "" + ":" // sfConfig or empty - + getHost() + ":" // host + + "" + ':' // sfConfig or empty + + getHost() + ':' // host + subprocess); // subprocess } @@ -121,6 +119,7 @@ /** * Create a path from an application + * * @param application application * @return a path from its descriptor */ @@ -136,9 +135,9 @@ // } /** - * Get the subprocess we are deploying to. - * The default is {@link #DEFAULT_SUBPROCESS}, though subclasses may override - * this + * Get the subprocess we are deploying to. The default is {@link #DEFAULT_SUBPROCESS}, though subclasses may + * override this + * * @return the name of the subprocess to deployto */ protected String getSubprocess() { @@ -146,8 +145,7 @@ } /** - * Add a new codebase element to the current set. The URLs of the codebase - * will be visible to the deploying app. + * Add a new codebase element to the current set. The URLs of the codebase will be visible to the deploying app. * * @param codebaseEntry a new codebase entry */ @@ -160,6 +158,7 @@ /** * set up the codebase params on the command line, if needed + * * @see org.smartfrog.sfcore.security.SFClassLoader#SF_CODEBASE_PROPERTY */ private void setupCodebase() { @@ -172,8 +171,7 @@ } /** - * the name and url of an application. - * Interpretation of descriptor is by smartfrog; it includes resources as well + * the name and url of an application. Interpretation of descriptor is by smartfrog; it includes resources as well * as codebase urls */ public static class Application { @@ -182,14 +180,15 @@ * owner task */ private TaskBase owner; - public static final String ERROR_NO_APPLICATION_NAME = "no application name"; - public static final String ERROR_NO_APPLICATION_DESCRIPTOR = "no descriptor provided for "; + public static final String ERROR_NO_APPLICATION_NAME = "No application name"; + public static final String ERROR_NO_APPLICATION_DESCRIPTOR = "No descriptor provided for "; public static final String ERROR_FILE_NOT_FOUND = "File does not exist: "; - public static final String ERROR_NO_WRITE = "could not write to: "; + public static final String ERROR_NO_WRITE = "Could not write to: "; public static final String APPLICATION_ENCODING = "UTF-8"; /** * Create a bound application + * * @param owner owning task */ public Application(TaskBase owner) { @@ -230,14 +229,13 @@ } /** - * set the file of the app. This is the same as the descriptor, except - * that it must exist + * set the file of the app. This is the same as the descriptor, except that it must exist * * @param file descriptor filename */ public void setFile(File file) { if (!file.exists()) { - throw new BuildException(ERROR_FILE_NOT_FOUND+file); + throw new BuildException(ERROR_FILE_NOT_FOUND + file); } descriptor = file.toString(); } @@ -271,20 +269,19 @@ */ public void addText(String unexpandedText) { //convert properties - unexpandedText = owner.getProject().replaceProperties(unexpandedText); - this.text=unexpandedText; + text = owner.getProject().replaceProperties(unexpandedText); //create a temp file File tempfile = FileUtils.getFileUtils().createTempFile("deploy", ".sf", null); //mark for cleanup later - if(owner.isDebug()) { - owner.log("Application temporary files is "+tempfile); + if (owner.isDebug()) { + owner.log("Application temporary files is " + tempfile); owner.log("This is not deleted in debug mode"); } else { //no debugging, kill the file after we exit ant. tempfile.deleteOnExit(); } - owner.log("Saving to temporary file "+tempfile,Project.MSG_VERBOSE); + owner.log("Saving to temporary file " + tempfile, Project.MSG_VERBOSE); owner.log(unexpandedText, Project.MSG_VERBOSE); OutputStream out = null; OutputStreamWriter writer = null; @@ -293,7 +290,7 @@ out = new BufferedOutputStream(new FileOutputStream(tempfile)); writer = new OutputStreamWriter(out, APPLICATION_ENCODING); printer = new PrintWriter(writer); - printer.write(this.text); + printer.write(text); printer.flush(); //remember our name setFile(tempfile); Modified: trunk/core/extras/ant/src/org/smartfrog/tools/ant/IsDeployed.java =================================================================== --- trunk/core/extras/ant/src/org/smartfrog/tools/ant/IsDeployed.java 2008-05-23 15:39:52 UTC (rev 6543) +++ trunk/core/extras/ant/src/org/smartfrog/tools/ant/IsDeployed.java 2008-05-23 16:55:50 UTC (rev 6544) @@ -28,8 +28,7 @@ /** * This is a condition that tests for things being deployed. * - * TODO:implement this - * created 14-May-2004 11:28:52 + * TODO:implement this created 14-May-2004 11:28:52 */ public class IsDeployed extends ProjectComponent implements Condition { @@ -51,15 +50,14 @@ private String application; /** - * SmartFrog daemon connection port. - * org.smartfrog.ProcessCompound.sfRootLocatorPort=3800; + * SmartFrog daemon connection port. org.smartfrog.ProcessCompound.sfRootLocatorPort=3800; */ protected Integer port; private void validate() throws BuildException { if (application == null) { - throw new BuildException("application is undefined"); + throw new BuildException("Application is undefined"); } } @@ -98,8 +96,7 @@ } /** - * set the hostname to deploy to (optional, defaults to localhost) - * Some tasks do not allow this to be set at all. + * set the hostname to deploy to (optional, defaults to localhost) Some tasks do not allow this to be set at all. * * @param host hostname */ @@ -109,8 +106,7 @@ } /** - * port of daemon; optional -default is 3800 - * Some tasks do not allow this to be set at all. + * port of daemon; optional -default is 3800 Some tasks do not allow this to be set at all. * * @param port port to use */ Modified: trunk/core/extras/ant/src/org/smartfrog/tools/ant/PingTask.java =================================================================== --- trunk/core/extras/ant/src/org/smartfrog/tools/ant/PingTask.java 2008-05-23 15:39:52 UTC (rev 6543) +++ trunk/core/extras/ant/src/org/smartfrog/tools/ant/PingTask.java 2008-05-23 16:55:50 UTC (rev 6544) @@ -22,24 +22,22 @@ import org.apache.tools.ant.BuildException; /** - * Probe the health of a deployed application. - * This task will trigger a liveness check against the application, which - * causes the application to assess its own health and return successfully - * or raise an exception. - * The build file will stop on failure (default), or the task can be set - * to ignore the failure, and instead set a property on success, leaving it - * blank on failure. + * Probe the health of a deployed application. This task will trigger a liveness check against the application, which + * causes the application to assess its own health and return successfully or raise an exception. The build file will + * stop on failure (default), or the task can be set to ignore the failure, and instead set a property on success, + * leaving it blank on failure. + * * @ant.task category="SmartFrog" name="sf-ping" */ public class PingTask extends SmartFrogTask { /** * name of an app */ - protected String application= SmartFrogJVMProperties.ROOT_PROCESS ; + protected String application = SmartFrogJVMProperties.ROOT_PROCESS; protected String successProperty; - public static final String ERROR_FAILED_TO_PING = "failed to ping"; + public static final String ERROR_FAILED_TO_PING = "Failed to ping"; public void init() throws BuildException { super.init(); @@ -62,8 +60,8 @@ } /** - * the name of a property to set on a successful ping. - * Only useful if failonerror is set to false + * the name of a property to set on a successful ping. Only useful if failonerror is set to false + * * @param successProperty true on success */ public void setSuccessProperty(String successProperty) { @@ -79,17 +77,17 @@ public void execute() throws BuildException { setStandardSmartfrogProperties(); verifyApplicationName(application); - String command = application + ":" //NAME - + "PING" + ":" - + "" + ":" //URL - + "" + ":" // sfConfig or empty - + getHost() + ":" // host + String command = application + ':' //NAME + + "PING" + ':' + + "" + ':' //URL + + "" + ':' // sfConfig or empty + + getHost() + ':' // host + ""; // subprocess addApplicationCommand("-a", command); addExitFlag(); - if(execSmartFrog(ERROR_FAILED_TO_PING + getApplication())){ - if(successProperty!=null) { - getProject().setNewProperty(successProperty,"true"); + if (execSmartFrog(ERROR_FAILED_TO_PING + getApplication())) { + if (successProperty != null) { + getProject().setNewProperty(successProperty, "true"); } } Modified: trunk/core/extras/ant/src/org/smartfrog/tools/ant/PropertyFile.java =================================================================== --- trunk/core/extras/ant/src/org/smartfrog/tools/ant/PropertyFile.java 2008-05-23 15:39:52 UTC (rev 6543) +++ trunk/core/extras/ant/src/org/smartfrog/tools/ant/PropertyFile.java 2008-05-23 16:55:50 UTC (rev 6544) @@ -19,30 +19,27 @@ */ package org.smartfrog.tools.ant; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; import org.apache.tools.ant.types.DataType; import org.apache.tools.ant.types.Environment; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.util.FileUtils; -import org.apache.tools.ant.taskdefs.Java; +import java.io.BufferedInputStream; import java.io.File; -import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; -import java.util.Properties; import java.util.Enumeration; +import java.util.LinkedList; import java.util.List; -import java.util.LinkedList; -import java.util.Iterator; import java.util.ListIterator; +import java.util.Properties; /** - * A type that holds property files - * created Jul 26, 2004 1:01:50 PM + * A type that holds property files created Jul 26, 2004 1:01:50 PM */ -public class PropertyFile extends DataType implements Cloneable { +public class PropertyFile extends DataType implements Cloneable { /** * filename @@ -52,7 +49,7 @@ /** * optional flag */ - private boolean optional=false; + private boolean optional = false; public static final String ERROR_NO_FILE_ATTRIBUTE = "No file specified"; public static final String ERROR_FILE_LOAD_FAILED = "Failed to load "; public static final String ERROR_FILE_NOT_FOUND = "File not found: "; @@ -69,29 +66,30 @@ /** * load the file of properties and return it as a properties object + * * @return a loaded properties object (which will be empty for no file load on an optional file) * @throws BuildException if there was no file specified, or something went wrong with the load */ public Properties getProperties() { Properties props = new Properties(); - if(file==null) { + if (file == null) { throw new BuildException(ERROR_NO_FILE_ATTRIBUTE); } - if(!file.exists()) { - if(optional) { - getProject().log(MESSAGE_ABSENT_FILE+file,Project.MSG_VERBOSE); + if (!file.exists()) { + if (optional) { + getProject().log(MESSAGE_ABSENT_FILE + file, Project.MSG_VERBOSE); return props; } else { - throw new BuildException(ERROR_FILE_NOT_FOUND+file); + throw new BuildException(ERROR_FILE_NOT_FOUND + file); } } getProject().log(MESSAGE_LOADING_FILE + file, Project.MSG_VERBOSE); BufferedInputStream inStream = null; try { - inStream=new BufferedInputStream(new FileInputStream(file)); + inStream = new BufferedInputStream(new FileInputStream(file)); props.load(inStream); } catch (IOException e) { - throw new BuildException(ERROR_FILE_LOAD_FAILED+file,e); + throw new BuildException(ERROR_FILE_LOAD_FAILED + file, e); } finally { FileUtils.close(inStream); } @@ -99,8 +97,7 @@ } /** - * Creates and returns a copy of this object. - * Since Ant1.7 this has been required to be public + * Creates and returns a copy of this object. Since Ant1.7 this has been required to be public */ public Object clone() throws CloneNotSupportedException { return super.clone(); @@ -108,16 +105,17 @@ /** * add the declared properties to the JVM + * * @param dest recipient of the system properties */ public void addPropertiesToJvm(SysPropertyAdder dest) { - Properties props=getProperties(); - Enumeration<?> en=props.propertyNames(); + Properties props = getProperties(); + Enumeration<?> en = props.propertyNames(); while (en.hasMoreElements()) { - String name = (String) en.nextElement(); - String value=props.getProperty(name); - Environment.Variable sysProp=new Environment.Variable(); - getProject().log("Setting property "+name+"="+value, Project.MSG_DEBUG); + String name = en.nextElement().toString(); + String value = props.getProperty(name); + Environment.Variable sysProp = new Environment.Variable(); + getProject().log("Setting property " + name + '=' + value, Project.MSG_DEBUG); sysProp.setKey(name); sysProp.setValue(value); dest.addSysproperty(sysProp); @@ -131,10 +129,11 @@ /** * internal cache */ - private List<PropertyFile> list=new LinkedList<PropertyFile>(); + private List<PropertyFile> list = new LinkedList<PropertyFile>(); /** * add to the list + * * @param propFile the property file */ public void add(PropertyFile propFile) { @@ -143,6 +142,7 @@ /** * add all properties to the list + * * @param jvm JVM to add to */ public void addPropertiesToJvm(SysPropertyAdder jvm) { @@ -153,6 +153,7 @@ /** * get an iterator. + * * @return the iterator */ public ListIterator<PropertyFile> iterator() { Modified: trunk/core/extras/ant/src/org/smartfrog/tools/ant/SmartFrogSign.java =================================================================== --- trunk/core/extras/ant/src/org/smartfrog/tools/ant/SmartFrogSign.java 2008-05-23 15:39:52 UTC (rev 6543) +++ trunk/core/extras/ant/src/org/smartfrog/tools/ant/SmartFrogSign.java 2008-05-23 16:55:50 UTC (rev 6544) @@ -23,34 +23,25 @@ import org.apache.tools.ant.BuildException; import org.apache.tools.ant.taskdefs.SignJar; -import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Reference; -import java.io.File; import java.io.IOException; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; /** - * - * @ant.task category="SmartFrog" name="sf-sign" - * Sign JAR files using the SmartFrog security configuration. - * This task is essentially a thin wrapper around Ant's <tt>signjar</tt> task, - * with integration with the SmartFrog security properties file, that being - * where the passphrase to unlock the keystore is extracted. - * + * @ant.task category="SmartFrog" name="sf-sign" Sign JAR files using the SmartFrog security configuration. This task is + * essentially a thin wrapper around Ant's <tt>signjar</tt> task, with integration with the SmartFrog security + * properties file, that being where the passphrase to unlock the keystore is extracted. */ public class SmartFrogSign extends SignJar { - /** * our security holder */ private SecurityHolder securityHolder = new SecurityHolder(); public static final String ERROR_NO_SECURITY_SETTINGS = "No security settings provided"; public static final String ERROR_COULD_NOT_APPLY_SETTINGS = "Could not apply security settings with "; - public static final String MESSAGE_NO_SECURITY = "security empty or disabled: signing skipped"; + public static final String MESSAGE_NO_SECURITY = "Security empty or disabled: signing skipped"; /** @@ -72,13 +63,10 @@ } - /** - * Called by the project to let the task do its work. This method may be - * called more than once, if the task is invoked more than once. - * For example, - * if target1 and target2 both depend on target3, then running - * "ant target1 target2" will run all tasks in target3 twice. + * Called by the project to let the task do its work. This method may be called more than once, if the task is + * invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 + * target2" will run all tasks in target3 twice. * * @throws org.apache.tools.ant.BuildException * if something goes wrong with the build @@ -88,7 +76,7 @@ if (sec == null) { throw new BuildException(ERROR_NO_SECURITY_SETTINGS); } - if(!sec.isEnabled() || sec.isEmpty()) { + if (!sec.isEnabled() || sec.isEmpty()) { log(MESSAGE_NO_SECURITY); return; } @@ -96,7 +84,7 @@ sec.applySecuritySettings(this); } catch (IOException e) { throw new BuildException(ERROR_COULD_NOT_APPLY_SETTINGS - +sec.toString(),e); + + sec.toString(), e); } super.execute(); } Modified: trunk/core/extras/ant/src/org/smartfrog/tools/ant/SmartFrogTask.java =================================================================== --- trunk/core/extras/ant/src/org/smartfrog/tools/ant/SmartFrogTask.java 2008-05-23 15:39:52 UTC (rev 6543) +++ trunk/core/extras/ant/src/org/smartfrog/tools/ant/SmartFrogTask.java 2008-05-23 16:55:50 UTC (rev 6544) @@ -36,24 +36,17 @@ import java.util.List; /** - * Class to let ant task derivatives run smartfrog. - * How it invokes smartfrog is an implementation detail; - * it may be calling the Java task, it may be calling smartfrog direct. - * What is not a detail is that the combined classpath of ant+ any classpath parameters must include - * all the relevant smartfrog JAR files. - * <p/> - * Smartfrog can be configured via system properties, an ini file, or the explicit - * properties of this task. All the attributes of this task that configure SmartFrog - * (port, liveness, spawning, stack trace) are undefined; whatever defaults are built into - * SmartFrog apply, not any hard coded in the task. This also permits one to override smartfrog - * by setting system properties inline, or in a property set. - * <p/> - * By default, all tasks are given a timeout of ten minutes; and propagate any - * failure to execute to the build file. These can be adjusted via the - * {@link SmartFrogTask#setTimeout(long)} and - * {@link SmartFrogTask#setFailOnError(boolean)} calls respectively. - * Note that when spawning, timeout and failonerror attributes are ignored (a verbose level message - * warns of this). passing them on to the java task would result in a failure. + * Class to let ant task derivatives run smartfrog. How it invokes smartfrog is an implementation detail; it may be + * calling the Java task, it may be calling smartfrog direct. What is not a detail is that the combined classpath of + * ant+ any classpath parameters must include all the relevant smartfrog JAR files. <p/> Smartfrog can be configured via + * system properties, an ini file, or the explicit properties of this task. All the attributes of this task that + * configure SmartFrog (port, liveness, spawning, stack trace) are undefined; whatever defaults are built into SmartFrog + * apply, not any hard coded in the task. This also permits one to override smartfrog by setting system properties + * inline, or in a property set. <p/> By default, all tasks are given a timeout of ten minutes; and propagate any + * failure to execute to the build file. These can be adjusted via the {@link SmartFrogTask#setTimeout(long)} and {@link + * SmartFrogTask#setFailOnError(boolean)} calls respectively. Note that when spawning, timeout and failonerror + * attributes are ignored (a verbose level message warns of this). passing them on to the java task would result in a + * failure. */ public abstract class SmartFrogTask extends TaskBase implements SysPropertyAdder { /** @@ -71,10 +64,10 @@ private boolean spawn; public static final String MESSAGE_SPAWNED_DAEMON = "Spawned SmartFrog daemon started"; - public static final String MESSAGE_IGNORING_FAILONERROR = "ignoring failonerror setting for spawned application"; - public static final String MESSAGE_IGNORING_TIMEOUT = "ignoring timeout setting for spawned application"; - public static final String ERROR_HOST_NOT_SETTABLE = "host cannot be set on this task; it is set to "; - public static final String ERROR_HOST_UNDEFINED = "host is undefined"; + public static final String MESSAGE_IGNORING_FAILONERROR = "Ignoring failonerror setting for spawned application"; + public static final String MESSAGE_IGNORING_TIMEOUT = "Ignoring timeout setting for spawned application"; + public static final String ERROR_HOST_NOT_SETTABLE = "Host cannot be set on this task; it is set to "; + public static final String ERROR_HOST_UNDEFINED = "Host is undefined"; public static final String LOCALHOST = "localhost"; public static final String LOCALHOST_IPV6_LONG = "0:0:0:0:0:0:0:1"; public static final String LOCALHOST_IPV6_SHORT = ":::::::1"; @@ -90,8 +83,7 @@ } /** - * initialisation routine; set up some settings like the java task - * that we configure as we go + * initialisation routine; set up some settings like the java task that we configure as we go * * @throws BuildException */ @@ -104,6 +96,7 @@ /** * override point + * * @return default timeout, return 1 number less than 0 for no timeout */ protected long getDefaultTimeout() { @@ -111,8 +104,6 @@ } - - /** * name of host */ @@ -132,49 +123,43 @@ /** * our security policy */ - protected SecurityPolicy securityPolicy=new SecurityPolicy(); + protected SecurityPolicy securityPolicy = new SecurityPolicy(); /** - * our JVM - */ + * our JVM + */ protected Java smartfrog; /** - * SmartFrog daemon connection port. - * org.smartfrog.ProcessCompound.sfRootLocatorPort=3800; + * SmartFrog daemon connection port. org.smartfrog.ProcessCompound.sfRootLocatorPort=3800; */ protected Integer port; // = 3800; /** - * Liveness check period (in seconds); default=15. - * org.smartfrog.ProcessCompound.sfLivenessDelay=15; + * Liveness check period (in seconds); default=15. org.smartfrog.ProcessCompound.sfLivenessDelay=15; */ protected Integer livenessCheckPeriod; // = 15; /** - * Liveness check retries - * org.smartfrog.ProcessCompound.sfLivenessFactor=5; + * Liveness check retries org.smartfrog.ProcessCompound.sfLivenessFactor=5; */ protected Integer livenessCheckRetries; // = 5; /** - * Allow spawning of subprocess - * # org.smartfrog.ProcessCompound.sfProcessAllow=true; + * Allow spawning of subprocess # org.smartfrog.ProcessCompound.sfProcessAllow=true; */ protected Boolean allowSpawning; // = true; /** - * Subprocess creation/failure timeout - default=60 seconds - * (slower machines might need longer periods to start a new subprocess) - * org.smartfrog.ProcessCompound.sfProcessTimeout=60; + * Subprocess creation/failure timeout - default=60 seconds (slower machines might need longer periods to start a + * new subprocess) org.smartfrog.ProcessCompound.sfProcessTimeout=60; */ protected Integer spawnTimeout; // = 60; /** - * stack tracing - * map to org.smartfrog.logger.logStrackTrace + * stack tracing map to org.smartfrog.logger.logStrackTrace */ protected Boolean logStackTraces; //= false; @@ -197,7 +182,7 @@ /** * timeout */ - private long timeout=0; + private long timeout = 0; /** @@ -219,9 +204,9 @@ } - /** * add a property file to the JVM + * * @param propFile property file */ public void addConfiguredPropertyFile(PropertyFile propFile) { @@ -229,8 +214,7 @@ } /** - * set the hostname to deploy to (optional, defaults to localhost) - * Some tasks do not allow this to be set at all. + * set the hostname to deploy to (optional, defaults to localhost) Some tasks do not allow this to be set at all. * * @param host hostname to deploy to */ @@ -240,8 +224,7 @@ } /** - * port of daemon; optional -default is 3800 - * Some tasks do not allow this to be set at all. + * port of daemon; optional -default is 3800 Some tasks do not allow this to be set at all. * * @param port port to talk on */ @@ -341,11 +324,10 @@ * @param policy security element */ public void addSecurityPolicy(SecurityPolicy policy) { - securityPolicy=policy; + securityPolicy = policy; } - /** * set a reference to the security types * @@ -374,14 +356,14 @@ Java java = createJavaTask(getEntrypoint()); java.setFork(true); java.setDir(getProject().getBaseDir()); - return java; } /** * Override point: declare the name of the entry point of this task. - * @see SmartFrogJVMProperties#SMARTFROG_ENTRY_POINT + * * @return name of the class providing a static void Main(String args[]) method + * @see SmartFrogJVMProperties#SMARTFROG_ENTRY_POINT */ protected String getEntrypoint() { return SmartFrogJVMProperties.SMARTFROG_ENTRY_POINT; @@ -404,16 +386,14 @@ } /** - * sets the fail on error flag. Once this is done - * you cannot spawn the process any more. + * sets the fail on error flag. Once this is done you cannot spawn the process any more. */ protected void enableFailOnError() { setFailOnError(true); } /** - * Set failure policy. - * (default=true) + * Set failure policy. (default=true) * * @param failOnError fail on error flag */ @@ -422,7 +402,6 @@ } - /** * assertions to enable in the new JVM. * @@ -442,10 +421,9 @@ } /** - * sets the spawn flag. - * Makes it hard (no, impossible!) to log outputs. - * only recommended for long-lived tasks, and complicates failonerror and timeout - * logic + * sets the spawn flag. Makes it hard (no, impossible!) to log outputs. only recommended for long-lived tasks, and + * complicates failonerror and timeout logic + * * @param spawn spawn flag */ public void setSpawn(boolean spawn) { @@ -454,6 +432,7 @@ /** * is spawen set + * * @return the spawn flag */ public boolean isSpawn() { @@ -485,7 +464,7 @@ * add a command * * @param command application command - * @param name name + * @param name name * @throws BuildException if there is no app name */ protected void addApplicationCommand(String command, String name) { @@ -495,8 +474,7 @@ } /** - * verify the app name is valid by whatever logic we have - * current asserts that it is non null + * verify the app name is valid by whatever logic we have current asserts that it is non null * * @param application the application name * @throws BuildException when unhappy @@ -508,7 +486,6 @@ } } - /** * Adds a system property. * @@ -530,7 +507,7 @@ /** * set a sys property on the smartfrog JVM * - * @param name property name + * @param name property name * @param value value */ public void addJVMProperty(String name, String value) { @@ -540,11 +517,8 @@ addSysproperty(property); } - /** - * this is a convenience method for things that work - * with the task -it defines a new JVM arg with the - * string value. + * this is a convenience method for things that work with the task -it defines a new JVM arg with the string value. * * @param argument JVM argument */ @@ -553,8 +527,7 @@ } /** - * part of the ANT interface; this method - * creates a JVM argument for manipulation + * part of the ANT interface; this method creates a JVM argument for manipulation * * @return create a nested JVM arg */ @@ -563,9 +536,10 @@ } /** - * set a sys property on the smartfrog JVM if the object used to set the property value is defined - * and if it is not already declared in the properties list - * @param name property name + * set a sys property on the smartfrog JVM if the object used to set the property value is defined and if it is not + * already declared in the properties list + * + * @param name property name * @param object if defined the toString() value is used */ public void addSmartfrogPropertyIfDefined(String name, Object object) { @@ -574,11 +548,9 @@ } } - /** - * run smartfrog and throw an exception if something went awry. - * failure texts are for when smartfrog ran and failed; errorTexts when - * smartfrog wouldnt run. + * run smartfrog and throw an exception if something went awry. failure texts are for when smartfrog ran and failed; + * errorTexts when smartfrog wouldnt run. * * @param failureText text when return value==-1 * @param errorText text when return value!=0 && !=1- @@ -593,16 +565,16 @@ //delayed setting only when the flag is true reduces the need to flip the bit propagateSpawnIncompatibleSettings(); //do any security configurations we need - if(securityHolder.isDefined()) { + if (securityHolder.isDefined()) { securityHolder.applySecuritySettings(this); } else { //use the default or simpler settings - // securityPolicy.applySecurityPolicy(this,smartfrog); + // securityPolicy.applySecurityPolicy(this,smartfrog); } //last minute logging - if(isDebug()) { - log("Command: "+getCommandLine()); + if (isDebug()) { + log("Command: " + getCommandLine()); } //run it @@ -638,11 +610,12 @@ /** * get the command line; return null when the method is absent (ant1.6 and earlier) + * * @return a command line or null for old Ant versions */ protected String getCommandLine() { try { - Method method=Java.class.getMethod("getCommandLine",new Class[0]); + Method method = Java.class.getMethod("getCommandLine", new Class[0]); CommandlineJava commandLine = (CommandlineJava) method.invoke(smartfrog); return commandLine.describeJavaCommand(); @@ -652,16 +625,15 @@ } /** - * this code looks at the spawn flag and only sets some properties if spawn - * is true + * this code looks at the spawn flag and only sets some properties if spawn is true */ private void propagateSpawnIncompatibleSettings() { if (isSpawn()) { - if(failOnError) { + if (failOnError) { setFailOnError(false); - log(MESSAGE_IGNORING_FAILONERROR,Project.MSG_VERBOSE); + log(MESSAGE_IGNORING_FAILONERROR, Project.MSG_VERBOSE); } - if(timeout>0) { + if (timeout > 0) { setTimeout(0); log(MESSAGE_IGNORING_TIMEOUT, Project.MSG_VERBOSE); @@ -696,14 +668,13 @@ /** - * if we ask for localhost, set it to null. - * This avoids problems with anything that demands that localhost is + * if we ask for localhost, set it to null. This avoids problems with anything that demands that localhost is * undefined */ protected void resetHostIfLocal() { if (LOCALHOST.equals(host) || LOCALHOST_IPV4.equals(host) - || LOCALHOST_IPV6_LONG.equals(host) || LOCALHOST_IPV6_SHORT.equals(host)) { + || LOCALHOST_IPV6_LONG.equals(host) || LOCALHOST_IPV6_SHORT.equals(host)) { host = null; return; } @@ -723,6 +694,7 @@ /** * set the timeout for execution. This is incompatible with spawning. + * * @param timeout timeout time */ public void setTimeout(long timeout) { @@ -731,11 +703,10 @@ /** * propagate the timeout to the Java process. This is incompatible with spawning. - * */ protected void propagateTimeout() { if (timeout > 0) { - log("Setting JVM timeout to "+timeout,Project.MSG_VERBOSE); + log("Setting JVM timeout to " + timeout, Project.MSG_VERBOSE); smartfrog.setTimeout(new Long(timeout)); } else { //no valid timeout; ignore it. Modified: trunk/core/extras/ant/src/org/smartfrog/tools/ant/StartApplication.java =================================================================== --- trunk/core/extras/ant/src/org/smartfrog/tools/ant/StartApplication.java 2008-05-23 15:39:52 UTC (rev 6543) +++ trunk/core/extras/ant/src/org/smartfrog/tools/ant/StartApplication.java 2008-05-23 16:55:50 UTC (rev 6544) @@ -22,25 +22,18 @@ import org.apache.tools.ant.BuildException; /** - * Start an SF application, an application which will run asynchronously until - * stopped by another mechanism. + * Start an SF application, an application which will run asynchronously until stopped by another mechanism. * * A smartfrog daemon must already be running on the target machine/port * - * @ant.task category="SmartFrog" name="sf-deploy" - * By default this target raises an error when the application cannot be stopped, and has a timeout - * set to the standard default value. {@link SmartFrogTask#DEFAULT_TIMEOUT_VALUE}. - * <p/> - * <i>Important</i>. The codebase set for this task in the codebase elements define the codebase - * for interpreting the deployment descriptor, but as the action of deployment is left to a daemon, - * JAR files and referenced in the codebase are loaded by the daemon during deployment. - * <p/> - * To ensure that the daemon can actually load the files, you need to - * <ol> - * <li>Place them in a shared location (shared file system may work) - * <li>Place URLs to the shared files in the smartfrog deployment descriptor's - * <tt>sfCodebase</tt> attribute. The <sf-tourl> task can be used to create - * a suitable URL from a file reference. + * @ant.task category="SmartFrog" name="sf-deploy" By default this target raises an error when the application cannot be + * stopped, and has a timeout set to the standard default value. {@link SmartFrogTask#DEFAULT_TIMEOUT_VALUE}. <p/> + * <i>Important</i>. The codebase set for this task in the codebase elements define the codebase for interpreting the + * deployment descriptor, but as the action of deployment is left to a daemon, JAR files and referenced in the codebase + * are loaded by the daemon during deployment. <p/> To ensure that the daemon can actually load the files, you need to + * <ol> <li>Place them in a shared location (shared file system may work) <li>Place URLs to the shared files in the + * smartfrog deployment descriptor's <tt>sfCodebase</tt> attribute. The <sf-tourl> task can be used to create a + * suitable URL from a file reference. */ public class StartApplication extends DeployingTaskBase { public static final String ERROR_COULD_NOT_DEPLOY = "Could not deploy"; @@ -57,6 +50,7 @@ * @throws BuildException on failure */ public void execute() throws BuildException { + setStandardSmartfrogProperties(); enableFailOnError(); checkApplicationsDeclared(); deployApplications(); Modified: trunk/core/extras/ant/src/org/smartfrog/tools/ant/StartDaemon.java =================================================================== --- trunk/core/extras/ant/src/org/smartfrog/tools/ant/StartDaemon.java 2008-05-23 15:39:52 UTC (rev 6543) +++ trunk/core/extras/ant/src/org/smartfrog/tools/ant/StartDaemon.java 2008-05-23 16:55:50 UTC (rev 6544) @@ -20,33 +20,23 @@ package org.smartfrog.tools.ant; import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; /** - * Start a daemon. There is some fun here, as this can be spawning or non-spawning. - * if it spawns, it outlives ant (which doesnt block), but output gets lost. - * This task only works on Ant1.6 or later, as that was when spawning was added to the - * system. - * <p/> - * This task starts a daemon which is only terminated by external request, and which - * blocks the calling thread until it terminates - * This means the build file calling this routine must either - * <ol> - * <li>execute it in a separate thread (using parallel/sequential containers), - * and call <sf-stopdaemon> in a separate thread to end it - * <li>set the standalone property to true to run it in a new process. - * <li>set the timeout to enforce a death time on the process. - * </ol> - * Timeout killing of a process is somewhat brutal; we do not (yet) cleanly shut - * down the localhost, though that is a distinctly possible option in future. + * Start a daemon. There is some fun here, as this can be spawning or non-spawning. if it spawns, it outlives ant (which + * doesnt block), but output gets lost. This task only works on Ant1.6 or later, as that was when spawning was added to + * the system. <p/> This task starts a daemon which is only terminated by external request, and which blocks the calling + * thread until it terminates This means the build file calling this routine must either <ol> <li>execute it in a + * separate thread (using parallel/sequential containers), and call <sf-stopdaemon> in a separate thread to end it + * <li>set the standalone property to true to run it in a new process. <li>set the timeout to enforce a death time on + * the process. </ol> Timeout killing of a process is somewhat brutal; we do not (yet) cleanly shut down the localhost, + * though that is a distinctly possible option in future. * - * @author steve loughran - * created 16-Feb-2004 16:37:26 + * @author steve loughran created 16-Feb-2004 16:37:26 * @ant.task category="SmartFrog" name="sf-startdaemon" */ public class StartDaemon extends DeployingTaskBase { - ... [truncated message content] |