This small project focuses on creating a Vehicle Inventory Management System. The goal is to build a structured dataset containing vehicle information such as make, model, year, and price. The project architecture is based on Java Spring Boot.
- JDK 21
- JDK 21 API
- ChatGPT
The Vehicle Inventory Management System is a Java-based software designed for a vehicle selling company. It serves as a centralized repository to manage and store information about cars available for sale. The system allows employees to perform various actions such as adding new cars, removing existing cars, and querying the inventory based on specific criteria.
As a client, you can:
- Look at the inventory
- Look for a specific vehicle with the search bar
As an admin, you can:
- Do what a client can
- Add, update and/or remove a vehicle
At the exit of the application, the database is saved automatically.
The JAR files retrieved and stored in the lib
folder are:
On Windows, I use the make_win.sh
script to compile and run the application. On Linux, we can use the Makefile
.
The modules (packages) are organized as follows:
com.company.inventory
: contains the main class of the applicationcom.company.inventory.dao
: contains the data access object classes interacting with the databasecom.company.inventory.model
: contains the model classes defining the data structurecom.company.inventory.ui
: contains the user interface classes handling user interface components
The application can be run using the following commands present in the make_win.sh
script (for Windows) or in the Makefile
(for Linux):
- For Makefile:
# To compile everything
make # or make all ()
# To run the application
make run
- For make_win.sh:
# To compile everything
make_win.sh
# To run the application
make_win.sh run
[DO NOT WORK] On Docker (compile before to get jar file), we can use the following commands:
# Docker compose
docker compose up
# To build the image
docker build -t vehicle-inventory-app .
# To run the container
docker run -it --rm --name vehicle-inventory-running-app vehicle-inventory-app
# To remove the image
docker rmi vehicle-inventory-app
- On the UI side, I had to look carefully at the Java Swing documentation to understand how to use the different components and how to handle events.
- I didn't know why when I clicked on the "Modify/Remove" button, the action continued to be performed on the following rows. I finally understood that ActionListener should have been specified in the constructor of the button.
- Struggled a bit with the JSON serialization/deserialization. I had to look at the Jackson documentation to understand how to use the ObjectMapper class.
- I past a long time on the updateVehicle method. Indeed, there are several cases to consider so are the different manipulations to perform.
- To see the content of a JAR file, we can use the command
jar tf <jar-file>
. - On Windows, to separate the different paths in the classpath, we use the semicolon (;) instead of the colon (:) on Linux !
- Use a database to store the data instead of a JSON file
- The authentication system is not very secure. We could use a more robust system (instead of writing the password in the code)
- Make the app work on a Docker container
# To compile everything
make # or make all
# To run the application
make run
# To run tests
make test
# To clean
make clean