commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [Configuration] Is there any way to save my complex bean in XML resource and use it later ?
Date Wed, 16 Feb 2011 20:23:22 GMT
Am 16.02.2011 11:50, schrieb Moein Enayati:
> Dear Jörg
>
> You're ok!
>
> But have a look at this part of code :
>
>   *BeanDeclaration bDecl = new XMLBeanDeclaration(xmlConfig,
> "myBeanNameRootAddress");*
>
> *MyBean  myBean = (MyBean ) BeanHelper.createBean(bDecl);*
>
>
> Here we have the ability to load a predefined bean out of an XML file. So I
> thought it must be a simple way to save that bean into the same file !
>
>
> You know , I’m worry about using another library to save myBean into the
> file and I can’t load its XMLDeclaration later on.
>
>
>
> Am I right?
>
>
This support for loading beans in Commons Configuration is more like in 
the Spring framework (but in a very limited form). There you also define 
beans in configuration files which you can load at runtime, but you do 
not have the possibility to store beans and update your configuration files.

As Jörg pointed out, you are really after a XML bean mapper. Commons 
Configuration does not support this use case, at least not in a 
convenient way.

Sorry
Oliver

>
>
> On Wed, Feb 16, 2011 at 2:02 PM, Jörg Schaible
> <joerg.schaible@scalaris.com>wrote:
>
>> Hi Moein,
>> *
>> Moein Enayati wrote:
>> ..........*
>>
>> This is definitely out of scope for commons configuration. What you're
>> looking for is a persistence layer that can turn a Java object into XML and
>> restore it later. This is a classical task for JAXB or something like
>> XStream.
>>
>> - Jörg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message