This project came about when I needed a tool to run unit tests whenever I changed production code in a local development environment. There are other uses cases for the application listed here .
A Java 8 (or better) Runtime Environment is required to run this application.
The demos have the following dependencies.
The main logic of this application is in the DirectoryWatcher class.
It uses a java.util.Timer instance and java.util.TimerTask instances to schedule system commands for execution.
Once a change is detected the code calls the DirctoryWatcher#processModification() method to determine if the changed file's type is configured to actually process the file. The configuration parameters are set in a user specified the properties file (or command line arguments).
For lower level details of the built-in Java NIO APIs used in this project, see the 'Resources' section for links to sample code provided by Oracle .
The issue 'java -jar onebeartoe-filesystem-cli-watcher-cli-jar-with-dependencies.jar '
This invocation is missing parameters, and prints a usage message. A more convenient way to use the application is with a properties file and shell script to invoke the application. This other option is reviewed next.
See the properties file linked above and this bash script to optionally run the application with a configuration saved to disk for reuse.
The main goal of this tool is watch the filesytem for changes. Using it involves configuring what file you want to watch and then verifying the command(s) execute (after any configured quiet period) in the terminal window, when a file is actually changed.
To exit the application, hit Ctrl-Z at the terminal.
Here are some ideas to take this application further.
Sat Oct 10 13:39:16 MDT 2020
Mon Oct 26 22:18:16 MDT 2020