Module ca.on.oicr.gsi.shesmu
Class AutoUpdatingDirectory<T extends WatchedFileListener>
java.lang.Object
ca.on.oicr.gsi.shesmu.plugin.files.AutoUpdatingDirectory<T>
- Type Parameters:
T
- the wrapper class for updating each file
Creates a repository of updating files stored in a directory
-
Constructor Summary
ConstructorDescriptionAutoUpdatingDirectory
(FileWatcher watcher, String extension, Function<Path, T> ctor) Creates a new automatically updating directoryAutoUpdatingDirectory
(String extension, Function<Path, T> ctor) Creates a new automatically updating directory -
Method Summary
-
Constructor Details
-
AutoUpdatingDirectory
Creates a new automatically updating directory- Parameters:
watcher
- the file watcher to useextension
- the file extension for the files that should be loadedctor
- a constructor to create a new self-updating file for a path
-
AutoUpdatingDirectory
Creates a new automatically updating directory- Parameters:
extension
- the file extension for the files that should be loadedctor
- a constructor to create a new self-updating file for a path
-
-
Method Details
-
isEmpty
public boolean isEmpty()Check if there are no files currently detected- Returns:
- true if there are no files currently detected; false otherwise
-
stream
Access all entries detected for each file- Returns:
- a stream of all values
-
subscribe
Register a callback to invoke whenever a new file is detected.- Parameters:
callback
- the callback to invoke- Returns:
- a mechanism to unsubscribe this callback
-