Package com.microstrategy.utils.config
Class ConfigFileManager
- java.lang.Object
-
- java.util.Observable
-
- com.microstrategy.utils.config.ConfigFileManager
-
public class ConfigFileManager extends java.util.Observable
A
ConfigFileManager
instance provides notifications about changes that occur in its governing directory, or a specific filemanage(String)
. If aFileDispenser
is provided, and if a requested file is not present, the dispenser will attempt to locate it in the classpath and make a duplicate at the given file location (if it has a directory context).Observers need to extend
ConfigChangeObserver
. When the application starts up, all files are considered new.- Since:
- MicroStrategy Web 8.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObserver(ConfigChangeObserver observer)
Adds a newConfigChangeObserver
.FileDispenser
getDispenser()
java.io.File
getFile()
static ConfigFileManager
manage(java.lang.String fileOrDirectoryResource)
Returns theConfigFileManager
singleton identified by its managed directory or file.void
reset()
Clears out the differential checking cache.void
setDispenser(FileDispenser dispenser)
If aFileDispenser
is specified, the auto-dispensing feature is enabled: whenever a file is requested, but not in the specified directory, the dispenser will search for it in the classpath and make a duplicate in the governed directory if found.void
update()
Force an update immediately.
-
-
-
Method Detail
-
manage
public static ConfigFileManager manage(java.lang.String fileOrDirectoryResource) throws java.io.IOException
Returns theConfigFileManager
singleton identified by its managed directory or file.- Parameters:
fileOrDirectoryResource
- directory to be managed (excludes sub-directories if directory)- Returns:
- a new
ConfigFileManager
- Throws:
java.io.IOException
- thrown if the directory isn't found, or has inaccessible permissionsjava.lang.IllegalArgumentException
- thrown if manager name already exists
-
setDispenser
public void setDispenser(FileDispenser dispenser)
If aFileDispenser
is specified, the auto-dispensing feature is enabled: whenever a file is requested, but not in the specified directory, the dispenser will search for it in the classpath and make a duplicate in the governed directory if found. The duplication will trigger the appropriate updates.- Parameters:
dispenser
- optional file dispenser
-
getDispenser
public FileDispenser getDispenser()
- Returns:
- returns the file dispenser, null if none specified
-
update
public void update()
Force an update immediately. Normally, updates occur automatically as determined by setUpdateInterval(long). If an update occurs while another is currently in progress, it will be ignored.
-
addObserver
public void addObserver(ConfigChangeObserver observer)
Adds a newConfigChangeObserver
.- Parameters:
observer
- newConfigChangeObserver
-
reset
public void reset()
Clears out the differential checking cache. All files in the directory will now appear as if they were new files.
-
getFile
public java.io.File getFile() throws java.lang.SecurityException, java.io.IOException
- Throws:
java.lang.SecurityException
java.io.IOException
-
-