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 18:37:22 GMT
See intermixed.


On Thu, 21 Oct 2004 13:00:20 -0500, Joe Germuska <joe@germuska.com> wrote:
> At 10:27 AM -0500 10/21/04, Joe Germuska wrote:
> >At 10:31 AM -0400 10/21/04, Sean Schofield 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>
> >
> >I think it's basically a good idea, although I'd want a different
> >attribute for references; reusing "name" with the same element and
> >different semantics would be pretty confusing.
> >
> >How about "ref"?
> >
> >     <chain name="biz.chain">
> >       <chain ref="foobar.chain">
> >       <command name="biz" className="Biz"/>
> >     </chain>
> 
> Craig has since responded on this issue pointing out that it can be
> done.  However, I have had in the back of my head a bit of a nagging
> concern that the XML syntax for commons-chain is verbose, if not
> confusing.   Then again, I haven't set out to make a new chain myself
> yet, so I don't have a good feel about just how serious the issue is.
> 

One nitpick ... a "ref" thing like this probably ought to be on
<command> because you don't necessarily know whether what you are
referring to is actually a chain or just a singleton command.

> So, Craig -- would you object to something like the above, which is
> more concise, even though there is another way to do it?  How about
> anyone else who has been interested in Chain?  Is it too early to
> optimize the config syntax?
 
There has been some interest, but not a lot of commentary on the
configuration syntax so far.  One thing that is in place (but not well
documented) is the "define" capability, which essentially lets you
create aliases for command elements that you might use over and over
again.  It's used in the unit test cases
(src/test/org/apache/commons/chain/config/*.xml) but goes like this.

Let's assume you're going to use this lookup mechanism a lot.  So, you
can create a shortcut for it like this:

  <define name="lookup"
className="org.apache.commons.chain.generic.LookupCommand"/>

and then, in your actual chain definitions, you can say:

  <lookup name="foobar.chain"/>

Essentially, the implementation creates new Digester rules on the fly.
 Does that help?

> Joe

Craig

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