You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by gr...@kodak.com on 2004/10/04 23:01:31 UTC
[Configuration] [Betwixt] Using both the configuration and bitwixt
projects
All,
I'm using the Commons-Configuration Project in order to manage multiple
xml configuration files, using the CompositeConfiguration and
HierarchicalConfiguration classes:
ConfigurationFactory factory = new ConfigurationFactory();
URL configURL = getClass().getResource("/config.xml");
factory.setConfigurationURL(configURL);
CompositeConfiguration compositeConfiguration =
(CompositeConfiguration)
factory.getConfiguration();
HierarchicalConfiguration config = (HierarchicalConfiguration)
compositeConfiguration.getConfiguration(0);
My application will use the HierarchicalConfiguration Api to access some of the contents of the configuration files. But I
also want to map some of the content of the configuration files to
JavaBean Objects using the Betwixt Project, in particular using the
BeanReader class.
When I use the BeanReader.parse API method I have to pass it a String or
InputSource, InputStream... Assuming that I already have a HierarchicalConfiguration object, what should I do to be able to call the BeanReader.parse API
method?
Thanks for your help,
Greg.
Re: [Configuration] [Betwixt] Using both the configuration and bitwixt
projects
Posted by Emmanuel Bourg <sm...@lfjr.net>.
Hi, you can't build an InputSource for betwix from a
HierarchicalConfiguration in its current state. You could do it with an
XMLConfiguration by using the toString() method though.
Emmanuel Bourg
greg.gray@kodak.com wrote:
> All,
>
> I'm using the Commons-Configuration Project in order to manage multiple
> xml configuration files, using the CompositeConfiguration and
> HierarchicalConfiguration classes:
>
> ConfigurationFactory factory = new ConfigurationFactory();
> URL configURL = getClass().getResource("/config.xml");
> factory.setConfigurationURL(configURL);
>
> CompositeConfiguration compositeConfiguration =
> (CompositeConfiguration)
> factory.getConfiguration();
>
> HierarchicalConfiguration config = (HierarchicalConfiguration)
> compositeConfiguration.getConfiguration(0);
>
> My application will use the HierarchicalConfiguration Api to access some of the contents of the configuration files. But I
> also want to map some of the content of the configuration files to
> JavaBean Objects using the Betwixt Project, in particular using the
> BeanReader class.
>
> When I use the BeanReader.parse API method I have to pass it a String or
> InputSource, InputStream... Assuming that I already have a HierarchicalConfiguration object, what should I do to be able to call the BeanReader.parse API
> method?
>
>
> Thanks for your help,
> Greg.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org