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


            out.close();
            out = null;

            PropertiesConfiguration config = new PropertiesConfiguration(
                    configFile);
            config.setReloadingStrategy(new FileChangedReloadingStrategy());
            config.setAutoSave(true);

            assertEquals("one", config.getProperty("a"));
            config.setProperty("b", "two");
            assertEquals("one", config.getProperty("a"));
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

    compositeConfig.addConfiguration(new SystemConfiguration());
    //Properties from file
    PropertiesConfiguration propConfig = new PropertiesConfiguration(JUDDI_PROPERTIES);
    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

       
        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

    PropertiesConfiguration propConfig = new PropertiesConfiguration(JUDDI_PROPERTIES);
    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

      XMLConfiguration globalXml;
      try
      {
         globalXml = new XMLConfiguration(config);
         globalXml.setEncoding("UTF-8");
         globalXml.setReloadingStrategy(new FileChangedReloadingStrategy());
         globalXml.setAutoSave(true);

         return new ConfigurationAdapter(globalXml);
      }
      catch (org.apache.commons.configuration.ConfigurationException e)
View Full Code Here

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

            ConfigurationAdapter adapter = BeanManagerUtils.getContextualInstance(bm, ConfigurationAdapter.class, new ConfigAdapterQualifierLiteral());
            adapter.setParent(projectConfig);
            adapter.setDelegate(projectLocalConfig);
View Full Code Here

            }
            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);
            adapter.setBeanManager(bm);
View Full Code Here

      XMLConfiguration commonsConfig;
      try
      {
         commonsConfig = new XMLConfiguration(file);
         commonsConfig.setEncoding("UTF-8");
         commonsConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
         commonsConfig.setAutoSave(true);

         return new ConfigurationAdapter(commonsConfig);
      }
      catch (org.apache.commons.configuration.ConfigurationException 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.