Class FileWatcher
java.lang.Object
com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
com.inductiveautomation.perspective.gateway.files.FileWatcher
Creates a 
WatchService from the injected FileSystem and registers it to the injected Path
 to watch. When started, instances of this class will schedule polling tasks on the injected
 SchedulerAbstraction to check whether or not the directory represented by the injected path to watch
 exists and is a valid directory and if so, will start watching that directory and will call the injected
 listener with a FileWatcher.FileWatchEventType.REGISTER event type and a null path, else it will continue polling
 until the directory is created or it is shut down. Once the directory is being watched, if a file was created,
 modified, or deleted in the watched directory in between each poll cycle, then the respective
 FileWatcher.FileWatchEventType will be passed to the injected listener along with the full path to the file for each
 watch event which occurred for that poll cycle. If there is an overflow of events from the FileSystem, the
 injected listener will be called with a FileWatcher.FileWatchEventType.OVERFLOW event type and a null path. This
 watcher handles the case where the path to watch is deleted while it is being watched. In this case, it falls back
 to the above mentioned behavior when the watcher is started up and the path to watch does not represent a
 directory or does not exist. If the path to watch is re-created as a valid directory, the watcher will resume
 watching the path for changes and will notify the listener with a FileWatcher.FileWatchEventType.REGISTER event type
 and a null path.- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumRepresents the types of file watch events which may occur
- 
Constructor SummaryConstructorsConstructorDescriptionFileWatcher(FileSystem fileSystem, Path pathToWatch, SchedulerAbstraction scheduler, BiConsumer<FileWatcher.FileWatchEventType, Path> listener) The primary constructor for creating instances of theFileWatcher.
- 
Method SummaryMethods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycleisRunning, shutdown, startup
- 
Constructor Details- 
FileWatcherpublic FileWatcher(@Nonnull FileSystem fileSystem, @Nonnull Path pathToWatch, @Nonnull SchedulerAbstraction scheduler, @Nonnull BiConsumer<FileWatcher.FileWatchEventType, Path> listener) The primary constructor for creating instances of theFileWatcher.- Parameters:
- fileSystem- The- FileSystemwhich has the injected path which will be watched
- pathToWatch- The- Pathto watch
- scheduler- The- SchedulerAbstractionused to schedule polling tasks
- listener- The- BiConsumerlistener which will be called when the watcher is registered with the path to watch and for any watch events which occur in the watched path per poll cycle
 
 
- 
- 
Method Details- 
onStartupprotected void onStartup()- Specified by:
- onStartupin class- AbstractLifecycle
 
- 
onShutdownprotected void onShutdown()- Specified by:
- onShutdownin class- AbstractLifecycle
 
 
-