org.apache.geronimo.deployment.hot
Class DirectoryMonitor

java.lang.Object
  extended by org.apache.geronimo.deployment.hot.DirectoryMonitor
All Implemented Interfaces:
Runnable

public class DirectoryMonitor
extends Object
implements Runnable

Meant to be run as a Thread that tracks the contents of a directory. It sends notifications for changes to its immediate children (it will look into subdirs for changes, but will not send notifications for files within subdirectories). If a file continues to change on every pass, this will wait until it stabilizes before sending an add or update notification (to handle slow uploads, etc.).


Nested Class Summary
static interface DirectoryMonitor.Listener
           
 
Constructor Summary
DirectoryMonitor(File directory, DirectoryMonitor.Listener listener, int pollIntervalMillis)
           
 
Method Summary
 void close()
           
 File getDirectory()
           
 DirectoryMonitor.Listener getListener()
           
 int getPollIntervalMillis()
           
 void initialize()
           
 boolean isDone()
           
 void removeModuleId(Artifact id)
           
 void run()
           
 void setDirectory(File directory)
          Warning: changing the directory at runtime will cause all files in the old directory to be removed and all files in the new directory to be added, next time the thread awakens.
 void setListener(DirectoryMonitor.Listener listener)
           
 void setPollIntervalMillis(int pollIntervalMillis)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryMonitor

public DirectoryMonitor(File directory,
                        DirectoryMonitor.Listener listener,
                        int pollIntervalMillis)
Method Detail

getPollIntervalMillis

public int getPollIntervalMillis()

setPollIntervalMillis

public void setPollIntervalMillis(int pollIntervalMillis)

getListener

public DirectoryMonitor.Listener getListener()

setListener

public void setListener(DirectoryMonitor.Listener listener)

getDirectory

public File getDirectory()

setDirectory

public void setDirectory(File directory)
Warning: changing the directory at runtime will cause all files in the old directory to be removed and all files in the new directory to be added, next time the thread awakens.


isDone

public boolean isDone()

close

public void close()

removeModuleId

public void removeModuleId(Artifact id)

run

public void run()
Specified by:
run in interface Runnable

initialize

public void initialize()


Copyright © 2003-2008 The Apache Geronimo development community. All Rights Reserved.