How mohamedmoustir/gestion-de-banque-de-sang works
Project type and purpose
• This is a monolithic Java EE web application (“Système de Gestion de Banque de Sang”) deployed on Apache Tomcat.
• Purpose: manage donors and receivers of blood, perform intelligent matching based on blood‐group compatibility and medical priority.
File structure
• Top-level artifacts: pom.xml (Maven), README.md, Tomcat conf and logs folders.
• src/main/java packages the 4 layers:
• presentation (Servlet controllers + SessionUtils)
• application (DTOs, mappers, AppService classes)
• domain (entities, enums, DAO interfaces, domain services, exceptions)
• infrastructure (DAO implementations + BaseDao, JPA/EntityManagerFactory singleton)
• src/main/resources/META-INF/persistence.xml: JPA config
• src/main/webapp: JSP views under presentation/views, static assets (CSS/JS/img), web.xml for servlet mappings
• src/test/java: JUnit tests for application services
README for architecture clues
• Confirms MVC pattern:
• Model = domain entities + JPA
• View = JSP + JSTL
• Controller = Servlets
• Service Layer and Repository (DAO) patterns
• Singleton used for EntityManagerFactory
Main components and interactions
a. Client Browser
• Sends HTTP requests (login, CRUD, match requests)
b. Web Server / Container (Tomcat)
• web.xml configures URL → Servlet mappings
• Servlets in presentation/controller handle requests
• SessionUtils manages user session
c. Presentation Layer
• Controllers call Application Layer services
• JSP pages render views with JSTL
d. Application Layer
• AppService classes orchestrate use cases (DonneurAppService, OperationAppService, etc.)
• Between DTOs and Domain Entities via Mappers
e. Domain Layer
• Domain Services implement business rules (DonneurService, LoginService…)
• DAO interfaces define data access contract (GenericDao, OperationDao, etc.)
• Entities (Account, Donneur, Receveur, Operation) + enums + exceptions
f. Infrastructure Layer
• DAO Implementations (DonneurDaoImpl, OperationDaoImpl…) using JPA/Hibernate
• Basedao / EntityManagerFactory singleton
g. Persistence / Database
• MySQL/PostgreSQL
• JPA persistence-unit configured in persistence.xml
h. Build & Deployment
• Maven builds WAR
• Optionally Docker container wrapping Tomcat
i. Testing
• JUnit tests invoking Application Services
• Browser → HTTP request → Tomcat
• Tomcat → Servlet (Controller)
• Controller → AppService → DomainService → DAO → EntityManager → Database
• Results bubble back through each layer → JSP → HTML response to Browser
Highlighted architectural patterns
• MVC (Controllers / Views / Models)
• Service Layer between presentation and domain
• DAO / Repository pattern for persistence decoupling
• Singleton for EntityManagerFactory
• DTO/Mapper for data transfer between layers
• JPA/Hibernate ORM