[ 
https://issues.apache.org/jira/browse/CONFIGURATION-467?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oliver Heger updated CONFIGURATION-467:
---------------------------------------
    Fix Version/s:     (was: 2.0)
                   2.x

> Unable to persist CombinedConfiguration changes to the Filesystem.
> ------------------------------------------------------------------
>
>                 Key: CONFIGURATION-467
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-467
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: File reloading
>    Affects Versions: 1.6
>         Environment: Linux java
>            Reporter: raghutpk
>             Fix For: 2.x
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> I use a config.xml file to load multiple Configuration Sources 
> Ex: 
> {code:xml}
> <configuration>
>   <header/>
>   <override>
>     <properties fileName="db.properties"/>
>     <properties fileName="jms.properties"/>
>     <xml fileName="gui.xml"/>
>   </override>
>   <additional/>
> </configuration>
> {code}
> I load the config.xml and subsequently all the properties in my app to a 
> CombinedConfiguration Object as follows :
> {code:java}
> DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
> builder.setFile(new File("config.xml"));
> CombinedConfiguration combinedConfig = builder.getConfiguration(true);
> {code}
> Now I am trying to expose all the properties from all configuration sources 
> using a mbean and at runtime trying to update the Properties. I wouldn't know 
> though, from which source the properties came from as the 
> CombinedConfiguration takes care of that abstraction, but when I do the 
> following it doesn't change the persistance store(in this case the files on 
> the Filesystem).
> /*combinedConfig.setProperty(Key, updatedValue);*/
> There is no save method on the combinedConfiguration class so that the 
> persistance store gets updated.
> There is a save method in PropertiesConfiguration class or XMLConfiguration 
> class, but I wouldn't know at runtime or inside the code which file or 
> configuration source the Key belongs to, so even If I add a config-name to 
> each source there is no use. 
> SO wouldn't the setProperty help me update the value of the Configuration and 
> persist it back to the original file. I don't know it is a bug or a feature 
> it doesn't support or there is a workaround in such scenarios. 
> Please advice.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to