You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Michael Augustin <ma...@gmx.net> on 2004/12/08 01:19:21 UTC

[Fwd: ANT]

Hi all,

in a project we use ant as a workflow-engine. The difference to the 
normal use as a buildtool is, that target (workflows) are executed as 
often as the user requests and the ant-application runs over long time. 
That makes it necessarry that ant-variables (properties) are evaluated 
mroe than just on time.

So each time a target is executed I call reconfigure previously for each 
task/runtimeconfigurable-object. The change in the attachted files 
delegate the reconfigure-call also to the children-xml-elements (also 
RuntimeConfigurable-Objects).

Now the bad news: If you have child-elements in your ant-tasks, that are 
no tasks (means: your task is not an task-container, but you use 
child-elements and implements methods like addConfiguredChild(Child c) ) 
. The addConfiguredChild or wathever method you implemented for your 
child-element is called as often as reconfigure is called on the task in 
a target. So you have to pay attention on clearing the list of your 
child-object after perform was called. For myself I implemented a method 
clearForReconfigure that is called for each of my tasks.

So I would like to get a feedback for this change (see attached diff) 
and the idea to use ant as workflowengine.

-- 
Thanks in advance.

Michael Augustin

Re: [Fwd: ANT]

Posted by Michael Augustin <ma...@gmx.net>.
Hi,

thank you very much for this detailed answer. I hope to satisfy all your
points. I have a context-diff with full-javadoc, testdata and 
junit-testcase.

Caused by the immutable-rule in ANT it is not really testable, because 
the value of properties doesn't change between the first and the second 
execution of targets and tasks. So you only mention a differnce in the 
implementations if you use the Variable-Ant-Task (from 
ant-contrib.sf.net) or with the Available-Ant-Task which can overwrite 
existing properties.

One unclear points is left:
Why doesn't work a reconfigure with a sequential-Task or in generall 
with Task-Container-Task as expected. This containers never walk through 
their childs (not after line 436 in RuntimeConfigurable).

-- 
Michael Augustin


Re: [Fwd: ANT]

Posted by Peter Reilly <pe...@apache.org>.
I think that you are correct in the nested elements should be 
reconfigured as well -i.e. it is a bug not
to do this.

However the patch you provide has the following minor issues:

1) the diff should be done using context diff (diff -c command), 
otherwise it is difficult to apply.

2) You should change the current CVS source and not the released source 
(1.6.2 in this case). This is
    for a number of reasons - a) it makes sure that the change works 
against the latest version of ant, b)
    it is easier for ant committers to commit it, c) the fix may already 
be in cvs (this has happened on a number
    of occasions).

3) all public methods need a javadoc comment (including javadoc tags for 
each of the method parameters,
     return values and exceptions)

4) where possible a unit test (a build file would suffice) should be 
provided to show the fix or enhancement (maybe not easy in this case)

Peter

Michael Augustin wrote:

> Hi all,
>
> in a project we use ant as a workflow-engine. The difference to the 
> normal use as a buildtool is, that target (workflows) are executed as 
> often as the user requests and the ant-application runs over long 
> time. That makes it necessarry that ant-variables (properties) are 
> evaluated mroe than just on time.
>
> So each time a target is executed I call reconfigure previously for 
> each task/runtimeconfigurable-object. The change in the attachted 
> files delegate the reconfigure-call also to the children-xml-elements 
> (also RuntimeConfigurable-Objects).
>
> Now the bad news: If you have child-elements in your ant-tasks, that 
> are no tasks (means: your task is not an task-container, but you use 
> child-elements and implements methods like addConfiguredChild(Child c) 
> ) . The addConfiguredChild or wathever method you implemented for your 
> child-element is called as often as reconfigure is called on the task 
> in a target. So you have to pay attention on clearing the list of your 
> child-object after perform was called. For myself I implemented a 
> method clearForReconfigure that is called for each of my tasks.
>
> So I would like to get a feedback for this change (see attached diff) 
> and the idea to use ant as workflowengine.
>
>------------------------------------------------------------------------
>
>344a345,350
>  
>
>>       throws BuildException
>>    {
>>       maybeConfigure(p, configureChildren, false);
>>    }
>>    
>>    public void maybeConfigure(Project p, boolean configureChildren, boolean reconfigure)
>>    
>>
>394c400,405
><                 child.maybeConfigure(p);
>---
>  
>
>>                // Michael Augustin, 2004-10-20
>>                // call reconfigure also for children
>>                if (reconfigure == true)
>>                    child.reconfigure(p);
>>                else
>>                    child.maybeConfigure(p);
>>    
>>
>427c438,441
><         maybeConfigure(p);
>---
>  
>
>>        // 2004-10-20 ,Michael Augustin
>>        // call reconfigure also for children
>>        maybeConfigure(p, true, true);
>>    
>>
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>


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


Re: [Fwd: ANT]

Posted by Michael Augustin <ma...@gmx.net>.
Hi again,

sorry for the bad attachments. Now with correct ones.

-- 
bye
Michael Augustin