commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@gmail.com>
Subject Re: Commons Chain And Branching/Iterating
Date Mon, 14 Mar 2005 01:59:54 GMT
Sorry for the late response on this -- I was in Tokyo all of last week
and not able to stay current on mailing list emails.

Out of the box, the closest any of the commands come to performing
conditional behavior is
org.apache.commons.chain.generic.LookupCommand, which executes a
specified command only if it can be found.  It would not be difficult
to write a command that did branching instead, based on some condition
-- the branch would be implemented as execution of an alternative
chain (or command) *instead of* continuing down the current chain.

Likewise, there's no built in support for iteration, but building a
Command that takes (say) a List of Context objects plus a command name
(or catalog + command name) and implements "execute this command for
each Context in the list" would be very easy to build.

Craig


On Wed, 9 Mar 2005 22:07:40 -0600, Michael Rasmussen
<razmaspaz@gmail.com> wrote:
> I am new to using commons chain, so if this is a basic question, feel
> free to tell me RTFM.  I am wondering if there is a way to create a
> command that branches conditionally or iterates over a collection in
> the context, and executes whatever is down chain from it based on that
> collection or iteration.  Best I can tell right now, chain does not
> allow a command ot influence the execution except by returning a true
> or false from execute.   Am I missing out on something?  Is there a
> way to add in flow control?
> 
> Thanks,
> Michael
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

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


Mime
View raw message