Skip to content

2.2 Service 7 Person Architecture Java 2

Tran Anh Hoang edited this page Aug 7, 2022 · 4 revisions

Basically the Person Service Architecture of is structered in 5 Layers:

Java_2_Final

@created by Tran Anh Hoang

API- Layer

The API- Layer is the first tier layer, which include the Entry- and Endpoints of the RESTful Jetty Server. This layer will be used to access Data whithout knowing about the underlaying Layers and Classes.

Repository-Interface-Layer

The Repository-Interface-Layer is an abtraction layer. The goal is to create a contract between the API-Layer and the Repository-Layer, so the API-Layer still know the methods of the Repository-Layer but not the implementation.

Repository-Layer

Repository-Layer represent the implementation of the Repository-Interface-Layer and is also an abstraction layer between JPA-Layer and Repository-Layer. This Layer can be sepereted in 2 smaller Layer, but for the clarity and understanding, we merged those 2 layer together. In this layer there are the business logic of the Repository-Interface-Layer and it can access Data from the JPA-Layer but not knowing the implementation of the JPA-Layer.

Model

The Model Layer includes all the classes for the mapping of the database-entity. It also has a DataProvides class, which create some test instances of the model-classes and persist it in the database.

JPA-Layer + Database-Layer

The JPA-Layer is the deepest level of the project. In this layer there are JpaPersonDao, JpaGenricDao, JpaPersonAvatarDaos all those 3 classes are using EntityManager to access the database, read and write data in the tables.