You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by st...@wachovia.com on 2007/03/22 18:10:15 UTC

CompositeConfiguration and file reloading

I'm wondering if this is a known issue or if it's something that might be
addressed in the near future.
 
I have set up 2 AbstractFileConfigurations, one of them with a
FileChangedReloadingStrategy with a refreshDelay of whatever.  The other
one uses properties from the first one.
 
Example:
    file1:    first.name=John
    file2:    full.name=${first.name} Doe
 
I then add both configurations to a CompositeConfiguration.  If I get the
full.name property from the CompositeConfiguration I get "John Doe".
 
I then make a change to the configuration that has a reload strategy
setting first.name=Jane. I get the first.name from the
CompositeConfiguration and I get "Jane", but if I get the full.name
property, I still get "John Doe".
 
The only way I can get the full.name to switch to "Jane Doe" is if I set
up file2 with a reload strategy and save it with a different timestamp,
then it picks up the change from the first file.  I would think that the
composite configuration should handle the property replacement and I would
only need to change the first file.
 
Am I missing something to make sure that happens, or is this a known
issue?
 
 
Thanks.

Re: CompositeConfiguration and file reloading

Posted by Oliver Heger <ol...@oliver-heger.de>.
steve.birnie@wachovia.com wrote:
> I'm wondering if this is a known issue or if it's something that might be
> addressed in the near future.
>  
> I have set up 2 AbstractFileConfigurations, one of them with a
> FileChangedReloadingStrategy with a refreshDelay of whatever.  The other
> one uses properties from the first one.
>  
> Example:
>     file1:    first.name=John
>     file2:    full.name=${first.name} Doe
>  
> I then add both configurations to a CompositeConfiguration.  If I get the
> full.name property from the CompositeConfiguration I get "John Doe".
>  
> I then make a change to the configuration that has a reload strategy
> setting first.name=Jane. I get the first.name from the
> CompositeConfiguration and I get "Jane", but if I get the full.name
> property, I still get "John Doe".
>  
> The only way I can get the full.name to switch to "Jane Doe" is if I set
> up file2 with a reload strategy and save it with a different timestamp,
> then it picks up the change from the first file.  I would think that the
> composite configuration should handle the property replacement and I would
> only need to change the first file.
>  
> Am I missing something to make sure that happens, or is this a known
> issue?
>  
>  
> Thanks.
> 

I have written a unit test to reproduce the scenario you describe. 
However this test does not fail, i.e. the correct full name is returned. 
Can you provide some code how you setup the involved configurations and 
how you access the properties?

Thanks
Oliver

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