public class

ConfigFileManager

extends Observable
java.lang.Object
   ↳ java.util.Observable
     ↳ com.microstrategy.utils.config.ConfigFileManager

Class Overview

A ConfigFileManager instance provides notifications about changes that occur in its governing directory, or a specific file manage(String). If a FileDispenser 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.

Summary

Public Methods
void addObserver(ConfigChangeObserver observer)
FileDispenser getDispenser()
File getFile()
synchronized static ConfigFileManager manage(String fileOrDirectoryResource)
Returns the ConfigFileManager singleton identified by its managed directory or file.
void reset()
Clears out the differential checking cache.
void setDispenser(FileDispenser dispenser)
If a FileDispenser 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.
[Expand]
Inherited Methods
From class java.util.Observable
From class java.lang.Object

Public Methods

public void addObserver (ConfigChangeObserver observer)

Parameters
observer new ConfigChangeObserver

public FileDispenser getDispenser ()

Returns
  • returns the file dispenser, null if none specified

public File getFile ()

Throws
IOException
SecurityException

public static synchronized ConfigFileManager manage (String fileOrDirectoryResource)

Returns the ConfigFileManager singleton identified by its managed directory or file.

Parameters
fileOrDirectoryResource directory to be managed (excludes sub-directories if directory)
Returns
  • a new ConfigFileManager
Throws
IOException thrown if the directory isn't found, or has inaccessible permissions
IllegalArgumentException thrown if manager name already exists

public void reset ()

Clears out the differential checking cache. All files in the directory will now appear as if they were new files.

public void setDispenser (FileDispenser dispenser)

If a FileDispenser 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

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.