Package com.dtolabs.rundeck.core.common
Class PropertiesCache
- java.lang.Object
-
- com.dtolabs.rundeck.core.common.PropertiesCache
-
public class PropertiesCache extends java.lang.Object
PropertiesCache caches properties file contents and reloads them if they have been modified.
-
-
Constructor Summary
Constructors Constructor Description PropertiesCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Properties
getProperties(java.io.File file)
Get the java Properties stored in the file, loading from disk only if the file has been modified since the last read, or the cached data has been invalidated.boolean
needsReload(java.io.File file)
Returns true if the file does not exist, or has been modified since the last time it was loaded.void
touch(java.io.File file)
Clear cached data for the file, causing a reload for the next call ofgetProperties(java.io.File)
-
-
-
Method Detail
-
needsReload
public boolean needsReload(java.io.File file) throws java.io.IOException
Returns true if the file does not exist, or has been modified since the last time it was loaded.- Parameters:
file
- File to check- Returns:
- true if the file needs to be reloaded.
- Throws:
java.io.IOException
- on io error
-
getProperties
public java.util.Properties getProperties(java.io.File file) throws java.io.IOException
Get the java Properties stored in the file, loading from disk only if the file has been modified since the last read, or the cached data has been invalidated.- Parameters:
file
- java properties file- Returns:
- java Properties
- Throws:
java.io.IOException
- due to file read or find error
-
touch
public void touch(java.io.File file)
Clear cached data for the file, causing a reload for the next call ofgetProperties(java.io.File)
- Parameters:
file
- file
-
-