You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Mike Ferraro <mi...@harvard.edu> on 2006/03/10 21:13:17 UTC

[Configuration] cloning FileConfigurations?

The HierarchicalConfiguration class contains a clone() method, to allow
decoupling of a configuration from the underlying file to prevent ill
effects during configuration updates.  So, for example, I can clone an
XMLConfiguration for a user's session in a web app and update the
configuration file underneath so that the updates will be active for the
next user and the current user will not experience some undesirable
effect due to the change.

My question is why this concept does not exist at a higher level?  It
would seem that any class that implements the FileConfiguration
interface (and therefore the ReloadingStategy concept), should implement
a method that allows the configuration to be temporarily decoupled from
the source.  Are there any plans for cloning to be enforced at a
FileConfiguration level?

>From a completely selfish standpoint, I have a CompositeConfiguration
object that contains several PropertiesConfigurations and
XMLConfigurations with different reloading strategies.  I'd like to
clone this for each user session for the above mentioned reason.
Ideally, the CompositeConfiguration would be clonable (cloning each of
the encapsulated configurations), but barring that, it would be nice to
be able to loop through the contained configurations and perform a
FileConfiguration.clone() on each object.  Or maybe there's another way
to do this that I'm not seeing?

TIA,
Mike


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


Re: [Configuration] cloning FileConfigurations?

Posted by Mike Ferraro <mi...@harvard.edu>.
> Mike,
>
> a consistent implementation of clone() methods would IMO make sense
for
> most of the Configuration implementations. Would you be so kind to
open
> an enhancement ticket for this in bugzilla, so this idea won't get
lost
> (see
> http://jakarta.apache.org/commons/configuration/issue-tracking.html)?
> Thanks.
>
> What may help you ATM are some utility methods in ConfigurationUtils
for
> copying configurations. You might have a look at this class and maybe
> you can use some of the stuff to solve your problem.
>
> Oliver

Done.  See bug #38953.  And thanks for the reply.  I missed the utils
class.  That should be helpful.

Mike


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


Re: [Configuration] cloning FileConfigurations?

Posted by Oliver Heger <ol...@t-online.de>.
Mike Ferraro wrote:

>The HierarchicalConfiguration class contains a clone() method, to allow
>decoupling of a configuration from the underlying file to prevent ill
>effects during configuration updates.  So, for example, I can clone an
>XMLConfiguration for a user's session in a web app and update the
>configuration file underneath so that the updates will be active for the
>next user and the current user will not experience some undesirable
>effect due to the change.
>
>My question is why this concept does not exist at a higher level?  It
>would seem that any class that implements the FileConfiguration
>interface (and therefore the ReloadingStategy concept), should implement
>a method that allows the configuration to be temporarily decoupled from
>the source.  Are there any plans for cloning to be enforced at a
>FileConfiguration level?
>
>>>From a completely selfish standpoint, I have a CompositeConfiguration
>object that contains several PropertiesConfigurations and
>XMLConfigurations with different reloading strategies.  I'd like to
>clone this for each user session for the above mentioned reason.
>Ideally, the CompositeConfiguration would be clonable (cloning each of
>the encapsulated configurations), but barring that, it would be nice to
>be able to loop through the contained configurations and perform a
>FileConfiguration.clone() on each object.  Or maybe there's another way
>to do this that I'm not seeing?
>
>TIA,
>Mike
>
>
>  
>
Mike,

a consistent implementation of clone() methods would IMO make sense for
most of the Configuration implementations. Would you be so kind to open
an enhancement ticket for this in bugzilla, so this idea won't get lost
(see
http://jakarta.apache.org/commons/configuration/issue-tracking.html)?
Thanks.

What may help you ATM are some utility methods in ConfigurationUtils for
copying configurations. You might have a look at this class and maybe
you can use some of the stuff to solve your problem.

Oliver

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