1 package uk.ac.vamsas.client.simpleclient;
\r
5 * Element of the VamsasFileWatcherThread event generator chain.
\r
6 * Keep a reference to this element before adding it to the chain
\r
7 * in order to control the generation of events with halt and enable.
\r
9 * doWatch will do nothing if the element is not enabled.
\r
12 public class VamsasFileWatcherElement extends WatcherElement {
\r
13 VamsasFile watched=null;
\r
15 * create a new, enabled watch element
\r
16 * @param watcher file being watched
\r
17 * @param handler handler to call on state change
\r
19 public VamsasFileWatcherElement(VamsasFile watcher, WatcherCallBack handler) {
\r
20 this(watcher, handler, true);
\r
22 protected void initWatch() {
\r
25 watched.unLock(); // very very essential!
\r
26 watcher = new FileWatcher(watched.getVamsasFile());
\r
28 protected void endWatch() {
\r
29 // leaves watcher in state its in.
\r
32 * new watcher with flag to initially skip watching this sessionfile
\r
35 * @param enableWatching
\r
37 public VamsasFileWatcherElement(VamsasFile watcher, WatcherCallBack handler, boolean enableWatching) {
\r
39 this.watched = watcher;
\r
46 * @return the watched
\r
48 public VamsasFile getWatched() {
\r
51 protected String getSubject() {
\r
52 return watched.getVamsasFile().toString();
\r