commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Hufgard" <christian.hufg...@gmx.de>
Subject [Configuration] PropertiesConfiguration ReloadStrategy not working as expected
Date Fri, 20 May 2005 06:50:36 GMT
Hi everyone!

Since yesterday I am a user of Configuration (1.1) - waited a long time for
the release to replace the stuff I wrote for myself. I tried to replace my
own properties handler with the one provided by Configuration.
To to this, I created a PropertiesConfiguration the following way:

PropertiesConfiguration propsConfig = 
   new PropertiesConfiguration(propertiesFileName);
reloading = new FileChangedReloadingStrategy();
					
propsConfig.setReloadingStrategy(reloading);

propertiesFileName is the name of a properties-file that can be found in the
shared/classes directory of my tomcat. Loading the properties from there
worked fine. But the reloading did not work.
So I took a look into the code and found out, that the
FileChangedReloadingStrategy does not observe the right file. It was looking
just for the filename without any basepath.

When I instantiate the ReloadingStrategy with a complete path it works the
way it should. Is this behaviour intended?



Also I would like to diskuss some features, which I am misssing.

First is the possibility to inform classes about a change at the properties,
which I need for at leat one class, that has some cron-like job. I wrote a
subclass of FileChangedReloadingStrategy that informs Listeners about
changes at the properties. Would something like this be usefull for someone
else?
Think a periodically checking of the properties the way log4j does it, would
also be nice to retrieve information independent to a user interacting with
the system.

Is this planned for Version 1.3? Task: observable configurations?


The other is the possibility to use the ConfigurationFactory in combination
with a ReloadingStrategy. I want to read the configuration details from a
xml file with

ConfigurationFactory factory = new ConfigurationFactory("config.xml");
Configuration config = factory.getConfiguration();

to have a flexibel way to change it, but do not want to loose the chance to
get informed if the config changes. Is a feature like this planned for
future releases?

Greets

Christian

-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++

---------------------------------------------------------------------
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