How kenny516/ticket-vol works
Main Components
• Frontend (View Layer):
• Contains JSP pages under /src/main/webapp, with separate directories for "front-office" (user interface) and "back-office" (admin interface).
• Includes static assets (CSS, JavaScript) and JSP error pages.
• Backend:
• Controllers: Classes in the com/mg/controller package handle incoming HTTP requests using custom annotations (@Controller, @Get, @Post, @Url). The separation into back-office and front-office controllers is evident.
• Services: Business logic is encapsulated in the com/mg/service package, supporting various operations such as reservations, promotion handling, and flight (vol) management.
• Data Access Layer: DAO classes in the com/mg/dao package manage CRUD operations and repository interactions (with PostgreSQL via Hibernate).
• Models/DTOs: Domain entity classes are in com/mg/model for persistence and in com/mg/DTO for data transfer across layers.
• Filters: An authentication filter in com/mg/filter ensures role-based and session-based authentication.
• Persistence and Database:
• Hibernate configuration files (hibernate.cfg.xml and persistence.xml) and SQL scripts (data.sql, script.sql) in src/main/resources define the ORM settings and schema.
• A PostgreSQL database is used, consistent with the README guidance.
• Custom Framework:
• The lib/Framework.jar implements core features like routing, controller management, session handling, and view resolution, forming the backbone of the custom MVC framework.
Relationships and Interactions
• Client Browsers make HTTP requests that reach the web server (e.g., Tomcat) hosting the application.
• The request passes through the servlet container and any configured filters (AuthenticationFilter) to enforce security.
• Requests are routed by the custom framework to appropriate @Controller classes based on URL mappings (@Url annotations).
• Controllers interact with the Service layer to process business logic and then use DAO classes to perform database operations using Hibernate.
• Results are converted into a ModelAndView object directing the framework to the correct JSP view for rendering.
• The CustomSession and role-based authentication logic ensure stateful interactions.
Architectural Patterns and Design Principles
• MVC Pattern: Clearly segregates responsibilities among views, controllers, and models.
• Layered Architecture: Separates concerns (presentation, business logic, data access).
• Custom Annotation-based Routing: Simplifies HTTP method mapping and parameter binding.
• Session and Role-based Security: Incorporated via custom authentication annotations and session utilities.
• Dependency Management: Maven (pom.xml) is used for dependency injection and build processes.
Relevant Technologies, Frameworks, and Libraries
• Java (Custom lightweight framework)
• Jakarta Servlet API (for HTTP requests/response handling)
• Hibernate ORM for database interaction
• PostgreSQL (database)
• GSON (for potential JSON processing)
• JSP for view rendering, enhanced by Bootstrap and DataTables for presentation
Detail and Clarity
• The goal is to provide a comprehensive view that could be used to understand, maintain, or extend the system.