Package org.apache.commons.configuration.reloading

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


         }
         catch (org.apache.commons.configuration.ConfigurationException e)
         {
            throw new ConfigurationException(e);
         }
         globalXml.setReloadingStrategy(new FileChangedReloadingStrategy());
         globalXml.setAutoSave(true);

         ConfigurationAdapter adapter = BeanManagerUtils.getContextualInstance(bm, ConfigurationAdapter.class,
                  new ConfigAdapterQualifierLiteral());
         adapter.setDelegate(globalXml);
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

        for (int i=0; i<CONFIG_FILES.length; i++) {
          File f = null;
          try {
            f = new File("conf"+File.separator+CONFIG_FILES[i]);
            final PropertiesConfiguration pc = new PropertiesConfiguration(f);
            pc.setReloadingStrategy(new FileChangedReloadingStrategy());
            config.addConfiguration(pc);
            log.info("Added file to configuration source: "+f.getAbsolutePath());
          } catch (ConfigurationException e) {
            log.error("Failed to load configuration from file " + f.getAbsolutePath());
          }
        }
        // Override with file in "/etc/ejbca/conf/, this is prio 3
        for (int i=0; i<CONFIG_FILES.length; i++) {
          File f = null;
          try {
            f = new File("/etc/ejbca/conf/" + CONFIG_FILES[i]);
            final PropertiesConfiguration pc = new PropertiesConfiguration(f);
            pc.setReloadingStrategy(new FileChangedReloadingStrategy());
            config.addConfiguration(pc);
            log.info("Added file to configuration source: "+f.getAbsolutePath());             
          } catch (ConfigurationException e) {
            log.error("Failed to load configuration from file " + f.getAbsolutePath());
          }
View Full Code Here

    instance();
    File f = null;
    try {
      f = new File(filename);
      final PropertiesConfiguration pc = new PropertiesConfiguration(f);
      pc.setReloadingStrategy(new FileChangedReloadingStrategy());
      config.addConfiguration(pc);
      log.info("Added file to configuration source: "+f.getAbsolutePath());             
    } catch (ConfigurationException e) {
      log.error("Failed to load configuration from file " + f.getAbsolutePath());
    }
View Full Code Here

              log.info("Added system properties to configuration source (java -Dfoo.prop=bar).");
             
              // Override with file in "application server home directory"/conf, this is prio 2
              File f1 = new File("conf/" + PROPERTY_FILENAME);
              pc = new PropertiesConfiguration(f1);
              pc.setReloadingStrategy(new FileChangedReloadingStrategy());
              config.addConfiguration(pc);
              log.info("Added file to configuration source: "+f1.getAbsolutePath());
             
              // Override with file in "/etc/ejbca/conf/extra, this is prio 3
              File f2 = new File("/etc/ejbca/conf/extra/" + PROPERTY_FILENAME);
              pc = new PropertiesConfiguration(f2);
              pc.setReloadingStrategy(new FileChangedReloadingStrategy());
              config.addConfiguration(pc);
              log.info("Added file to configuration source: "+f2.getAbsolutePath());             
            }
           
            // Default values build into war file, this is last prio used if no of the other sources override this
View Full Code Here

          config.addConfiguration(new SystemConfiguration());
          log.info("Added system properties to configuration source (java -Dfoo.prop=bar).");
          // Override with file in "application server home directory"/conf, this is prio 2
          File f1 = new File("conf/" + PROPERTIES_FILENAME);
          pc = new PropertiesConfiguration(f1);
          pc.setReloadingStrategy(new FileChangedReloadingStrategy());
          config.addConfiguration(pc);
          log.info("Added file to configuration source: "+f1.getAbsolutePath());
          // Override with file in "/etc/ejbca/conf/extra, this is prio 3
          File f2 = new File("/etc/ejbca/conf/extra/" + PROPERTIES_FILENAME);
          pc = new PropertiesConfiguration(f2);
          pc.setReloadingStrategy(new FileChangedReloadingStrategy());
          config.addConfiguration(pc);
          log.info("Added file to configuration source: "+f2.getAbsolutePath());             
        }
        // Default values build into war file, this is last prio used if no of the other sources override this
        URL url = ExternalRaGuiConfiguration.class.getResource("/" + PROPERTIES_FILENAME);
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

    }
    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

       
        configurationRefreshDelay = NumberUtils.toLong(getServletConfig().getInitParameter("reverseproxy.configuration.refresh.delay"), 0L);
       
        if (configurationRefreshDelay > 0L)
        {
            configReloadingStrategy = new FileChangedReloadingStrategy()
            {
                @Override
                public void reloadingPerformed()
                {
                    super.reloadingPerformed();
View Full Code Here

    this.hostAndPort = hostAndPort;
    try {
      this.metricsPropertyFileName = tajoConf.getVar(TajoConf.ConfVars.METRICS_PROPERTY_FILENAME);
      this.metricsProps = new PropertiesConfiguration(metricsPropertyFileName);
      this.metricsProps.addConfigurationListener(new MetricsReloadListener());
      FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy();
      reloadingStrategy.setRefreshDelay(5 * 1000);
      this.metricsProps.setReloadingStrategy(reloadingStrategy);
    } catch (ConfigurationException e) {
      LOG.warn(e.getMessage(), e);
    }

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.