public class FileWatcher extends Object
Modifier and Type | Field and Description |
---|---|
private Map<Path,SourceEntry> |
ruleMap |
private Map<Path,StyleSource> |
styleMap |
private WatchService |
watcher |
Constructor and Description |
---|
FileWatcher()
Constructs a new
FileWatcher . |
Modifier and Type | Method and Description |
---|---|
private void |
processEvents()
Process all events for the key queued to the watcher.
|
private <T extends SourceEntry> |
register(T obj,
Map<Path,T> map) |
void |
registerStyleSource(StyleSource style)
Registers a map paint style for local file changes, allowing dynamic reloading.
|
void |
registerValidatorRule(SourceEntry rule)
Registers a validator rule for local file changes, allowing dynamic reloading.
|
private WatchService watcher
private final Map<Path,StyleSource> styleMap
private final Map<Path,SourceEntry> ruleMap
public FileWatcher()
FileWatcher
.public void registerStyleSource(StyleSource style) throws IOException
style
- The style to watchIllegalArgumentException
- if style
is null or if it does not provide a local fileIllegalStateException
- if the watcher service failed to startIOException
- if an I/O error occurspublic void registerValidatorRule(SourceEntry rule) throws IOException
rule
- The rule to watchIllegalArgumentException
- if rule
is null or if it does not provide a local fileIllegalStateException
- if the watcher service failed to startIOException
- if an I/O error occursprivate <T extends SourceEntry> void register(T obj, Map<Path,T> map) throws IOException
IOException
private void processEvents()