com.scooterframework.admin
Class DirChangeMonitor

java.lang.Object
  extended by com.scooterframework.admin.DirChangeMonitor

public class DirChangeMonitor
extends java.lang.Object

DirChangeMonitor class monitors directory file changes and also notifies the changes to associated observers.

The default monitor interval is 2000 milliseconds. This can be changed by System property property.load.interval.


Nested Class Summary
 class DirChangeMonitor.DirChangeMonitorTimerTask
          DirChangeMonitorTimerTask is responsible for scanning files in the directory.
 
Method Summary
static DirChangeMonitor getInstance()
           
 void registerObserver(java.util.Observer observer, java.lang.String path, java.io.FileFilter filter)
          Register an observer of a directory path with a file filter.
 void registerObserverForDir(java.util.Observer observer, java.lang.String path)
          Register an observer of a directory path.
 void registerObserverForFileName(java.util.Observer observer, java.lang.String path, java.lang.String fileName)
          Register an observer for a file of a directory path.
 void registerObserverForFilePrefix(java.util.Observer observer, java.lang.String path, java.lang.String filePrefix)
          Register an observer for all files of the same prefix of a directory path.
 void registerObserverForFileSuffix(java.util.Observer observer, java.lang.String path, java.lang.String fileSuffix)
          Register an observer for all files of the same suffix of a directory path.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DirChangeMonitor getInstance()

start

public void start()

stop

public void stop()

registerObserverForFileName

public void registerObserverForFileName(java.util.Observer observer,
                                        java.lang.String path,
                                        java.lang.String fileName)
Register an observer for a file of a directory path.

Parameters:
observer -
path - directory path
fileName - the file to watch

registerObserverForFilePrefix

public void registerObserverForFilePrefix(java.util.Observer observer,
                                          java.lang.String path,
                                          java.lang.String filePrefix)
Register an observer for all files of the same prefix of a directory path.

Parameters:
observer -
path - directory path
filePrefix - the file prefix to watch

registerObserverForFileSuffix

public void registerObserverForFileSuffix(java.util.Observer observer,
                                          java.lang.String path,
                                          java.lang.String fileSuffix)
Register an observer for all files of the same suffix of a directory path.

Parameters:
observer -
path - directory path
fileSuffix - the file prefix to watch

registerObserverForDir

public void registerObserverForDir(java.util.Observer observer,
                                   java.lang.String path)
Register an observer of a directory path.

Parameters:
observer -
path - directory path

registerObserver

public void registerObserver(java.util.Observer observer,
                             java.lang.String path,
                             java.io.FileFilter filter)
Register an observer of a directory path with a file filter.

Parameters:
observer -
path - directory path
filter - file filter