uk.ac.vamsas.client.simpleclient
Class SessionFlagWatcherElement

java.lang.Object
  extended byuk.ac.vamsas.client.simpleclient.WatcherElement
      extended byuk.ac.vamsas.client.simpleclient.SessionFlagWatcherElement

public class SessionFlagWatcherElement
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. TODO: TEST THIS CLASS - not yet used in SimpleClient


Field Summary
 
Fields inherited from class uk.ac.vamsas.client.simpleclient.WatcherElement
handler, handlerCalled, watcher, watchForChange
 
Constructor Summary
SessionFlagWatcherElement(SessionFlagFile watcher, WatcherCallBack handler)
          create a new, enabled watch element
SessionFlagWatcherElement(SessionFlagFile 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.
 SessionFlagFile 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

SessionFlagWatcherElement

public SessionFlagWatcherElement(SessionFlagFile watcher,
                                 WatcherCallBack handler)
create a new, enabled watch element

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

SessionFlagWatcherElement

public SessionFlagWatcherElement(SessionFlagFile 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 SessionFlagFile 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