|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mortbay.util.Scanner
public class Scanner
Scanner Utility for scanning a directory for added, removed and changed files and reporting these events via registered Listeners. TODO AbstractLifeCycle
Nested Class Summary | |
---|---|
static interface |
Scanner.Listener
Listener Signature of notifications re file changes. |
Constructor Summary | |
---|---|
Scanner()
|
Method Summary | |
---|---|
void |
addListener(Scanner.Listener listener)
Add an added/removed/changed listener |
FilenameFilter |
getFilenameFilter()
Get any filter applied to files in the scan dir. |
File |
getScanDir()
Get the location of the directory to scan |
int |
getScanInterval()
Get the scan interval |
void |
removeListener(Scanner.Listener listener)
Remove a registered listener |
void |
reportDifferences(Map currentScan,
Map oldScan)
Report the adds/changes/removes to the registered listeners |
void |
run()
Scan the configured directory, sleeping for the configured scanInterval (in seconds) between each pass. |
void |
scan()
Perform a pass of the scanner and report changes |
Map |
scanFiles()
Recursively scan all files in the designated directory. |
void |
setFilenameFilter(FilenameFilter filter)
Apply a filter to files found in the scan directory. |
void |
setReportExistingFilesOnStartup(boolean reportExisting)
Whether or not an initial scan will report all files as being added. |
void |
setScanDir(File dir)
Set the location of the directory to scan. |
void |
setScanInterval(int scanInterval)
Set the scan interval |
void |
start()
Start the scanning action. |
void |
stop()
Stop the scanning. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Scanner()
Method Detail |
---|
public int getScanInterval()
public void setScanInterval(int scanInterval)
scanInterval
- pause between scans in secondspublic void setScanDir(File dir)
dir
- public File getScanDir()
public void setFilenameFilter(FilenameFilter filter)
filter
- public 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 run()
run
in interface Runnable
Runnable.run()
public void start()
public void stop()
public void scan()
public Map scanFiles()
public void reportDifferences(Map currentScan, Map oldScan)
currentScan
- the info from the most recent passoldScan
- info from the previous pass
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |