You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Emir Mahmut BAHSI <em...@yahoo.com> on 2007/05/10 08:49:55 UTC

while-like structure in Ant

Hi all,
I have been working on conditional structures and loop structures on existing workflow managers for a long time. For this purpose I have implemented two simple examples for if-type and switch-type cases (examples are attached). In these examples my program is simply downloading a file. If that file does not exist in the first web address it tries another address. However, I could not implement a loop structure for that. In the loop case the program should try the same address until the file exists. Actually I know this is not a reasonable and useful scenario but I just want to show whether a conditional-loop scenario can be implemented in Ant.

Can u suggest me anything to implement that example. Any help is appreciated.

Thanks. 



  
Emir Mahmut Bahsi
Research assistant
Dept of Computer Science at LSU
Room 231, Johnston Hall
Louisiana State University
Baton Rouge, LA 70803
embahsi@cct.lsu.edu






       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: while-like structure in Ant

Posted by Kevin Jackson <fo...@gmail.com>.
Hi,

> Can u suggest me anything to implement that example. Any help is
> appreciated.

Ant-contrib[1] has most of the imperative language features for ant
(if/else etc)

Kev
[1] http://ant-contrib.sourceforge.net/tasks/tasks/index.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: while-like structure in Ant

Posted by Emir Mahmut BAHSI <em...@yahoo.com>.
Sorry everybody for the late replay. I am trying to implement that while structure as I explained before. I am using javascript for that. However, I can not create a http task in javascript code. That part of the code is:

myhttp = project.createTask("http");
myhttp.setUrl("a url address");

The error is: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot call method "setUrl" of null <<Unknown source>#5> in <Unknown source> at line number 5

Any help is appreciated. Thanks in advance.

Emir Mahmut Bahsi






"Rebhan, Gilbert" <Gi...@huk-coburg.de> wrote:  
-----Original Message-----
From: Xavier Hanin [mailto:xavier.hanin@gmail.com] 
Sent: Thursday, May 10, 2007 9:17 AM
To: Ant Users List
Subject: Re: while-like structure in Ant

On 5/10/07, Emir Mahmut BAHSI  wrote:
>
> Hi all,
> I have been working on conditional structures and loop structures on
> existing workflow managers for a long time. For this purpose I have
> implemented two simple examples for if-type and switch-type cases
(examples
> are attached). In these examples my program is simply downloading a
file. If
> that file does not exist in the first web address it tries another
address.
> However, I could not implement a loop structure for that. In the loop
case
> the program should try the same address until the file exists.
Actually I
> know this is not a reasonable and useful scenario but I just want to
show
> whether a conditional-loop scenario can be implemented in Ant.
>
> Can u suggest me anything to implement that example. Any help is
> appreciated.

/*
The ant-contrib project is providing conditional tasks which may help,
but
if you want to have your own syntax and the very specific url
availability
as a condition (like you wrote), maybe using a script (using scriptdef
for
example) would be a good fit.
*/

+1

i would go via  and a scripting language running in
BSF
(JRuby, Groovy, Beanshell ... )

or use the AntBuilder@Groovy

see =
http://groovy.codehaus.org/
http://www.bytemycode.com/snippets/snippet/475/

Regards, Gilbert



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



       
---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 

RE: while-like structure in Ant

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
 
-----Original Message-----
From: Xavier Hanin [mailto:xavier.hanin@gmail.com] 
Sent: Thursday, May 10, 2007 9:17 AM
To: Ant Users List
Subject: Re: while-like structure in Ant

On 5/10/07, Emir Mahmut BAHSI <em...@yahoo.com> wrote:
>
> Hi all,
> I have been working on conditional structures and loop structures on
> existing workflow managers for a long time. For this purpose I have
> implemented two simple examples for if-type and switch-type cases
(examples
> are attached). In these examples my program is simply downloading a
file. If
> that file does not exist in the first web address it tries another
address.
> However, I could not implement a loop structure for that. In the loop
case
> the program should try the same address until the file exists.
Actually I
> know this is not a reasonable and useful scenario but I just want to
show
> whether a conditional-loop scenario can be implemented in Ant.
>
> Can u suggest me anything to implement that example. Any help is
> appreciated.

/*
The ant-contrib project is providing conditional tasks which may help,
but
if you want to have your own syntax and the very specific url
availability
as a condition (like you wrote), maybe using a script (using scriptdef
for
example) would be a good fit.
*/

+1

i would go via <script(def) .../> and a scripting language running in
BSF
(JRuby, Groovy, Beanshell ... )

or use the AntBuilder@Groovy

see =
http://groovy.codehaus.org/
http://www.bytemycode.com/snippets/snippet/475/

Regards, Gilbert



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: while-like structure in Ant

Posted by Emir Mahmut BAHSI <em...@yahoo.com>.
Actually I have implemented if and switch scenerios by using ant-contrib project. However I could not use their loop structure for my purpose. scriptdef seems a good option. I will try it.
Thank you very much. I am open to any other suggestions also. Apreciated.

Emir M Bahsi

Xavier Hanin <xa...@gmail.com> wrote: On 5/10/07, Emir Mahmut BAHSI  wrote:
>
> Hi all,
> I have been working on conditional structures and loop structures on
> existing workflow managers for a long time. For this purpose I have
> implemented two simple examples for if-type and switch-type cases (examples
> are attached). In these examples my program is simply downloading a file. If
> that file does not exist in the first web address it tries another address.
> However, I could not implement a loop structure for that. In the loop case
> the program should try the same address until the file exists. Actually I
> know this is not a reasonable and useful scenario but I just want to show
> whether a conditional-loop scenario can be implemented in Ant.
>
> Can u suggest me anything to implement that example. Any help is
> appreciated.


The ant-contrib project is providing conditional tasks which may help, but
if you want to have your own syntax and the very specific url availability
as a condition (like you wrote), maybe using a script (using scriptdef for
example) would be a good fit.

Xavier

Thanks.
>
>
>
> *Emir Mahmut Bahsi
> Research assistant
> Dept of Computer Science at LSU
> Room 231,
>  Johnston Hall
> Louisiana State University
> Baton Rouge, LA 70803
> embahsi@cct.lsu.edu*
>
> *
> *
>
> ------------------------------
> Ahhh...imagining that irresistible "new car" smell?
> Check out new cars at Yahoo! Autos.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
Xavier Hanin - Independent Java Consultant
Manage your dependencies with Ivy!
http://incubator.apache.org/ivy/


 	      
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: while-like structure in Ant

Posted by Xavier Hanin <xa...@gmail.com>.
On 5/10/07, Emir Mahmut BAHSI <em...@yahoo.com> wrote:
>
> Hi all,
> I have been working on conditional structures and loop structures on
> existing workflow managers for a long time. For this purpose I have
> implemented two simple examples for if-type and switch-type cases (examples
> are attached). In these examples my program is simply downloading a file. If
> that file does not exist in the first web address it tries another address.
> However, I could not implement a loop structure for that. In the loop case
> the program should try the same address until the file exists. Actually I
> know this is not a reasonable and useful scenario but I just want to show
> whether a conditional-loop scenario can be implemented in Ant.
>
> Can u suggest me anything to implement that example. Any help is
> appreciated.


The ant-contrib project is providing conditional tasks which may help, but
if you want to have your own syntax and the very specific url availability
as a condition (like you wrote), maybe using a script (using scriptdef for
example) would be a good fit.

Xavier

Thanks.
>
>
>
> *Emir Mahmut Bahsi
> Research assistant
> Dept of Computer Science at LSU
> Room 231,
>  Johnston Hall
> Louisiana State University
> Baton Rouge, LA 70803
> embahsi@cct.lsu.edu*
>
> *
> *
>
> ------------------------------
> Ahhh...imagining that irresistible "new car" smell?
> Check out new cars at Yahoo! Autos.<http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM->
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
Xavier Hanin - Independent Java Consultant
Manage your dependencies with Ivy!
http://incubator.apache.org/ivy/

Re: while-like structure in Ant

Posted by "Scot P. Floess" <fl...@mindspring.com>.
Emir:

Can you email me your examples?  I may be able to help you out...  
Sorry, I started a new job a few months ago and I seem to have very 
little free time - I've been rather quiet here lately because of it...

Guru Balse wrote:
> FYI: Scot Floess (floess@mindspring.com) has implemented some great 
> loop solutions using <math> and <for> from ant-contrib.
>
> Steve Loughran wrote:
>> Emir Mahmut BAHSI wrote:
>>> Hi all,
>>> I have been working on conditional structures and loop structures on 
>>> existing workflow managers for a long time. For this purpose I have 
>>> implemented two simple examples for if-type and switch-type cases 
>>> (examples are attached). In these examples my program is simply 
>>> downloading a file. If that file does not exist in the first web 
>>> address it tries another address. However, I could not implement a 
>>> loop structure for that. In the loop case the program should try the 
>>> same address until the file exists. Actually I know this is not a 
>>> reasonable and useful scenario but I just want to show whether a 
>>> conditional-loop scenario can be implemented in Ant.
>>>
>>> Can u suggest me anything to implement that example. Any help is 
>>> appreciated.
>>>
>>> Thanks.
>>>
>>
>> Ant is not a general purpose workflow manager.  That means we get to 
>> avoid a lot of the workflowy concepts of conditions, choices and 
>> loops, or the pi-calculus constructs.  And it doesnt come with anyy 
>> failure handling.
>>
>> What it does have is some simple conditions, the option to skip 
>> targets or fail the build on the state of conditions, and the ability 
>> to block until a condition is met.
>>
>> if all you want is for the build to pause until a file is present, 
>> use the <waitfor> task,
>>
>> -steve
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-392-6730 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: while-like structure in Ant

Posted by Guru Balse <gu...@oracle.com>.
FYI: Scot Floess (floess@mindspring.com) has implemented some great loop 
solutions using <math> and <for> from ant-contrib.

Steve Loughran wrote:
> Emir Mahmut BAHSI wrote:
>> Hi all,
>> I have been working on conditional structures and loop structures on 
>> existing workflow managers for a long time. For this purpose I have 
>> implemented two simple examples for if-type and switch-type cases 
>> (examples are attached). In these examples my program is simply 
>> downloading a file. If that file does not exist in the first web 
>> address it tries another address. However, I could not implement a 
>> loop structure for that. In the loop case the program should try the 
>> same address until the file exists. Actually I know this is not a 
>> reasonable and useful scenario but I just want to show whether a 
>> conditional-loop scenario can be implemented in Ant.
>>
>> Can u suggest me anything to implement that example. Any help is 
>> appreciated.
>>
>> Thanks.
>>
>
> Ant is not a general purpose workflow manager.  That means we get to 
> avoid a lot of the workflowy concepts of conditions, choices and 
> loops, or the pi-calculus constructs.  And it doesnt come with anyy 
> failure handling.
>
> What it does have is some simple conditions, the option to skip 
> targets or fail the build on the state of conditions, and the ability 
> to block until a condition is met.
>
> if all you want is for the build to pause until a file is present, use 
> the <waitfor> task,
>
> -steve
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: while-like structure in Ant

Posted by Steve Loughran <st...@apache.org>.
Emir Mahmut BAHSI wrote:
> Hi all,
> I have been working on conditional structures and loop structures on 
> existing workflow managers for a long time. For this purpose I have 
> implemented two simple examples for if-type and switch-type cases 
> (examples are attached). In these examples my program is simply 
> downloading a file. If that file does not exist in the first web address 
> it tries another address. However, I could not implement a loop 
> structure for that. In the loop case the program should try the same 
> address until the file exists. Actually I know this is not a reasonable 
> and useful scenario but I just want to show whether a conditional-loop 
> scenario can be implemented in Ant.
> 
> Can u suggest me anything to implement that example. Any help is 
> appreciated.
> 
> Thanks.
> 

Ant is not a general purpose workflow manager.  That means we get to 
avoid a lot of the workflowy concepts of conditions, choices and loops, 
or the pi-calculus constructs.  And it doesnt come with anyy failure 
handling.

What it does have is some simple conditions, the option to skip targets 
or fail the build on the state of conditions, and the ability to block 
until a condition is met.

if all you want is for the build to pause until a file is present, use 
the <waitfor> task,

-steve


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org