commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@gmail.com>
Subject Re: [chain] Configuration idea
Date Thu, 21 Oct 2004 17:16:14 GMT
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.

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

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

In struts-chain there's an example of this sort of thing in the
'servlet-complete' chain.

Craig

On Thu, 21 Oct 2004 10:31:24 -0400, Sean Schofield
<sean.schofield@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-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message