/** * This will return the duration in milliseconds before the next refresh of the properties file. A * value of -1 indicates that no refresh will occur. * * @param propertyFile The name of the property file. * @throws PropertyAccessException This is thrown if an error occurs accessing the property. */ public synchronized int getDurationBeforeNextRefresh(String propertyFile) throws PropertyAccessException { validateInput(propertyFile); checkForRefreshAndLoad(propertyFile); return refreshHandler.getDurationBeforeNextRefresh(propertyFile); }
/** * This method loads the property file and sets the refresh time. If the property: * "CacheRefreshDuration" is found in the property file, then it will set it as follows: If the * value is "-1", then * * @param propertyFile The name of the property file to be loaded. * @param refreshInfo The refresh information that we already know - this may be null if this is * the first time the file is being loaded. * @throws gov.hhs.fha.nhinc.properties.PropertyAccessException This exception is thrown if it * cannot load the property file for some reason. */ private synchronized void loadPropertyFile(String propertyFile) throws PropertyAccessException { String propFilePathAndName = fileUtilities.getPropertyFileLocation(propertyFile); File propertyFileLocation = new File(propFilePathAndName); // // propertyFileDAO.loadPropertyFile(Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFile), propertyFile); propertyFileDAO.loadPropertyFile(propertyFileLocation, propertyFile); String cacheRefreshDuration = propertyFileDAO.getProperty(propertyFile, CACHE_REFRESH_DURATION); refreshHandler.addRefreshInfo(propertyFile, cacheRefreshDuration); }
/** * This method will check to see if the property file needs to be refreshed and if it does, it * will reload it. Otherwise it will leave it as is. * * @param propertyFile The name of the property file that is being checked and possibly loaded. * @throws PropertyAccessException If an error occurs during the load process, this exception is * thrown. */ private synchronized void checkForRefreshAndLoad(String propertyFile) throws PropertyAccessException { if (refreshHandler.needsRefresh(propertyFile)) { loadPropertyFile(propertyFile); } }
/** * This method dumps the properties and associated values for a properties file to the log file. * * @param propertyFile The name of the property file. * @throws PropertyAccessException This is thrown if an error occurs accessing the property. */ public void dumpPropsToLog(String propertyFile) throws PropertyAccessException { validateInput(propertyFile); refreshHandler.printToLog(propertyFile); propertyFileDAO.printToLog(propertyFile); }