ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sivaprasad.Kanche...@itsindia.com
Subject Re: Prompt Task
Date Tue, 07 Aug 2001 15:51:44 GMT
This was a old discussion I happened to go through in the archives. For my
project, I need to use the prompt task extensively.

Please let me know if the task has been included in the latest version of
Ant. I am using 1.3. In case it is not yet included, can some one mail the
code and relevant documentation, so I can reuse it.

Thanks in advance,
Siva

Simeon H. K. Fitch <simeon@fitch.net> wrote:

> Without making things too complicated, I think it would be a good
> idea to take a more generalized architectural approach, as I can see
> this type of functionality growing down the road.

Agreed, especially when adding new front ends to Ant that fill very
different needs, install shields that use Ant as an installation tool
spring to mind.

> First, consider an interface called UserRequest, that encapsulates
> the content of the request, as well as the validation of the input:
>
> interface UserRequest {
>
>    /** The prompt to display to the user. */
>    String getPrompt();
>
>    /** The default option, or null if no default. */
>    String getDefaultOption();
>
>    /** Determine if the string the user entered is a valid
>     *  response. */
>    boolean isValid(String response);
> }
>
> A request for data would involve instantiating some implementer of
> this interface (e.g. BooleanRequest, StringRequest, OptionRequest,
> PasswordRequest), and passing it to the Project instance that has
> had the following additional methods:

Putting the validation into the request sounds like a good idea, that
way we don't have to come back to the task just to see the user
entered something invalid. I'm not too sure what a general
PasswordRequest could do in this area though.

I'm fine with anything else as well.

> Also imagine implementing an "AutoRequestHandler" that would behave
> like "Expect" whereby the response to questions are looked up in
> some property file.

Yep, this would be very useful in the context of an installation
procedure that could run automatically - tailored by a local
administrator.

Stefan


Mime
View raw message