Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.compiler
[Java] Class DirectoryWatcher

    java.lang.Object
      java.lang.Thread
          org.codehaus.groovy.grails.compiler.DirectoryWatcher

    public class DirectoryWatcher
    extends java.lang.Thread

Utility class to watch directories for changes.

Authors:
  Graeme Rocher

Since:
  2.0

Nested Class Summary
`static interface` | `DirectoryWatcher.FileChangeListener` Interface for FileChangeListeners

Field Summary
`static java.lang.String` | `SVN_DIR_NAME`
`protected java.util.Collection` | `extensions`

Fields inherited from class java.lang.Thread
MIN_PRIORITY, NORM_PRIORITY, MAX_PRIORITY

Constructor Summary
`DirectoryWatcher()`

Method Summary
`void` | `addListener(DirectoryWatcher.FileChangeListener listener)` Adds a file listener that can react to change events
`void` | `addWatchDirectory(java.io.File dir, java.util.List fileExtensions)` Adds a directory to watch for the given file and extensions.
`void` | `addWatchDirectory(java.io.File dir, java.lang.String extension)` Adds a directory to watch for the given file and extensions.
`void` | `addWatchFile(java.io.File fileToWatch)` Adds a file to the watch list
`void` | `run()`
`void` | `setActive(boolean active)` Sets whether to stop the directory watcher
`void` | `setSleepTime(long sleepTime)` Sets the amount of time to sleep between checks
`protected void` | `trackDirectoryExtensions(java.io.File dir, java.util.List fileExtensions)`

Methods inherited from class java.lang.Thread
java.lang.Thread#run(), java.lang.Thread#toString(), java.lang.Thread#isInterrupted(), java.lang.Thread#currentThread(), java.lang.Thread#getName(), java.lang.Thread#getThreadGroup(), java.lang.Thread#getStackTrace(), java.lang.Thread#holdsLock(java.lang.Object), java.lang.Thread#stop(java.lang.Throwable), java.lang.Thread#stop(), java.lang.Thread#dumpStack(), java.lang.Thread#setPriority(int), java.lang.Thread#setDaemon(boolean), java.lang.Thread#start(), java.lang.Thread#yield(), java.lang.Thread#sleep(long), java.lang.Thread#sleep(long, int), java.lang.Thread#interrupt(), java.lang.Thread#interrupted(), java.lang.Thread#destroy(), java.lang.Thread#isAlive(), java.lang.Thread#suspend(), java.lang.Thread#resume(), java.lang.Thread#getPriority(), java.lang.Thread#setName(java.lang.String), java.lang.Thread#activeCount(), java.lang.Thread#enumerate([Ljava.lang.Thread;), java.lang.Thread#countStackFrames(), java.lang.Thread#join(long), java.lang.Thread#join(long, int), java.lang.Thread#join(), java.lang.Thread#isDaemon(), java.lang.Thread#checkAccess(), java.lang.Thread#getContextClassLoader(), java.lang.Thread#setContextClassLoader(java.lang.ClassLoader), java.lang.Thread#getAllStackTraces(), java.lang.Thread#getId(), java.lang.Thread#getState(), java.lang.Thread#setDefaultUncaughtExceptionHandler(java.lang.Thread$UncaughtExceptionHandler), java.lang.Thread#getDefaultUncaughtExceptionHandler(), java.lang.Thread#getUncaughtExceptionHandler(), java.lang.Thread#setUncaughtExceptionHandler(java.lang.Thread$UncaughtExceptionHandler), java.lang.Thread#wait(long, int), java.lang.Thread#wait(long), java.lang.Thread#wait(), java.lang.Thread#equals(java.lang.Object), java.lang.Thread#hashCode(), java.lang.Thread#getClass(), java.lang.Thread#notify(), java.lang.Thread#notifyAll()

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### SVN_DIR_NAME

    public static final java.lang.String SVN_DIR_NAME

### extensions

    protected java.util.Collection extensions

Constructor Detail

### DirectoryWatcher

    public DirectoryWatcher()

Method Detail

### addListener

    public void addListener(DirectoryWatcher.FileChangeListener listener)

  Adds a file listener that can react to change events
  Parameters:
    `listener` - The file listener

### addWatchDirectory

    public void addWatchDirectory(java.io.File dir, java.util.List fileExtensions)

  Adds a directory to watch for the given file and extensions.
  Parameters:
    `dir` - The directory
    `fileExtensions` - The extensions

### addWatchDirectory

    public void addWatchDirectory(java.io.File dir, java.lang.String extension)

  Adds a directory to watch for the given file and extensions.
  Parameters:
    `dir` - The directory
    `extension` - The extension

### addWatchFile

    public void addWatchFile(java.io.File fileToWatch)

  Adds a file to the watch list
  Parameters:
    `fileToWatch` - The file to watch

### run

    @java.lang.Override
    public void run()

### setActive

    public void setActive(boolean active)

  Sets whether to stop the directory watcher
  Parameters:
    `active` - False if you want to stop watching

### setSleepTime

    public void setSleepTime(long sleepTime)

  Sets the amount of time to sleep between checks
  Parameters:
    `sleepTime` - The sleep time

### trackDirectoryExtensions

    protected void trackDirectoryExtensions(java.io.File dir, java.util.List fileExtensions)

Groovy Documentation