How about this?
Context context = ...; // Commons Chain context for this command
Just a Map in my case.
String catalogName = ...; // Name of catalog containing the command you want
String commandName = ...; // Name of command you want (from this catalog)
Catalog catalog = CatalogFactory.getInstance().getCatalog(catalogName);
How does above catalog know to read my Xml catlog file, when it does not know the url to my xml file where the catalog is defined. Is there a certian place it looks at?
Command command = catalog.getCommand(commandName);
Since I do not think it read the catalog of commands from my xml, it won't get the command. But if the catalog could read it, I see how this would work.
How to read a catalog from XML?
command.execute(context);
Note that it uses a static method, so you don't have to carry around
references to a catalog in your method signatures
This is what my implementation does, but I'd like to upgrade, there are some deprecated chain methods now.
Of course ... I had to extend catalog to have a way of populating/initilzing self from XML.
.V
... just figure out
what catalog and command you want, and go.
Craig
On Fri, 03 Dec 2004 11:23:40 -0600, Vic <[EMAIL PROTECTED]> wrote:
Craig wrote quote in a struts dev thread on chain "
In your standard processing chain, do something like this:
<command className="org.apache.commons.chain.generic.LookupCommand catalogName="foo" name="bar" optional="true"/>
What this does, in English, is: * Look up a command named "bar" in a catalog named "foo". * If such a command exists, delegate control to it (and do all the right stuff about filters if this is a chain) * If such a command does not exist, silently continue
" end quote.
I do not understand how to do above. Is that the declaration done in chain.xml? This assumes that I hard code the name of command I want to go to. (if I knew command at decleration I would just name it then, not look up).
Is there a built in way of dispatching dynamicaly?
for example: lookUpAndExecute("foo");
Hint?
tia, .V
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
