|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--org.jconfig.FileWatcher
A class which implements an event dispatching mechanism to all classes supporting the FileListener interface. This class will notify all FileListeners when the configuration changes. Once the FileWatcher has been shutdown, the class needs to be reinstanciated and restarted.
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
FileWatcher(java.io.File file)
Constructs a FileWatcher watching the specified File |
|
FileWatcher(java.lang.String filename)
Creates a new instance of FileWatcher by calling the FileWatcher( File ) Constructor. |
Method Summary | |
void |
addFileListener(FileListener fileListener)
Adds FileListener |
FileListener[] |
getFileListeners()
Retrieve an array of FileListeners. |
static void |
main(java.lang.String[] args)
Used to test it all |
void |
run()
Start the thread to call checkFile() |
void |
setFile(java.io.File file)
Sets a new File to be watched. |
void |
setInterval(int seconds)
Set the timer interval. |
void |
start()
Start the Thread on its journey to scan for changes to the file it is watching. |
void |
stopWatching()
Tell thread to stop watching. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public FileWatcher(java.lang.String filename)
filename
- A String representing the path to the file to be watched.public FileWatcher(java.io.File file)
file
- The File to be watchedMethod Detail |
public void addFileListener(FileListener fileListener)
fileListener
- The FileListenerpublic void setInterval(int seconds)
seconds
- The number of seconds to set the interval when
to check for the changes to the file.public void stopWatching()
public void start()
start
in class java.lang.Thread
public void run()
run
in class java.lang.Thread
public FileListener[] getFileListeners()
public void setFile(java.io.File file)
file
- The File to be watchedpublic static void main(java.lang.String[] args)
args
- None required
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |