ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matt.in...@sedonacorp.com
Subject some useful tasks
Date Mon, 02 Jul 2001 17:07:39 GMT
i have written the following tasks for my installer which i think
might be helpful for other users.  Attached are the class headers
which describe the syntax and the functionality of these tasks.
The first one is a "switch" task, and the second is a "prompt"
task.  I know these could be done by using the <script> task
and the Rhino javascript engine, but it's much nicer to have a well
defined task for these.

Opinions anyone?

/***
 * Task definition for the ANT task to switch on a particular value
 * Usage:
 *
 *   Task declaration in the project:
 *     <taskdef name="switch" classname="com.sedona.ant.taskdef.Switch"
/>
 *
 *   Task calling syntax:
 *     <switch value="value" [caseinsensitive="true|false"] >
 *       <case value="val"
 *             [target="targetname" |
 *              (property="propname" propertyvalue="setval")] />+
 *       [<default [target="targetname" |
 *                  (property="propname" propertyvalue="setval")] />
 *     </switch>
 *
 *
 *   Attributes:
 *       value           -> The value to switch on
 *       caseinsensitive -> Should we do case insensitive comparisons?
                            (default is false)
 *
 *   Subitems:
 *       case     --> A single case specification for what to do when a
 *                    particular value is encountered.
 *        Attributes:
 *          value           --> The value to match
 *          target          --> The name of a target to execute if
matched
 *          property        --> The name of a property to set if matched

 *          propertyvalue   --> The value to set the named property to
 *
 *       default  --> The default case for when no match is found.  This

 *                    has the same syntax as the case item, but the
value
 *                    attribute is ignored.
 *
 *   Notes:
 *       1.  The property and propertyvalue attributes are tied together

 *           and one cannot be present without the other.
 *       2.  The target attribute is mutually exclusive with the
 *           (property,propertyvalue) attribute pair, and will throw
 *           an exception if both are present.
 */


/***
 * Task definition for the ANT task to prompt the user for information
 * Usage:
 *
 *   Task declaration in the project:
 *     <taskdef name="prompt" classname="com.sedona.ant.taskdef.Prompt"
/>
 *
 *   Task calling syntax:
 *     <prompt message="message" propertyname="propname"
 *             [defaultvalue="value" | allowempty="true|false"]
 *     >
 *        [ <allow value="value" ]*
 *     </prompt>
 *
 *   Attributes:
 *       message -> The message to display to the user
 *       propertyname -> The name of the property to set with the
received input
 *       defaultValue -> The default value if the user just hits enter
 *       allowempty   -> Whether or not an empty value is allowed
 *
 *   Subitems:
 *       <allow  value="value" /> --> allow this value to be input.  By
supplying
 *                                    one or more of this subitem, you
limit the
 *                                    input to a range of specific
allowable
 *                                    values.  Any value input that is
not explicitly
 *                                    allowed is rejected.  (good for
y/n questions)
 *
 *   Notes:
 *       1. The defaultvalue and allowempty attributes are mutually
exclusive,
 *          and if both are specified, the defaultvalue attribute takes
precedence.
 */


--
Matt Inger (matt.inger@sedonacorp.com)
Sedona Corporation
455 S. Gulph Road, Suite 300
King of Prussia, PA 19406
(484) 679-2213
"Self-respect - the secure feeling that no one,
 as yet, is suspicious." -H.L. Mencken




Mime
View raw message