Package com.ibm.wsspi.kernel.filemonitor
Interface FileMonitor
- 
 public interface FileMonitorComponents that want to monitor the file system for changes should implement the FileMonitor interface and register that implementation in the service registry.The properties associated with the registered service specify what resources are monitored and with what frequency. Valid service properties are listed as constants below with descriptive javadoc. 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringMONITOR_DIRECTORIESService propertystatic java.lang.StringMONITOR_FILESService propertystatic java.lang.StringMONITOR_FILTERService propertystatic java.lang.StringMONITOR_FILTER_DIRECTORIES_ONLYProperty valuestatic java.lang.StringMONITOR_FILTER_FILES_ONLYProperty valuestatic java.lang.StringMONITOR_INCLUDE_SELFService propertystatic java.lang.StringMONITOR_INTERVALService propertystatic java.lang.StringMONITOR_RECURSEService propertystatic java.lang.StringMONITOR_TYPEService propertystatic java.lang.StringMONITOR_TYPE_EXTERNALProperty valuestatic java.lang.StringMONITOR_TYPE_TIMEDProperty value
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonBaseline(java.util.Collection<java.io.File> baseline)Called with the result of a scan of specified resources.voidonChange(java.util.Collection<java.io.File> createdFiles, java.util.Collection<java.io.File> modifiedFiles, java.util.Collection<java.io.File> deletedFiles)Called by the monitor service when a scheduled scan completes with changes (indicated by the presence of files in the corresponding collection).
 
- 
- 
- 
Field Detail- 
MONITOR_FILESstatic final java.lang.String MONITOR_FILES Service propertyThe value should be a Collection, indicating what paths should be monitored. Elements of the collection will only be monitored while they do not exist, or exist as files. - See Also:
- Constant Field Values
 
 - 
MONITOR_DIRECTORIESstatic final java.lang.String MONITOR_DIRECTORIES Service propertyThe value should be a Collection, indicating what paths should be monitored. Elements of the collection will only be monitored while they do not exist, or exist as directories. - See Also:
- Constant Field Values
 
 - 
MONITOR_INTERVALstatic final java.lang.String MONITOR_INTERVAL Service propertyPoll/Scanning interval as a long with a time unit suffix:- ms - milliseconds
- s - seconds
- m - minutes
- h - hours
 - See Also:
- Constant Field Values
 
 - 
MONITOR_RECURSEstatic final java.lang.String MONITOR_RECURSE Service propertyThe value of this property should be a boolean: if true, a the monitor will receive notifications for individual files in the directory tree that have changed. If false, the monitor will only receive notification for the immediate children of the specified directory.For example, given monitored directory A: - In all cases, the monitor will be notified if A/file is created, changed, or deleted.
- When working with A/directory, if
 - monitor.recurse is true, the monitor will be notified when A/directory/file has been created, changed, or deleted.
- monitor.recurse is false, the monitor will only be notified when A/directory is added or removed.
 
 - See Also:
- Constant Field Values
 
 - 
MONITOR_INCLUDE_SELFstatic final java.lang.String MONITOR_INCLUDE_SELF Service propertyThe value of this property should be a boolean: If true, the monitor will additionally notify for the creation/deletion of any directories being monitored. If false, the monitor will report only on any files monitored, and the content of any monitored directories.For example, given monitored directory A: - In all cases, the monitor will be notified if A/file is created, changed, or deleted.
- When working with A, if
 - monitor.includeself is true, the monitor will be notified when A has been created, changed, or deleted.
- monitor.includeself is false, the monitor will not be notified if A is created, changed, or deleted.
 
 - See Also:
- Constant Field Values
 
 - 
MONITOR_FILTERstatic final java.lang.String MONITOR_FILTER Service propertyThe value associated with this property is a collection, where each string is either a regex match of names, or a simple string: "files" for only watching files, and "directories" for only monitoring directories. This applies only to monitoring directories. Given monitored directory A: - "\\.xml" will monitor A/*.xml,
- "directories" will only look for subdirectories of A
- "files" will only look for files contained in A
 - See Also:
- Constant Field Values
 
 - 
MONITOR_FILTER_DIRECTORIES_ONLYstatic final java.lang.String MONITOR_FILTER_DIRECTORIES_ONLY Property valueSpecial filter string limiting the monitor to directories only.- See Also:
- MONITOR_FILTER, Constant Field Values
 
 - 
MONITOR_FILTER_FILES_ONLYstatic final java.lang.String MONITOR_FILTER_FILES_ONLY Property valueSpecial filter string limiting the monitor to files only- See Also:
- MONITOR_FILTER, Constant Field Values
 
 - 
MONITOR_TYPEstatic final java.lang.String MONITOR_TYPE Service propertyThe value of this property determines how the file monitoring is to be performed. Acceptable values are as follows:- "timed" will monitor the files and/or directories at regular intervals
- "external" will defer monitoring to an external agent
 - See Also:
- Constant Field Values
 
 - 
MONITOR_TYPE_TIMEDstatic final java.lang.String MONITOR_TYPE_TIMED Property valueMonitor at regular intervals.- See Also:
- Constant Field Values
 
 - 
MONITOR_TYPE_EXTERNALstatic final java.lang.String MONITOR_TYPE_EXTERNAL Property valueDefer monitoring to an external agent.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
onBaselinevoid onBaseline(java.util.Collection<java.io.File> baseline) Called with the result of a scan of specified resources. Only resources that existed at the time of the scan will be included.- Parameters:
- baseline- Collection of files which match the specified filters that were discovered during the scan.
- See Also:
- #MONITOR_BASELINE
 
 - 
onChangevoid onChange(java.util.Collection<java.io.File> createdFiles, java.util.Collection<java.io.File> modifiedFiles, java.util.Collection<java.io.File> deletedFiles)Called by the monitor service when a scheduled scan completes with changes (indicated by the presence of files in the corresponding collection).- Parameters:
- createdFiles- A collection of files that were created since the last scan.
- modifiedFiles- A collection of files that were modified since the last scan.
- deletedFiles- A collection of files that were deleted since the last scan.
 
 
- 
 
-