DMD Kosmos is a library system that manages books across different universities, which we assume have different databases.
- Assume a scenario where one University, uses MySQL, and another university, which uses PostgreSQL, wants to have a joint digital library system.
- Both databases are used without modification.
- However, it behaves as a single system.
DMD Kosmis is written in Java, and uses MySQL and PostgreSQL. So the following software is required to run it.
- Oracle OpenJDK 20
- MySQL 8.0
- PostgreSQL 12.15
- IntelliJ IDEA (recommended)
The system configurations of DMD Kosmos are as follows.
- Web Framework
- [Spring Boot 3.1.1] (https://spring.io/projects/spring-boot)
- Transaction Manager
- Databases
- Open a terminal, go to your work directory, and clone this repository.
$ git clone https://github.com/Davide9710/dmdkosmos.git
-
Open a project in JetBrains' IntelliJ IDEA.
-
Reload a project on
pom.xml
. -
Open the command prompt in the folder src/main/resources
-
Run the command:
$ java -jar scalardb-schema-loader-3.13.0.jar --config scalardb.properties --schema-file schema.json --coordinator
, this will create the schemas -
Run
Main.java
. -
Access on http://localhost:8080/.
src/main/
-
java/com/example/test/
-
controllers/
IndexController.java
: Processing whenindex.html
is loadedBookController.java
: Processing whenindex.html
andsearch-results.html
are loaded
-
scalardb/
MyLibrary.java
: ScalarDB business logicMyLoadInitialData.java
: Load initial data into ScalarDB, for testing purpose
-
Main.java
: Spring Boot main file -
MainRunner.java
: Configuration bean used for calling the initial data loader -
WebSecurityConfig.java
: Login configurations, users added for testing purpose
-
-
resources/
static/css/
: CSStemplates
: HTMLscalardb.properties
: ScalarDB settingsschema.json
: ScalarDB schema
-
Before executing Main.java
, the user name and password for MySQL and PostgreSQL must be registered in scalardb.properties
.
- MySQL
scalar.db.multi_storage.storages.mysql.username=example_username
scalar.db.multi_storage.storages.mysql.password=example_password
- PostgreSQL
scalar.db.multi_storage.storages.postgresql.username=postgresql_username
scalar.db.multi_storage.storages.postgresql.password=postegresql_password
Login functionality is fixed, and the available users for testing purpose are loaded in this file
- Username:
davide
- Password:
davide
- login: the predifined users can login
- See reserved books : The user, on their index page, can see the books that he has reserved and he didn't return it yet. He can also see the due date of the return. Finally he can, directly from his main page, return the books he reserved.
- search books : The user can search some keywords on the search bar. The sesrch is a fulltext search on book name or book author. The found books will be displayed in the search-result page, with their availability.
- When ghe user found a book he wants to reserve, he can check the availability and, if available, book it through the nutton. After that, that book will be listed on his home page.
- In our project researving and borrowing a book are the synonim. Also book.name and book.title refers to the same attribute
- We added some end-to-end tests on the package src/test. This tests call the endpoints eith a mocked user and check the authorization to perform some operations, and the logic of reserving and returning a book
- We took inspiration from the project JJE Bank for the organization of the project but the code is almost totally developed on our own, so we argue that our project is not a further development of the JJE Bank but another project. Thus we didn't for the repository.