List of usage examples for org.apache.commons.configuration.reloading FileChangedReloadingStrategy FileChangedReloadingStrategy
FileChangedReloadingStrategy
From source file:org.wso2.carbon.device.mgt.iot.agent.kura.display.config.ConfigManager.java
private HierarchicalConfiguration loadConfigFile(File configXmlFileName) throws ConfigurationException { XMLConfiguration config = null;//from w w w. j a v a 2 s . com config = new XMLConfiguration(configXmlFileName); FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy(); strategy.setRefreshDelay(config.getInt(ConfigConstants.CONFIG_REFRESH_DELAY, 5000)); config.setReloadingStrategy(strategy); return config; }
From source file:pt.spms.epsos.main.MigrateProperties.java
/** * This method will process the properties and insert them in the database, * based on the specified properties file name. * * @param epsosPropsFile the properties file name. * @throws ConfigurationException if the properties file reading wen wrong. *///from w ww. ja v a2 s. c o m private static void processProperties(final String epsosPropsFile) throws ConfigurationException, FileNotFoundException, IOException { LOGGER.info("READING CONFIGURATION FILE FROM: " + epsosPropsFile); File propsFile = new File(epsosPropsFile); processCommaProperties(propsFile, epsosPropsFile); propsFile = new File(epsosPropsFile); final PropertiesConfiguration config = new PropertiesConfiguration(); config.setReloadingStrategy(new FileChangedReloadingStrategy()); final Session session = HibernateUtil.getSessionFactory().openSession(); LOGGER.info("INSERTING PROPERTIES INTO DATABASE..."); session.beginTransaction(); final Iterator it = config.getKeys(); while (it.hasNext()) { final String key = (String) it.next(); final String value = (String) config.getString(key); LOGGER.info("INSERTING: { KEY: " + key + ", VALUE: " + value + " }"); final Property p = new Property(key, value); session.save(p); } session.getTransaction().commit(); session.close(); }
From source file:uk.nhs.cfh.dsp.snomed.converters.human.readable.impl.HeuristicBasedHumanReadableRenderImpl.java
/** * Instantiates a new heuristic based human readable render impl. * * @param mrcmService the mrcm service/*w w w.j a v a2 s.c o m*/ */ public HeuristicBasedHumanReadableRenderImpl(MRCMService mrcmService) { this.mrcmService = mrcmService; configuration = new XMLConfiguration(); configuration.setExpressionEngine(new XPathExpressionEngine()); // this reload strategy wont work because we don't use the config object directly configuration.setReloadingStrategy(new FileChangedReloadingStrategy()); }
From source file:uk.nhs.cfh.dsp.snomed.converters.human.readable.impl.HeuristicBasedHumanReadableRenderImpl.java
/** * Empty constructor for IOC./*from w w w . j a va 2 s . c o m*/ */ public HeuristicBasedHumanReadableRenderImpl() { configuration = new XMLConfiguration(); configuration.setExpressionEngine(new XPathExpressionEngine()); // this reload strategy wont work because we don't use the config object directly configuration.setReloadingStrategy(new FileChangedReloadingStrategy()); }