# Class WarWatcher

java.lang.Object
org.apache.catalina.ha.deploy.WarWatcher

public class WarWatcher extends Object
The WarWatcher watches the deployDir for changes made to the directory (adding new WAR files->deploy or remove WAR files->undeploy) and notifies a listener of the changes made.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static class`
`WarWatcher.WarFilter`
File name filter for war files
`protected static class`
`WarWatcher.WarInfo`
File information on existing WAR files

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final Map<String, WarWatcher.WarInfo>`
`currentStatus`
Currently deployed files
`protected final FileChangeListener`
`listener`
Parent to be notified of changes
`protected final File`
`watchDir`
Directory to watch for war files

## Constructor Summary

Constructors
Constructor
Description
`WarWatcher(FileChangeListener listener, File watchDir)`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`addWarInfo(File warfile)`
add cluster war to the watcher state
`void`
`check()`
check for modification and send notification to listener
`void`
`clear()`
clear watcher state

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### watchDir

protected final File watchDir
Directory to watch for war files

### listener

protected final FileChangeListener listener
Parent to be notified of changes

### currentStatus

protected final Map<String, WarWatcher.WarInfo> currentStatus
Currently deployed files

## Constructor Details

### WarWatcher

public WarWatcher(FileChangeListener listener, File watchDir)

## Method Details

### check

public void check()
check for modification and send notification to listener

### addWarInfo

protected void addWarInfo(File warfile)
add cluster war to the watcher state

Parameters:
  `warfile` - The WAR to add

### clear

public void clear()
clear watcher state