Returns the absolute path for a given event.
Returns the absolute path for a given event.context().asInstancOf[Path] path taken from a WatchService event
This is actually taken from http://www.javacodegeeks.com/2013/04/watchservice-combined-with-akka-actors.html The way it works is a context is taken from the events originating from a WatchKey, which itself is registered to an actual watchable object. In this case, the watchable object is a Path. By using the watchable object as a path and calling resolve, passing in the relative path obtained from the context, we obtain the "full" relative-to-watchable path. Afterwards, toAbsolutePath is called to get the real absolute path.
WatchKey
Path relative to the key's watchable
Path
Not meant to be called directly
Not meant to be called directly
As an object that extends the Runnable interface, this method is required so that it can be passed into a Thread object and be run when #start is called on the thread object
Stops the WatchService current
Adds the path to the WatchService of this WatchServiceTask
Adds the path to the WatchService of this WatchServiceTask
This allows the thread running the run() method to do take() on the watchService to get a key for polling for events on registered paths
Path (Java7) path
Option[Modifier], the modifiers, if any, that modify how the object is registered
one or more WatchEvent.Kind[_], each being one of ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE
Option[WatchKey] a Java7 WatchService WatchKey
WatchService class that implements a Run method for passing into a thread
Largely inspired by http://www.javacodegeeks.com/2013/04/watchservice-combined-with-akka-actors.html Takes care of registering paths to be monitored as well as logic that takes care of properly shutting down and monitoring the watcher thread