uk.ac.vamsas.client.simpleclient
Class SessionFileWatcherElement

java.lang.Object
  extended byuk.ac.vamsas.client.simpleclient.WatcherElement
      extended byuk.ac.vamsas.client.simpleclient.SessionFileWatcherElement
Direct Known Subclasses:
ClientSessionFileWatcherElement

public class SessionFileWatcherElement
extends WatcherElement

Element of the VamsasFileWatcherThread event generator chain. Keep a reference to this element before adding it to the chain in order to control the generation of events with halt and enable. doWatch will do nothing if the element is not enabled.


Field Summary
 
Fields inherited from class uk.ac.vamsas.client.simpleclient.WatcherElement
handler, handlerCalled, watcher, watchForChange
 
Constructor Summary
SessionFileWatcherElement(SessionFile watcher, WatcherCallBack handler)
          create a new, enabled watch element
SessionFileWatcherElement(SessionFile watcher, WatcherCallBack handler, boolean enableWatching)
          new watcher with flag to initially skip watching this sessionfile
 
Method Summary
protected  void endWatch()
          called by haltWatch before clearing the FileWatcher reference.
protected  java.lang.String getSubject()
          implemented for debug information purposes.
 SessionFile getWatched()
           
protected  void initWatch()
          called to generate the watcher object by enableWatch and in doWatch
 
Methods inherited from class uk.ac.vamsas.client.simpleclient.WatcherElement
callHandler, doWatch, enableWatch, getHandler, getWatcher, haltWatch, isHandlerCalled, isWatchEnabled, setHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionFileWatcherElement

public SessionFileWatcherElement(SessionFile watcher,
                                 WatcherCallBack handler)
create a new, enabled watch element

Parameters:
watcher - file being watched
handler - handler to call on state change

SessionFileWatcherElement

public SessionFileWatcherElement(SessionFile watcher,
                                 WatcherCallBack handler,
                                 boolean enableWatching)
new watcher with flag to initially skip watching this sessionfile

Parameters:
watcher -
handler -
enableWatching -
Method Detail

initWatch

protected void initWatch()
Description copied from class: WatcherElement
called to generate the watcher object by enableWatch and in doWatch

Specified by:
initWatch in class WatcherElement

endWatch

protected void endWatch()
Description copied from class: WatcherElement
called by haltWatch before clearing the FileWatcher reference.

Specified by:
endWatch in class WatcherElement

getWatched

public SessionFile getWatched()
Returns:
the watched

getSubject

protected java.lang.String getSubject()
Description copied from class: WatcherElement
implemented for debug information purposes.

Specified by:
getSubject in class WatcherElement
Returns:
Informative string about what the watcher is watching