Class FileSystemWatcher

All Implemented Interfaces:
Iterable<ComponentType>, Channel, ComponentType, Eligible, Manager

public class FileSystemWatcher extends Component
A component that watches paths in the file system for changes and sends events if such changes occur.
  • Field Details

  • Constructor Details

    • FileSystemWatcher

      Creates a new component base with its channel set to itself.
    • FileSystemWatcher

      public FileSystemWatcher(Channel componentChannel)
      Creates a new component base with its channel set to the given channel.

      As a special case Channel.SELF can be passed to the constructor to make the component use itself as channel. The special value is necessary as you obviously cannot pass an object to be constructed to its constructor.

      componentChannel - the channel that the component’s handlers listen on by default and that, Channel...) sends the event to
  • Method Details

    • onWatchFile

      @Handler public void onWatchFile(WatchFile event, Channel channel) throws IOException
      Register a path to wath.

      Subsequent FileChanged events will be fire on the channel(s) on which the WatchFile event was fired.

      The channel is stored using a weak reference, so no explicit “clear watch” is required.

      event - the event
      channel - the channel
      IOException - if an I/O exception occurs