org.mortbay.util
public class Scanner extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Scanner.BulkListener |
static interface |
Scanner.DiscreteListener |
static interface |
Scanner.Listener
Listener
Marker for notifications re file changes.
|
Constructor and Description |
---|
Scanner() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(Scanner.Listener listener)
Add an added/removed/changed listener
|
java.io.FilenameFilter |
getFilenameFilter()
Get any filter applied to files in the scan dir.
|
boolean |
getRecursive() |
java.io.File |
getScanDir()
Deprecated.
use getScanDirs() instead
|
java.util.List |
getScanDirs() |
int |
getScanInterval()
Get the scan interval
|
java.util.Timer |
newTimer() |
java.util.TimerTask |
newTimerTask() |
void |
removeListener(Scanner.Listener listener)
Remove a registered listener
|
void |
reportDifferences(java.util.Map currentScan,
java.util.Map oldScan)
Report the adds/changes/removes to the registered listeners
|
void |
scan()
Perform a pass of the scanner and report changes
|
void |
scanFiles()
Recursively scan all files in the designated directories.
|
void |
schedule() |
void |
setFilenameFilter(java.io.FilenameFilter filter)
Apply a filter to files found in the scan directory.
|
void |
setRecursive(boolean recursive) |
void |
setReportExistingFilesOnStartup(boolean reportExisting)
Whether or not an initial scan will report all files as being
added.
|
void |
setScanDir(java.io.File dir)
Deprecated.
use setScanDirs(List dirs) instead
|
void |
setScanDirs(java.util.List dirs) |
void |
setScanInterval(int scanInterval)
Set the scan interval
|
void |
start()
Start the scanning action.
|
void |
stop()
Stop the scanning.
|
public int getScanInterval()
public void setScanInterval(int scanInterval)
scanInterval
- pause between scans in secondspublic void setScanDir(java.io.File dir)
dir
- public java.io.File getScanDir()
public void setScanDirs(java.util.List dirs)
public java.util.List getScanDirs()
public void setRecursive(boolean recursive)
public boolean getRecursive()
public void setFilenameFilter(java.io.FilenameFilter filter)
filter
- public java.io.FilenameFilter getFilenameFilter()
public void setReportExistingFilesOnStartup(boolean reportExisting)
reportExisting
- if true, all files found on initial scan will be
reported as being added, otherwise notpublic void addListener(Scanner.Listener listener)
listener
- public void removeListener(Scanner.Listener listener)
listener
- the Listener to be removedpublic void start()
public java.util.TimerTask newTimerTask()
public java.util.Timer newTimer()
public void schedule()
public void stop()
public void scan()
public void scanFiles()
public void reportDifferences(java.util.Map currentScan, java.util.Map oldScan)
currentScan
- the info from the most recent passoldScan
- info from the previous passCopyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.