public class TrackingService extends Object
This stateful object contains watchService, map, substitutionContext
and fragmentDependencyMap instances.
| Modifier and Type | Field and Description |
|---|---|
private Map<Path,Set<Path>> |
fragmentDependencyMap
Key is a fragment that can be changed, and Values are dependant files which should be
generated in case of the fragment change.
|
private static org.slf4j.Logger |
logger |
private Map<WatchKey,Path> |
map
|
private SubstitutionContext |
substitutionContext
Contains the application current state.
|
private WatchService |
watchService
See the
WatchService description. |
| Constructor and Description |
|---|
TrackingService(SubstitutionContext substitutionContext) |
| Modifier and Type | Method and Description |
|---|---|
private void |
addFromRepository() |
private void |
createDir(Path path) |
private void |
deleteDir(Path path) |
private void |
deleteDirRecursively(File directoryToDelete) |
private void |
deleteFragment(Path path) |
private Set<Path> |
getChildrenFragmentTemplates(Path path) |
private boolean |
isFragment(Path path) |
private void |
processEvent(Path dir,
WatchEvent<?> event) |
private void |
processEvents() |
private void |
processFile(WatchEvent.Kind<?> kind,
Path path) |
private TrackingResult |
processWatchKey(WatchKey watchKey) |
private void |
register(Path path)
Register the given directory with the WatchService
|
private void |
registerAll(Path start)
Register the given directory, all its sub-directories and all files, with the
watchService. |
private void |
reloadFragments(Path path) |
void |
track() |
private static final org.slf4j.Logger logger
private final WatchService watchService
WatchService description.private final SubstitutionContext substitutionContext
private final Map<Path,Set<Path>> fragmentDependencyMap
public TrackingService(SubstitutionContext substitutionContext) throws IOException
IOExceptionprivate void addFromRepository()
public void track() throws IOException, InterruptedException
IOExceptionInterruptedExceptionprivate void processEvents() throws IOException, InterruptedException
IOExceptionInterruptedExceptionprivate TrackingResult processWatchKey(WatchKey watchKey) throws IOException
IOExceptionprivate void processEvent(Path dir, WatchEvent<?> event) throws IOException
IOExceptionprivate boolean isFragment(Path path)
private void processFile(WatchEvent.Kind<?> kind, Path path)
private void deleteFragment(Path path)
private Set<Path> getChildrenFragmentTemplates(Path path)
private void createDir(Path path) throws IOException
IOExceptionprivate void deleteDir(Path path) throws IOException
IOExceptionprivate void deleteDirRecursively(File directoryToDelete) throws IOException
IOExceptionprivate void registerAll(Path start) throws IOException
watchService.start - the root path for watchingIOException - in case of read or write exceptionsprivate void reloadFragments(Path path)
private void register(Path path) throws IOException
path - the directory for watchingIOException - in case of read or write exceptionsCopyright © 2023. All rights reserved.