Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 9571 invoked from network); 6 Mar 2009 20:59:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Mar 2009 20:59:50 -0000 Received: (qmail 81318 invoked by uid 500); 6 Mar 2009 20:59:47 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 81242 invoked by uid 500); 6 Mar 2009 20:59:47 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 81231 invoked by uid 99); 6 Mar 2009 20:59:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 12:59:47 -0800 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jak-commons-dev@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 20:59:38 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Lfh8W-0007id-AZ for dev@commons.apache.org; Fri, 06 Mar 2009 20:59:16 +0000 Received: from hsi-kbw-078-042-174-106.hsi3.kabel-badenwuerttemberg.de ([78.42.174.106]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Mar 2009 20:59:16 +0000 Received: from joerg.schaible by hsi-kbw-078-042-174-106.hsi3.kabel-badenwuerttemberg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Mar 2009 20:59:16 +0000 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: dev@commons.apache.org To: dev@commons.apache.org From: =?ISO-8859-1?Q?J=F6rg?= Schaible Subject: [configuration] Local lookup fix & enhancement Date: Fri, 06 Mar 2009 21:59:08 +0100 Lines: 58 Message-ID: Reply-To: joerg.schaible@gmx.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: hsi-kbw-078-042-174-106.hsi3.kabel-badenwuerttemberg.de Mail-Copies-To: never User-Agent: KNode/0.10.9 Sender: news X-Virus-Checked: Checked by ClamAV on apache.org Hi folks, it has been a while since I committed last time something to configuration. It has been improved a lot since then and one of the newer features are the user defined StrLookup support. However, nothing is perfect and I'd like to work somewhat on it. My proposed 1/ While it is quite easy to register a global StrLookup, it is not so easy to work with the local ones. Especially since those are no longer available for a SubsetConfiguration: moduleA.value=${my:foo} assertEquals("bar", config.getString("moduleA.value")); assertEquals("bar", config.subset("moduleA").getString("value")); The second assert fails. I've prepared patches to support this scenario. 2/ In my use case I have a big "unified" configuration, actually based on a CompositeConfiguration with an overloaded createInterpolator method. The configuration itself combines system properties, an individual configuration for a module and a default configuration file. Each module will use then its own subset (so it can be used or tested individually), but the scenario allows me to override every configuration value from command line or use a default value in the standard file. However, sometimes the individual modules share some settings and therefore I invented auto-lookups based on a local StrLookup. These auto-lookup are defined automatically using the keys in the configuration itself, i.e. auto.lookup.ldap.host=localhost auto.lookup.ldap.port=636 auto.lookup.ldap.base=dc=apache,dc=org auto.lookup.wsdl.serviceA=http://localhost:4711/serviceA auto.lookup.wsdl.serviceB=http://localhost:4711/serviceB moduleA.serviceA=${wsdl:serviceA} moduleA.ldap.url=ldap://${ldap:host}:${ldap:port}/${ldap:base} moduleB.serviceB=${wsdl:serviceB} moduleB.ldap.url=ldap://${ldap:host}:${ldap:port}/${ldap:base} moduleC.serviceA=${wsdl:serviceA} moduleC.serviceB=${wsdl:serviceB} Explanation: - "auto.lookup" defines the root node for the automatically registered local lookups (the name of this root can be set individually for a configuration) - the next node defines the namespace of the lookup - all nodes below "auto.lookup.XXX" are part of the local lookup - even for subsets of the individual modules these local auto-lookups work: config.subset("moduleA").getString("serviceA") As said I've implemented this currently in a derived class of CompositeConfiguration, but it might be added to AbstractConfiguration. The name of the auto-lookup root is provided as ctor param. The local StrLookup itself is again based on a Configuration (actually a subset of the name giving node). WDYT? - J�rg --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org