public class FileWatchService extends java.lang.Object implements FileWatch, Service, Outbound<java.nio.file.Path>
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"/> <file-watch id="file-watch" kinds="ENTRY_CREATE"/> <events:when id="both-files" name="When Both Files" xmlns:events="oddjob:events"> <jobs> <events:list eventOperator="ALL"> <of> <events:watch name="Watch File 1"> <eventSource> <events:file> <fileWatch> <value value="${file-watch}"/> </fileWatch> <file> <value value="${some.dir}/file1.txt"/> </file> </events:file> </eventSource> </events:watch> <events:watch name="Watch File 2"> <eventSource> <events:file> <fileWatch> <value value="${file-watch}"/> </fileWatch> <file> <value value="${some.dir}/file2.txt"/> </file> </events:file> </eventSource> </events:watch> </of> </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() |
java.util.List<java.nio.file.Path> |
getPaths() |
java.util.function.Consumer<? super java.nio.file.Path> |
getTo() |
void |
setFilter(java.lang.String filter) |
void |
setKinds(java.lang.String kinds) |
void |
setName(java.lang.String name) |
void |
setPaths(java.util.List<java.nio.file.Path> paths) |
void |
setTo(java.util.function.Consumer<? super java.nio.file.Path> to)
Set the out bound destination.
|
void |
start()
Start the service.
|
void |
stop()
Stop executing.
|
Restore |
subscribe(java.nio.file.Path path,
java.util.function.Consumer<? super InstantEvent<java.nio.file.Path>> consumer)
Subscribe to notifications for the existence or modifications in the file.
|
java.lang.String |
toString() |
public void start()
Service
public void stop()
Stoppable
public Restore subscribe(java.nio.file.Path path, java.util.function.Consumer<? super InstantEvent<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.util.List<java.nio.file.Path> getPaths()
public void setPaths(java.util.List<java.nio.file.Path> paths)
public java.util.function.Consumer<? super java.nio.file.Path> getTo()
public void setTo(java.util.function.Consumer<? super java.nio.file.Path> to)
Outbound
public java.lang.String toString()
toString
in class java.lang.Object