org.apache.jetspeed.services.registry
Class RegistryWatcher

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.apache.jetspeed.services.registry.RegistryWatcher
All Implemented Interfaces:
java.lang.Runnable

public class RegistryWatcher
extends java.lang.Thread

Monitors a Registry directory and notifies the associated Registry of file updates.

Version:
$Id: RegistryWatcher.java,v 1.11 2005/03/21 18:21:44 sgala Exp $
Author:
Raphaël Luta

Field Summary
static int SCAN_RATE
          Minimum scan rate for evaluating file refresh
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RegistryWatcher()
          Creates a default RegistryWatcher
 
Method Summary
 void changeBase(java.io.File f)
          Change the base file or directory to be monitored by this watcher
 java.io.FileFilter getFilter()
           
 long getRefreshRate()
           
 FileRegistry getSubscriber()
           
 void run()
          Main routine for the monitor which periodically checks whether the filex have been modified.
 void setDone()
          Mark that the watching thread should be stopped
 void setFilter(java.io.FileFilter filter)
          Sets the file filter for selecting the registry files
 void setRefreshRate(long refresh)
          Sets the refresh rate for this watcher
 void setSubscriber(FileRegistry registry)
          Modifies the subscriber to this Watcher
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SCAN_RATE

public static final int SCAN_RATE
Minimum scan rate for evaluating file refresh

See Also:
Constant Field Values
Constructor Detail

RegistryWatcher

public RegistryWatcher()
Creates a default RegistryWatcher

Method Detail

setSubscriber

public void setSubscriber(FileRegistry registry)
Modifies the subscriber to this Watcher

Parameters:
registry - the new registry subscriber

getSubscriber

public FileRegistry getSubscriber()
Returns:
the subscriber to this watcher

setRefreshRate

public void setRefreshRate(long refresh)
Sets the refresh rate for this watcher

Parameters:
refresh - the refresh rate in seconds

getRefreshRate

public long getRefreshRate()
Returns:
the refresh rate, in seconds, of this watcher

setFilter

public void setFilter(java.io.FileFilter filter)
Sets the file filter for selecting the registry files

Parameters:
filter - the file filter to use

getFilter

public java.io.FileFilter getFilter()
Returns:
the file filter used by this watcher instance

changeBase

public void changeBase(java.io.File f)
Change the base file or directory to be monitored by this watcher

Parameters:
f - the file or directory to monitor

run

public void run()

Main routine for the monitor which periodically checks whether the filex have been modified.

The algorithm used does not guarantee a constant refresh rate between invocations.


setDone

public void setDone()
Mark that the watching thread should be stopped



Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.