Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 22412 invoked from network); 16 Feb 2004 16:23:48 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 16 Feb 2004 16:23:48 -0000 Received: (qmail 72567 invoked by uid 500); 16 Feb 2004 16:23:39 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 72544 invoked by uid 500); 16 Feb 2004 16:23:39 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 72526 invoked from network); 16 Feb 2004 16:23:38 -0000 Received: from unknown (HELO vertigo-back.micropole.com) (213.41.126.253) by daedalus.apache.org with SMTP; 16 Feb 2004 16:23:38 -0000 Received: by vertigo-back.micropole.com; id RAA26986; Mon, 16 Feb 2004 17:22:00 +0100 (CET) Message-Id: <200402161622.RAA26986@vertigo-back.micropole.com> Date: Mon, 16 Feb 2004 17:23:30 +0100 From: Emmanuel Bourg Organization: Micropole Univers User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: fr, en, en-us MIME-Version: 1.0 To: Jakarta Commons Developers List Subject: Re: [configuration] Refactor AbstractConfiguration(Configuration defaults) References: <006601c3f4a5$e6b68b90$657ba8c0@IQUITOS> In-Reply-To: <006601c3f4a5$e6b68b90$657ba8c0@IQUITOS> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org