You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jamie Guillemette <JM...@hotmail.com> on 2005/04/07 19:01:51 UTC

[Configuration] Save(), found bugs / preposed changes and new features

[Configuration] CompositeConfiguration - setting FileChangedReloadingStrategy on each XMLConfigurationHey everyone,

I downloaded the commons configuration project a few days ago in hopes of using it to create a generic configuration interface. 

In order to achieve this, I need an api that can a) read configuration information from multiple datasources b) save changes back to the original datasources. (which sounds exaclty what the configuration project is all about)

In experimenting with the api I've come across serval serveral inconsitencies with the save() feature... (ive had no problem with simply reading values)

a) if your project is devided into src / bin and the root of the running path is neither of these.. save a properties file will result in a new file being created in the root or the current running path.. not overiding the existing file.

b) if you use URL to load your configuration ie 
    URL url2 = this.getClass().getResource("/sample.properties");
      config.addConfiguration(new PropertiesConfiguration(url2));
when saving...two things happen. 1) the file is not saved. 2) the in memmory representation of the values all become null. (where previous to the save you could retreive the values without issue)

Its seems like there is a major bug in the save() logic ... worst yet.. whatever problem that is being encountered is not throwing a configuration exception.
If everyone agrees.. i would like to take a serious look at the existing save logic for each configuration type add the following:

i) make any adjustments necessary to guarrentee that where the configuration data is read from is where it is saved to reguardless of project layout.
ii) add save() to CompositeConfiguration that will delegate down to all configurations under its control.

Let me know your thoughts guys.
J.