You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Macon Pegram <mp...@hotmail.com> on 2002/05/06 16:28:41 UTC

"Prompt" ANT task....

I have 2 questions, but first a little background:

I was recently looking at the FTP optional task in ANT and noticed that 
"User ID" and "Password" are required attributes.  This seems like a rather 
bad idea from a security standpoint, so I set out to do something about it.

My initial inclination was to extend the "FTP" task and create a "SecureFTP" 
task which would check to see if the values were input into the tags, and if 
not, prompt the user for these values.  After looking into this a bit 
further, I realized that this approach would not be practical because the 
userid and password variables are private, and no getter is available for 
these values.

That lead me to my current approach which is what I wanted to ask about.  
I've created a "Prompt" task which I actually like a lot better than any of 
the other approaches I considered.  The "Prompt" task will allow you to 
define: 1. A message to display when the user is prompted, 2. a Property 
name (which is a required attribute) to assign the user's input to, 3. a 
display type (more on that in a bit), and finally 4. Echo "on" or "off".

One would use the task to query the user for input, then assign that input 
value to a property which could be used later (say as a password property 
for FTP, or some other value you don't want to hard-code into the ANT 
script... The "display" property will allow the user to choose: text, gui, 
or automatic (which will try to do a gui, if that fails, it will revert to 
text).  The main rationale behind this is tied to the "echo" attribute.  If 
you want to prompt a user for a "password" then you probably want to turn 
"echo" "off" so that it doesn't appear on the screen.  Unfortunately, at the 
text-ui (or commandline) level in Java it is virtually impossible to prevent 
echo of text entered by the user... hence the AWT based GUI input method.

Now that I've provided all the background info, here are my two questions:
1. Is there any reason why ANT does not currently provide a task like this? 
Is there a good reason that "interactive" tasks are NOT provided?

2. Is there a standard that disallow's GUI's for ANT tasks (when a text 
interface is also provided)?

I'd like to contribute this task to Jakarta if you think's it's valuable, 
but I want to make sure it is within your guidelines.

Thanks!
Macon Pegram


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: "Prompt" ANT task....

Posted by Ken Wood <kw...@i2.com>.
Actually, what I think would be MUCH better
for the FTP task would be to have an encrypted
file with the name and password, and the ftp task
able to take that file name as a parameter, and
decrypt it's content. Or, at least, something
along these lines.

And, over the past year or two, several prompt
tasks have been contributed. I recall playing
around with one of them. But since ant tends almost
aways to be run as part of automated builds, the
prompt code apparently never went very far...

Macon Pegram wrote:
> 
> I have 2 questions, but first a little background:
> 
> I was recently looking at the FTP optional task in ANT and noticed that
> "User ID" and "Password" are required attributes.  This seems like a rather
> bad idea from a security standpoint, so I set out to do something about it.
> 
> My initial inclination was to extend the "FTP" task and create a "SecureFTP"
> task which would check to see if the values were input into the tags, and if
> not, prompt the user for these values.  After looking into this a bit
> further, I realized that this approach would not be practical because the
> userid and password variables are private, and no getter is available for
> these values.
> 
> That lead me to my current approach which is what I wanted to ask about.
> I've created a "Prompt" task which I actually like a lot better than any of
> the other approaches I considered.  The "Prompt" task will allow you to
> define: 1. A message to display when the user is prompted, 2. a Property
> name (which is a required attribute) to assign the user's input to, 3. a
> display type (more on that in a bit), and finally 4. Echo "on" or "off".
> 
> One would use the task to query the user for input, then assign that input
> value to a property which could be used later (say as a password property
> for FTP, or some other value you don't want to hard-code into the ANT
> script... The "display" property will allow the user to choose: text, gui,
> or automatic (which will try to do a gui, if that fails, it will revert to
> text).  The main rationale behind this is tied to the "echo" attribute.  If
> you want to prompt a user for a "password" then you probably want to turn
> "echo" "off" so that it doesn't appear on the screen.  Unfortunately, at the
> text-ui (or commandline) level in Java it is virtually impossible to prevent
> echo of text entered by the user... hence the AWT based GUI input method.
> 
> Now that I've provided all the background info, here are my two questions:
> 1. Is there any reason why ANT does not currently provide a task like this?
> Is there a good reason that "interactive" tasks are NOT provided?
> 
> 2. Is there a standard that disallow's GUI's for ANT tasks (when a text
> interface is also provided)?
> 
> I'd like to contribute this task to Jakarta if you think's it's valuable,
> but I want to make sure it is within your guidelines.
> 
> Thanks!
> Macon Pegram
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: "Prompt" ANT task....

Posted by Diane Holt <ho...@yahoo.com>.
--- Macon Pegram <mp...@hotmail.com> wrote:
> 1. Is there any reason why ANT does not currently provide a task like
> this? 

An <input> task has been added in Ant1.5 (now in beta). See:
  http://jakarta.apache.org/ant/manual/CoreTasks/input.html

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>