commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <david.k...@wamu.net>
Subject [chain] Strategies for alternate paths through a chain
Date Sun, 20 Aug 2006 18:10:07 GMT
Spring 1.2.1, commons-chain 1.0, JDK 1.4.2, WebLogic 8.1.4.

I have a relatively simple chain in a large Spring application context.
I've realized that somewhat near the end of the chain, I need to be able
to "skip" one or more commands, and at least one of those commands is a
reusable parameterized component, so I can't just put a chain-specific
flag into the context to make the skippable command(s) be a noop.

So, what are my options for following alternate paths through a command
chain?

The point where I determine I'll need to skip 1 or more commands is in a
chain-specific class (not a reusable component), so I can write code in
there to do whatever I need.

I see that within the code of a command, I can get the Catalog through
the static method in CatalogFactory, and then I can get a specific
command (I assume that the "id" property in the context is the "name"
the API refers to?), which I could then execute, and then perhaps return
true from the calling command.

If in that code of the command, I determine I need to skip the next
command, but execute the last two commands of the chain, could I wrap
the last two commands in a nested command (a ChainBase), so I could then
get that ChainBase from the catalog and execute that? If I didn't need
to skip the command, would it execute into the nested command normally?

---------------------------------------------------------------------
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