commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@apache.org>
Subject Re: [chain] DTD/XSD of config-chain.xml
Date Mon, 19 Dec 2005 01:00:40 GMT
On 12/18/05, Wendy Smoak <wsmoak@gmail.com> wrote:
>
> On 12/18/05, Rahul Akolkar <rahul.akolkar@gmail.com> wrote:
>
> > I'm not aware of one. Some thoughts that may help, based on my
> understanding:
> >
> >  * A <catalog> element (usually the root) can contain any number of
> commands.
> >  * A command may be represented by a single <command> element or a
> > <chain> element
> >  * A <chain> element can contain multiple <command> elements, which
> > get executed in order
>
> Any thoughts on the use of <catalog> as the root element vs. <chains>
> as shown in the cookbook examples?
>
> Using <catalog> puts the commands into the default catalog which is
> retrieved with CatalogFactory.getInstance().getCatalog().
>
> Using <chains> seems to do something else.  I haven't figured out if
> the commands are going somewhere else, if the config file just isn't
> being parsed, (or if I'm imagining it.)


Chain tries to be incredibly (perhaps insanely :-) flexible about what
element and attribute names it recognizes.  As I mentioned in a previous
message, the code that actually decides this is the instance of
ConfigRuleSet that you use to configure the Digester that parses the XML
configuration resources.  The cookbook page on the web site illustrates what
to use when you take the defaults.

  http://jakarta.apache.org/commons/chain/cookbook.html

In addition, you are also running into a semantics issue caused by the
development history of Chain.  Originally, there was no concept of catalogs;
all the commands and chains were registered together, and the <catalog>
syntax was sufficient for that.  Later on, it became clear that multiple
catalogs were a very useful gadget.  (As a side note, you'll smile when you
see whose idea *that* was, and did a lot of the heavy lifting :-):

  http://issues.apache.org/bugzilla/show_bug.cgi?id=31566

As usual in Apache land, we tried to stay backwards compatible with the old
syntax, even though it ideally would have gotten pulled before the
1.0release.  I would suggest sticking with the syntax that supports
multiple
catalogs, but with one final warning -- the actual element name of the
outermost element of your document does not really matter.  The Digester
rules are initialized with patterns like "*/chain" and "*/command" that
match wherever in the XML document hierarchy they are found.

Thanks,
> --
> Wendy


Craig

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message