Re: [loom] [dna] Properties in component configurations
Jason van Zyl <[email protected]>
| Newsgroups | gmane.comp.java.jcontainer.interest |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 2003-11-13 at 20:34, Ryan Hoegg wrote:
> Hello,
>
> Wanted to get your thoughts on using properties in component
> configuration like in maven / jelly.
>
> My first thought is that it should be done transparently by the
> container, but I don't know if that should somehow be mentioned in DNA.
> Thoughts?
That's what I'm going to be doing with the assembly and configuration in
Plexus and I'm actually going to use XStream to take a Configuration and
process it against a live component as XStream will do all the necessary
conversion for me. I'm adding this to XStream as this is what I used to
do in Turbine using commons-xo (only turbine ever used it).
> It could also be done by another block, ConfigPropertiesResolutionBlock,
> and then declared as a dependency by any component that wants to use it.
> Then, the component would do something like this:
>
> /**
> * @dna dependency
> name="org.jcomponent.propertiesresolver.PropertiesResolver"
> */
> public void compose(ResourceLocator locator) throws MissingResourceException
> {
> this.propertiesResolver =
> locator.lookup("org.jcomponent.propertiesresolver.PropertiesResolver");
> }
>
> public void configure(Configuration configuration) throws
> ConfigurationException
> {
> Configuration processedConfig =
> propertiesResolver.resolveProperties(configuration);
>
> // do stuff with processedConfig instead of configuration
> }
>
> Which way sounds good to you?
I say letting the container do it would be the best approach but I'm not
sure you can do this with DNA. You pretty much know what the
configuration options, which ones are manditory and so on so there's not
reason you couldn't grab a default configuration that comes with the
component and merge it with user defined values (thanks proyal :-)) and
then take this merged Configuration and then let XStream "run" the
Configuration against the live component (I've taught XStream how to
deal with Avalon like configuration, very easy since XStream is soooo
flexible).
> --
> Ryan Hoegg
> ISIS Networks
> http://www.isisnetworks.net
>
> _______________________________________________
> jcontainer-interest mailing list
> jcontainer-interest-81qHHgoATdGxIXFVlbCvtR2eb7JE58TQ@public.gmane.org
> http://lists.codehaus.org/mailman/listinfo/jcontainer-interest
--
jvz.
Jason van Zyl
[email protected]
http://tambora.zenplex.org
In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
-- Jacques Ellul, The Technological Society