Class ConfigFileManager


  • public class ConfigFileManager
    extends java.util.Observable

    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.

    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)
      FileDispenser getDispenser()  
      java.io.File getFile()  
      static ConfigFileManager manage​(java.lang.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.
      • Methods inherited from class java.util.Observable

        addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • manage

        public static ConfigFileManager manage​(java.lang.String fileOrDirectoryResource)
                                        throws java.io.IOException
        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:
        java.io.IOException - thrown if the directory isn't found, or has inaccessible permissions
        java.lang.IllegalArgumentException - thrown if manager name already exists
      • setDispenser

        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
      • 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.
      • 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