Eric Pugh wrote:

Are we sure we want to do the deprecated?  Seems odd to have 1.0 have a
deprecated method..  It may make more sense to just add another howto:  How
to save your properties set in CompositeConfiguration?  Basically should be
able to just grab out the inmemory and save it by hand...

That seems quite complicated, using a CompositeConfiguration we would have (I'm not familiar with this class so let me know if my use case is wrong) :


// loading
Configuration default = new PropertiesConfiguration("default.properties");

Configuration config = new PropertiesConfiguration("myapp.properties");

CompositeConfiguration cc = new CompositeConfiguration();
cc.addConfiguration(default);
cc.addConfiguration(config);

// using/modifying
cc.addProperty("foo", "bar");

// saving (assuming the previous reference is not available here)
PropertiesConfiguration pc = (PropertiesConfiguration) cc.getConfiguration(1);
Configuration inmemory = cc.getConfiguration(0);
Iterator it = inmemory.getKeys();
while (it.hasNext()) {
String key = (String) it.next();
pc.addProperty(key, inmemory.getProperty(key));
}
pc.save();



using an unmodified PropertiesConfiguration this would be reduced to :


// loading
Configuration default = new PropertiesConfiguration("default.properties");

PropertiesConfiguration config = new PropertiesConfiguration("myapp.properties", default);

// using
config.addProperty("foo", "bar");

// saving
config.save();


Emmanuel







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to