LifeCyclepublic class Scanner extends AbstractLifeCycle
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
Scanner.BulkListener |
|
static interface |
Scanner.DiscreteListener |
|
static interface |
Scanner.Listener |
Listener
Marker for notifications re file changes.
|
static class |
Scanner.Notification |
|
static interface |
Scanner.ScanCycleListener |
Listener that notifies when a scan has started and when it has ended.
|
static interface |
Scanner.ScanListener |
AbstractLifeCycle.AbstractLifeCycleListenerFAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING| Constructor | Description |
|---|---|
Scanner() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addListener(Scanner.Listener listener) |
Add an added/removed/changed listener
|
void |
addScanDir(java.io.File dir) |
|
void |
doStart() |
Start the scanning action.
|
void |
doStop() |
Stop the scanning.
|
boolean |
exists(java.lang.String path) |
|
java.io.FilenameFilter |
getFilenameFilter() |
Get any filter applied to files in the scan dir.
|
boolean |
getRecursive() |
|
boolean |
getReportDirs() |
|
boolean |
getReportExistingFilesOnStartup() |
|
int |
getScanDepth() |
Get the scanDepth.
|
java.util.List<java.io.File> |
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<java.lang.String,org.eclipse.jetty.util.Scanner.TimeNSize> currentScan,
java.util.Map<java.lang.String,org.eclipse.jetty.util.Scanner.TimeNSize> 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 |
setReportDirs(boolean dirs) |
Set if found directories should be reported.
|
void |
setReportExistingFilesOnStartup(boolean reportExisting) |
Whether or not an initial scan will report all files as being
added.
|
void |
setScanDepth(int scanDepth) |
Set the scanDepth.
|
void |
setScanDirs(java.util.List<java.io.File> dirs) |
|
void |
setScanInterval(int scanInterval) |
Set the scan interval
|
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stoppublic int getScanInterval()
public void setScanInterval(int scanInterval)
scanInterval - pause between scans in seconds, or 0 for no scan after the initial scan.public void setScanDirs(java.util.List<java.io.File> dirs)
public void addScanDir(java.io.File dir)
public java.util.List<java.io.File> getScanDirs()
public void setRecursive(boolean recursive)
recursive - True if scanning is recursivesetScanDepth(int)public boolean getRecursive()
getScanDepth()public int getScanDepth()
public void setScanDepth(int scanDepth)
scanDepth - the scanDepth to setpublic void setFilenameFilter(java.io.FilenameFilter filter)
filter - the filename filter to usepublic 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 boolean getReportExistingFilesOnStartup()
public void setReportDirs(boolean dirs)
dirs - true to report directory changes as wellpublic boolean getReportDirs()
public void addListener(Scanner.Listener listener)
listener - the listener to addpublic void removeListener(Scanner.Listener listener)
listener - the Listener to be removedpublic void doStart()
doStart in class AbstractLifeCyclepublic java.util.TimerTask newTimerTask()
public java.util.Timer newTimer()
public void schedule()
public void doStop()
doStop in class AbstractLifeCyclepublic boolean exists(java.lang.String path)
path - tests if the path existspublic void scan()
public void scanFiles()
public void reportDifferences(java.util.Map<java.lang.String,org.eclipse.jetty.util.Scanner.TimeNSize> currentScan, java.util.Map<java.lang.String,org.eclipse.jetty.util.Scanner.TimeNSize> oldScan)
currentScan - the info from the most recent passoldScan - info from the previous passCopyright © 1995–2018 Webtide. All rights reserved.