DistributedDocDB is a Java-based client-server application designed to store, retrieve, and delete files remotely over a network. This project demonstrates key concepts of concurrent programming and TCP socket communication by allowing multiple clients to interact with the server simultaneously.
DistributedDocDB is my little experiment in making document storage simple and interactive. The server keeps all files in a dedicated data/ folder, while clients can connect and use commands like PUT or GET to save and retrieve files. The goal is to see concurrency, networking, and file management working together in a real project — and it’s still evolving with upcoming features like LIST and REPLACE to make managing files even easier.
The following commands are planned additions to improve file management. They are not yet implemented but are part of ongoing development:
- LIST: Will display all files currently stored in the server’s data/ directory. This will help users quickly see which files exist on the server.
- REPLACE <new_content>: Will replace the content of an existing file without creating a new one if it does not exist. This ensures safe updates to existing files without accidental creation of new files.
- PUT : Upload and save a file with specified content to the server.
- GET : Retrieve the content of a file from the server.
- DELETE : Remove a file from the server’s storage.
- EXIT: Close the client connection gracefully.
-
Server (
DistributedDocDBServer.java):
Listens on a TCP port, accepts client connections, processes commands, and manages file storage under thedata/directory. -
Client (
Client.java):
Provides a command-line interface to send commands to the server and display server responses. -
Supporting classes (
Task.java,WorkerThread.java):
Handle client requests and server concurrency.
- Java Development Kit (JDK) 8 or later installed
- Basic terminal/command line knowledge
-
Clone the repository:
git clone https://github.com/mihaelacoman1/DataStructureEngine cd DataStructureEngine -
Compile the Java files:
javac project/*.java -
Create the data directory to store files:
mkdir data
-
Start the server (keep this terminal open):
java project.DistributedDocDBServer
-
Open a new terminal and start the client:
java project.Client
-
Use the client commands as prompted:
PUT <filename> <content>GET <filename>DELETE <filename>EXIT
PUT test.txt HelloWorld
GET test.txt
DELETE test.txt
EXIT