ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Prompt task
Date Fri, 01 Dec 2000 09:46:41 GMT
Simeon H. K. Fitch <> 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


View raw message