You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/08/24 16:47:11 UTC

DO NOT REPLY [Bug 34350] - [configuration] Declaring reloadable configurations in the configuration descriptor

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34350>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34350





------- Additional Comments From herve.gerard@macif.fr  2005-08-24 16:47 -------
As I am using the ConfigurationFactory, I am interresting with your idea. here
is what I have done for resolving this problem : 
=> The xml has this form
<?xml version="1.0" encoding="ISO-8859-1" ?>
<configuration>
  <properties fileName="config.properties"
reloading-strategy="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
  <properties fileName="defaultConfig.properties"/>
</configuration>
As you can see, there is no value for the refresh delay
=> I download the latest version of the ConfigurationFactory class from the SVN
site (with all his dependencies...) and I change the
PropertiesConfigurationFactory class with this code : 
protected FileConfiguration createConfiguration(Attributes attributes) throws
Exception
        {
            String filename = attributes.getValue(ATTR_FILENAME);
            
//          BEGIN HGerard - MACIF
            AbstractFileConfiguration tmpConf;

            if (filename != null && filename.toLowerCase().trim().endsWith(".xml"))
            {
                tmpConf = new XMLPropertiesConfiguration();
            }
            else
            {
                tmpConf = new PropertiesConfiguration();
            }
            String reloadStrat = attributes.getValue(ATTR_RELOADING_STRATEGY);
            try {
                if (reloadStrat != null) {
                    tmpConf.setFileName(filename);
                    tmpConf.setReloadingStrategy((ReloadingStrategy)
Class.forName(reloadStrat).newInstance());
                }
            }
            catch (InstantiationException eI) {
                // no reloading strategy for this time
                log.error(eI);
            }
            catch (IllegalAccessException eI) {
//              no reloading strategy for this time
                log.error(eI);
            }
       
            return tmpConf;
//          END HGerard - MACIF
        }

the ATTR_RELOADING_STRATEGY has been declared as : 
/** Constant for the reloading strategy attribute.*/
    private static final String ATTR_RELOADING_STRATEGY = "reloading-strategy";

Hope it helps.

Herve

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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