commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [configuration] Interpolation of variables in configuration definition files
Date Sat, 03 Jun 2006 15:01:06 GMT
Oliver Heger wrote:
> Hi Gabriele,
> 
> gabriele.garuglieri@infoblu.it wrote:
>> Hi all,
>> i'm playing with commons-configuration HEAD, extracted from svn rep 
>> and locally built.
>> Suppose i have i configuration definition file like this, that i pass 
>> to DefaultConfigurationBuilder , where 
>> ${this.app.external.override.properties.file} is defined as a System 
>> property.
>> <configuration>
>>   <system config-name="system" />
>>   <properties config-name="extOverride" fileName=
>> "${this.app.external.override.properties.file}" />
>>   <properties config-name="intClasspath" fileName=
>> "conf/internal.properties"/>
>> </configuration>
>>
>> Given that the configuration file is treated as an XMLConfiguration 
>> this appears to be a legitimate construct.
>> The problem is that when the subnode configuration for "extOverride" 
>> is built the property that defines the filename value is interpolated 
>> against the subnode configuration itself which obviously is still 
>> empty, it's a sort of a cat chasing its tail.
>>
>> In my opinion while building a CombinedConfiguration the interpolation 
>> for the subnodes should be done against the parent  config, the 
>> CombinedConfiguration itself.
>> This would allow to define variables in the configuration file that 
>> could be solved against the previous nodes.
>>
>> Am i doing something wrong? Or is there a way to force the described 
>> behaviour?
>>
>> In the meanwhile, my thanks and compliments for the best and most 
>> complete configuration package i've ever seen!
>>
>> Gabriele
>>
> 
> 
> yes, it should work as you expect. I will have a look at the code and 
> see if something is wrong. Will report back when I find something. Thank 
> you for spotting this.
> 
> Oliver
> 
Your analysis was correct. I will think about a fix. It would seem 
logical to me that a SubnodeConfiguration would always call its parent 
instance for doing the interpolation because interpolation variables are 
expressed in global context.

I wanted to do some changes at SubnodeConfiguration and 
XMLBeanDeclaration anyway to make these classes easier to use.

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message