Package org.apache.commons.configuration.reloading

Examples of org.apache.commons.configuration.reloading.FileChangedReloadingStrategy


     */
    @Test
    public void testReentrantReload()
    {
        conf.setProperty("shouldReload", Boolean.FALSE);
        conf.setReloadingStrategy(new FileChangedReloadingStrategy()
        {
            @Override
            public boolean reloadingRequired()
            {
                return configuration.getBoolean("shouldReload");
View Full Code Here


          log.debug("Loading config file: " + mFile.getAbsolutePath());
        try {
          xConfig = new XMLConfiguration(mFile);
          xConfig.append(getEnvironmentConfiguration());
          xConfig.addConfigurationListener(new MetricsConfigListener());
          xConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
         
          // Start a background Thread that checks a property from the XMLConfiguration
          // every so often to force the FileChangedReloadingStrategy to fire.
          if (null == watcher || !watcher.isAlive()) {
            watcher = new MetricsConfigWatcher();
View Full Code Here

   
    try {
      //module这个文件会自动在下面几个地方被搜寻:当前目录 、用户主目录 、classpath
      PropertiesConfiguration conf = new PropertiesConfiguration(module);
      //当配置文件的内容发生改变了的时候,Commons Configuration能自 动重新读取配置文件的内容。
      conf.setReloadingStrategy(new FileChangedReloadingStrategy());
     
      @SuppressWarnings("unchecked")
      List<String> keys=IteratorUtils.toList(conf.getKeys());
      for (String key : keys)
      {
View Full Code Here

        try {
            config = new XMLConfiguration(configFile);
        } catch (ConfigurationException e) {
            throw e;
        }
        config.setReloadingStrategy(new FileChangedReloadingStrategy());
        config.setAutoSave(true);
        logger.info("Configuration loaded: " + configFile);
    }
View Full Code Here

    }
    URL url = Loader.getResource(JUDDI_PROPERTIES);
    log.info("Reading from properties file:  " + url);
    long refreshDelay = propConfig.getLong(Property.JUDDI_CONFIGURATION_RELOAD_DELAY, 1000l);
    log.debug("Setting refreshDelay to " + refreshDelay);
    FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
    fileChangedReloadingStrategy.setRefreshDelay(refreshDelay);
    propConfig.setReloadingStrategy(fileChangedReloadingStrategy);
    compositeConfig.addConfiguration(propConfig);
   
    // Properties from the persistence layer (must first initialize the entityManagerFactory).
    PersistenceManager.initializeEntityManagerFactory(propConfig.getString(Property.JUDDI_PERSISTENCEUNIT_NAME));
View Full Code Here

                propConfig.setAutoSave(true);
   
    log.info("Reading from properties file:  " + loadedFrom);
    long refreshDelay = propConfig.getLong(Property.JUDDI_CONFIGURATION_RELOAD_DELAY, 1000l);
    log.debug("Setting refreshDelay to " + refreshDelay);
    FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
    fileChangedReloadingStrategy.setRefreshDelay(refreshDelay);
    propConfig.setReloadingStrategy(fileChangedReloadingStrategy);
    compositeConfig.addConfiguration(propConfig);
   
   
    Properties properties = new Properties();
View Full Code Here

    }
    URL url = ClassUtil.getResource(JUDDI_PROPERTIES, this.getClass());
    log.info("Reading from properties file:  " + url);
    long refreshDelay = propConfig.getLong(Property.JUDDI_CONFIGURATION_RELOAD_DELAY, 1000l);
    log.debug("Setting refreshDelay to " + refreshDelay);
    FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
    fileChangedReloadingStrategy.setRefreshDelay(refreshDelay);
    propConfig.setReloadingStrategy(fileChangedReloadingStrategy);
    compositeConfig.addConfiguration(propConfig);
   
   
    Properties properties = new Properties();
View Full Code Here

    }
    log.info("Reading UDDI Client properties file " + xmlConfig.getBasePath());
    this.configurationFile = xmlConfig.getBasePath();
    long refreshDelay = xmlConfig.getLong(Property.UDDI_RELOAD_DELAY, 1000l);
    log.debug("Setting refreshDelay to " + refreshDelay);
    FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
    fileChangedReloadingStrategy.setRefreshDelay(refreshDelay);
    xmlConfig.setReloadingStrategy(fileChangedReloadingStrategy);
    compositeConfig.addConfiguration(xmlConfig);
    //Making the new configuration globally accessible.
    config = compositeConfig;
    readConfig(properties);
View Full Code Here

            forgeXml = new XMLConfiguration(getProjectSettings(project).getUnderlyingResourceObject());
         }
         catch (org.apache.commons.configuration.ConfigurationException e) {
            throw new ConfigurationException(e);
         }
         forgeXml.setReloadingStrategy(new FileChangedReloadingStrategy());
         forgeXml.setAutoSave(true);
         projectConfig.setScopedConfiguration(ConfigurationScope.PROJECT,
                  new ConfigurationAdapter(projectConfig, forgeXml));
         projectConfig.setScopedConfiguration(ConfigurationScope.USER, getUserConfig(projectConfig));
         return projectConfig;
View Full Code Here

                     .getUnderlyingResourceObject());
         }
         catch (org.apache.commons.configuration.ConfigurationException e) {
            throw new ConfigurationException(e);
         }
         globalXml.setReloadingStrategy(new FileChangedReloadingStrategy());
         globalXml.setAutoSave(true);
         userConfig = new ConfigurationAdapter(config, globalXml);
      }
      return userConfig;
   }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.reloading.FileChangedReloadingStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.