public class FileWatchService extends java.lang.Object implements FileWatch
Implementation Note: This facility is still a work in progress. Requiring this service in a configuration is messy. In future releases this service should be hidden from users.
<oddjob> <job> <sequential> <jobs> <mkdir dir="${some.dir}/etc" name="Create Test Dir"/> <events:file-watch-service id="file-watch" kinds="ENTRY_CREATE" xmlns:events="oddjob:events"/> <events:when id="both-files" name="When Both Files" xmlns:events="oddjob:events"> <jobs> <events:list eventOperator="ALL"> <child> <events:file-watch name="Watch File 1"> <fileWatch> <value value="${file-watch}"/> </fileWatch> <file> <value value="${some.dir}/file1.txt"/> </file> </events:file-watch> <events:file-watch name="Watch File 2"> <fileWatch> <value value="${file-watch}"/> </fileWatch> <file> <value value="${some.dir}/file2.txt"/> </file> </events:file-watch> </child> </events:list> <echo id="task">${both-files.trigger.ofs}</echo> </jobs> </events:when> <folder> <jobs> <copy id="createFile1" name="Create File 1" to="${some.dir}/file1.txt"> <input> <buffer>Test1</buffer> </input> </copy> <copy id="createFile2" name="Create File 2" to="${some.dir}/file2.txt"> <input> <buffer>Test2</buffer> </input> </copy> <delete name="Delete All Test Files"> <files> <files files="${some.dir}/*"/> </files> </delete> </jobs> </folder> </jobs> </sequential> </job> </oddjob>
FileWatchEventSource
Constructor and Description |
---|
FileWatchService() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getFilter() |
java.lang.String |
getKinds() |
java.lang.String |
getName() |
int |
getNumberOfConsumers() |
void |
setFilter(java.lang.String filter) |
void |
setKinds(java.lang.String kinds) |
void |
setName(java.lang.String name) |
void |
start() |
void |
stop() |
Restore |
subscribe(java.nio.file.Path path,
java.util.function.Consumer<? super EventOf<java.nio.file.Path>> consumer)
Subscribe to notifications for the existence or modifications in the file.
|
java.lang.String |
toString() |
public void start()
public void stop()
public Restore subscribe(java.nio.file.Path path, java.util.function.Consumer<? super EventOf<java.nio.file.Path>> consumer)
FileWatch
public void setFilter(java.lang.String filter)
public java.lang.String getFilter()
public int getNumberOfConsumers()
public java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.String getKinds()
public void setKinds(java.lang.String kinds)
public java.lang.String toString()
toString
in class java.lang.Object