You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Sean Schofield <se...@gmail.com> on 2004/10/21 19:29:52 UTC
Re: [chain] Configuration idea
On Thu, 21 Oct 2004 10:16:14 -0700, Craig McClanahan <cr...@gmail.com> wrote:
> It's possible to delegate to a previously defined chain (or command)
> already, if you do two things:
>
> * (Optional) you don't need <chains> any more ... that was there
> in the original examples solely to satisfy XML's requirement for
> a single root element.
I meant to ask about that. I figured your were just needed a root element.
>
> * Use the existing lookup command to delegate execution to the
> foobar chain:
>
> <command catalog="..." name="foobar.chain"
> className="org.apache.commons.chain.generic.LookupCommand"/>
>
> which causes foobar.chain to be looked up and executed.
>
I didn't know about this one. That's probably even better because it
won't matter what order the chains are defined. Also, it will work
even if you decide to write your own Digester config rules (and forget
or don't want to deal with recursively adding the chains.)
> Looking at this, though, we'll probably want to clean up some of the
> existing command definitions that currently assume a catalog is
> present in the context ... thanks to CatalogFactory that is no longer
> necessary, so we can change that to optionally specify a catalog name
> (with a default to the standard one).
>
I will see if I can't work up some patches for this.
> In struts-chain there's an example of this sort of thing in the
> 'servlet-complete' chain.
>
So there is. :-)
> Craig
sean
>
>
>
> On Thu, 21 Oct 2004 10:31:24 -0400, Sean Schofield
> <se...@gmail.com> wrote:
> > I had an idea about how we could improve the default configuration of
> > commons-chain. It would be nice if we could have the following
> > catalog.xml:
> >
> > <catalog>
> > <chains>
> > <chain name="foobar.chain">
> > <command name="foo" className="Foo"/>
> > <command name="bar" className="Bar"/>
> > </chain>
> > <chain name="biz.chain">
> > <chain name="foobar.chain">
> > <command name="biz" className="Biz"/>
> > </chain>
> > </chains>
> > </catalog>
> >
> > The idea is that once a chain has been created through the Digester it
> > is available for subsequent chains that need to be created. Thus you
> > could reference an existing chain (as is done in the "biz.chain").
> >
> > This way you could reuse chains as you see fit. This could come in
> > handy eventually in the struts-chain project. You could group several
> > related commands together and then offer different chain combinations
> > to the user depending on what they need.
> >
> > Any thoughts on that?
> >
> > sean
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-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