ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magesh Umasankar" <>
Subject RE: DispatchTask
Date Wed, 02 Jun 2004 19:09:56 GMT
Subject:    RE: DispatchTask
From:       Dominique Devienne <DDevienne () lgc ! com>
Date:       2004-06-02 18:50:53

> Hi Magesh. It's been a long time ;-)

> What's the advantage of this other writing different tasks, possibly with
> the usual Java code re-use? Especially if different modes require
> params. I've written at least one task with an action attribute and then
> the dispatch based on it, but I don't think this should be made into a
> framework. What's your more specific use case? --DD

The advantage is that related operations are closely coupled.  For example,
untar may operate in list mode, in actual expand mode, etc. and these
operations are bundled together as part of a single class instead of
subclassing from a parent abstract UnTar class for each operation.

Another advantage is being able to invoke an operation based on a property.

<mytask mode="${mode}"/>

If each mode was its own task, writing the equivalent of the above would be
a little more complex, I think.

This, of course, is not the solution where parameters are going to be
different for multiple operations.

btw, "action" is a more appropriate name than "mode".  Maybe "command" too
is?  I don't know.

You are saying that you have used it at least once.  I have used it a few
times - usually for custom tasks where I either insert, update or delete a
set of rows in a DB based on some conditions outisde the task itself.  IMHO
there is value in adding it to the core.  But then that is because I'm
pitching for it ;-)

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message