This project provides a mechanism for monitoring a directory for .properties
files. When a new properties file appears, the client reads it, filters key-value pairs based on a configurable regular expression, and sends the filtered data to the server. The server then reconstructs the properties file from the received data and saves it to a directory.
- Monitors a specified directory for new
.properties
files. - Filters key-value pairs based on a regex pattern.
- Sends the filtered data to a server.
- Deletes the processed
.properties
file.
- Listens for incoming data from clients.
- Reconstructs a filtered properties file based on the received key-value pairs.
- Saves the reconstructed file to a specified directory.
- Java 17
- Maven (for building the project)
- A terminal/command line environment
Both the client and server programs use separate configuration files to specify necessary values:
monitor.directory
: Directory to monitor for new.properties
files.key.filter.regex
: Regular expression pattern to filter keys.server.address
: Server address and port to send the data to (e.g.,localhost:8080
).
output.directory
: Directory where the server will save reconstructed properties files.server.port
: Port the server should listen on for incoming client connections.
- Clone the repository or download the source code.
- Navigate to the
ClientServer
directory. - Run the following Maven command to clean and build the project:
mvn clean package
- Navigate to the target directory
- Edit the client_config.properties file with the appropriate settings for the monitored directory, key filtering pattern, and server address.
- Edit the server_config.properties file with the appropriate settings for the server port and output directory.
- Run the following commands in seperate terminals.
java -cp properties-monitor-1.0-SNAPSHOT.jar learn.test.clientserver.Client /path/to/client_config.properties java -cp properties-monitor-1.0-SNAPSHOT.jar learn.test.clientserver.Server /path/to/server_config.properties