I have developed an app that detects changes in a file system using Java's java.nio.file.WatchService
This works great when setting up a WatchService for the default filesystem:
watchService = FileSystems.getDefault().newWatchService();
The use case I have now is to extend this app to monitor events on a remote ftp server. Specifically, when a new file (ENTRY_CREATE) event is detected get the file and then process it.
Researching this I believe this is the approach:
- Implement a custom FTP FileSystemProvider as per NIO.2 documentation
- Implement a WatchService implementation for the custom FTP FileSystemProvider
Overall, does this approach look right?
Secondly, any links to tutorials or implementations would be very helpful.
Thanks!