How raindrops-x/jakartadrops works
Main Components
• Web/PRESENTATION Layer:
• Views are implemented using JSPs located under src/main/webapp (e.g., index.jsp, carrito.jsp, and the layout fragments like navbar.jsp and footer.jsp).
• This layer presents the user interface that interacts with the system.
• CONTROLLER Layer:
• Servlets implemented in packages such as com.rain.jdee.controller (sub-packages for carro, celular, marca, usuario).
• These act as the entry points handling HTTP requests, processing them, and routing data appropriately.
• SERVICE Layer (Business Logic):
• Classes in the com.rain.jdee.service package (e.g., ServiceLogin, ServicioProductoImp).
• This layer encapsulates business rules and operations, mediating between controllers and repositories.
• REPOSITORY Layer (Data Access Layer):
• Found in com.rain.jdee.repository with interfaces and their implementations (e.g., RepositorioCelularImp, RepositorioMarcaImp, LoginRepositoryImp).
• Implements the repository pattern and abstracts direct database interactions.
• MODEL Domain:
• Domain objects (Carro, Celular, Marca, Usuario, etc.) present in com.rain.jdee.model.
• These represent the core data structures manipulated throughout the application.
• UTILITY & INFRASTRUCTURE:
• Utility classes (e.g., ConexionDb, LoginUtil) support cross-cutting concerns such as database connectivity.
• Filters (FiltroConexion, FiltroLogin) and Listeners (CarroListener) manage session control, connection management, and initialization tasks.
• DEPLOYMENT/CONFIGURATION:
• Configuration files such as pom.xml, web.xml, and context.xml, which dictate build, deployment, and runtime container configurations (Tomcat, MySQL connections).
Out Relationships and Interactions
• Incoming Client Requests:
• A browser or HTTP client interacting with JSP pages and forms.
• Controller to Service Interaction:
• For each HTTP request, the appropriate Servlet calls into the Service layer to process business logic.
• Service to Repository Communication:
• The Service layer, applying business rules, calls Repository implementations for CRUD operations with the database.
• To highlight the dependency inversion and the use of dependency injection practices.
• Repository to Database:
• Repository classes use utility components (i.e., ConexionDb) to interact with the underlying MySQL database.
• This bi-directional relationship can be shown via database connectors.
• Filters and Listeners:
• That Filters (FiltroConexion, FiltroLogin) intercept requests to enforce authentication and manage database connection scope.
• The Listener (CarroListener) indicates event-based behavior, such as initialization of the shopping cart session.
Architectural Patterns and Principles
• Layered Architecture:
• Clearly delineate the separation between Presentation, Controller, Service, and Data Access layers.
• Repository Pattern:
• Repositories that abstract the persistence, showcasing the inversion of control and dependency injection.
• MVC-Like Flow:
• Even though it is not a full MVC (since views are JSPs), the flow from a client request through a servlet (Controller), to service processing and then to data persistence is evident.
• Dependency Management:
• Use of Maven (pom.xml) and the Jakarta EE platform, alongside practices like dependency injection.