Class EntitledFileWatcher

All Implemented Interfaces:
ResourceWatcher

public class EntitledFileWatcher extends FileWatcher
A subclass of FileWatcher that lives in the security module.

The Elasticsearch entitlement system uses a StackWalker to determine which module is making a file-system call. FileWatcher lives in the server module and therefore cannot access paths that are marked exclusive: true for the security module (e.g. users and x-pack/users).

By overriding every protected file-I/O method here, the actual Files calls are issued from inside org.elasticsearch.security, so the entitlement check correctly attributes them to this module.