Package com.microstrategy.utils.config
Class ConfigFileManager
- java.lang.Object
-
- java.util.Observable
-
- com.microstrategy.utils.config.ConfigFileManager
-
public class ConfigFileManager extends java.util.ObservableA
ConfigFileManagerinstance provides notifications about changes that occur in its governing directory, or a specific filemanage(String). If aFileDispenseris 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 voidaddObserver(ConfigChangeObserver observer)Adds a newConfigChangeObserver.FileDispensergetDispenser()java.io.FilegetFile()static ConfigFileManagermanage(java.lang.String fileOrDirectoryResource)Returns theConfigFileManagersingleton identified by its managed directory or file.voidreset()Clears out the differential checking cache.voidsetDispenser(FileDispenser dispenser)If aFileDispenseris 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.voidupdate()Force an update immediately.
-
-
-
Method Detail
-
manage
public static ConfigFileManager manage(java.lang.String fileOrDirectoryResource) throws java.io.IOException
Returns theConfigFileManagersingleton 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 aFileDispenseris 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.SecurityExceptionjava.io.IOException
-
-