commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <>
Subject Re: Chain of Responsibility Catalog, Adding Command Element Attributes
Date Tue, 17 Jul 2007 16:31:06 GMT
On 7/17/07, richard head <> wrote:
> >>What I would like to do is use a catalog.xml file to store the chain, and
> >>add the appropriate attributes to the given command element.
> >>
> >>i.e. <command name="EmailUser" className=""
> >>smtpServer="" .../>
> >>
> >>
> >>In order to achieve such functionality, what would I have to do, set the
> >>appropriate rules in the ConfigParser's Digester?
> >>
> >>i.e.
> >>config.getDigester().addSetProperties("/catalog/chain/command","smtpServer","smtpServer")
> >
> >You don't have to change the configured digester rules at all -  just
> >add getters/setters as appropriate - so in your case adding
> >setSmtpServer() and getSmtpServer() methods to your Emailer command
> >and when the xml is parsed they will get called with the values you've
> >specified in your xml.
> Ok, cool. Though is it possible for these attributes to be classes?

Not quite sure what you mean - do you want something like
setFooClass(Class fooClass)?

Anyway its not something I've tried by AFAIK the set properties rule
in Digester uses BeanUtils.populate() - which uses any registered
Converters - there is one for "Class" - so the above
setFooClass(Class) example should work with the String value specified
in your XML being converted to a Class.

Best way with these types of things is always to give it a go and see
what happens.


> Thanks

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message