Skip to content

Estructura del proyecto

Andres Sepulveda edited this page Jun 3, 2024 · 1 revision

Arquitectura de la Aplicación

La aplicación sigue una arquitectura de CQRS y usa PostgreSQL y Redis para la gestión de datos. A continuación se detallan los componentes principales:

Diagrama de la Arquitectura

 ┣ .mvn
 ┃ ┗ wrapper
 ┃ ┃ ┣ maven-wrapper.jar
 ┃ ┃ ┗ maven-wrapper.properties
 ┣ src
 ┃ ┣ main
 ┃ ┃ ┣ java
 ┃ ┃ ┃ ┗ cl
 ┃ ┃ ┃ ┃ ┗ playground
 ┃ ┃ ┃ ┃ ┃ ┗ triggersapp
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ commands
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ CreateProductCommand.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ DeleteProductCommand.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ UpdateProductCommand.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ database
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ DatabaseConnection.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ RedisConnection.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ entities
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ Product.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ Quotation.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ QuotationItem.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ Usuario.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ events
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ ProductCreatedEvent.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ handlers
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ ProductCommandHandler.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ ProductQueryHandler.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┗ servlets
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ HelloServlet.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ ProductCommandServlet.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ ProductServlet.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ QuotationServlet.java
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ UsuarioServlet.java
 ┃ ┃ ┣ resources
 ┃ ┃ ┃ ┗ application.properties
 ┃ ┃ ┗ webapp
 ┃ ┃ ┃ ┣ WEB-INF
 ┃ ┃ ┃ ┃ ┗ web.xml
 ┃ ┃ ┃ ┣ index.jsp
 ┃ ┃ ┃ ┣ listadoCotizaciones.jsp
 ┃ ┃ ┃ ┣ listadoProductos.jsp
 ┃ ┃ ┃ ┗ mostrarUsuarios.jsp
 ┃ ┗ test
 ┃ ┃ ┣ java
 ┃ ┃ ┗ resources
 ┣ target
 ┃ ┣ ROOT
 ┃ ┃ ┣ META-INF
 ┃ ┃ ┣ WEB-INF
 ┃ ┃ ┃ ┣ classes
 ┃ ┃ ┃ ┃ ┣ cl
 ┃ ┃ ┃ ┃ ┃ ┗ playground
 ┃ ┃ ┃ ┃ ┃ ┃ ┗ triggersapp
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ commands
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ CreateProductCommand.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ DeleteProductCommand.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ UpdateProductCommand.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ database
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ DatabaseConnection.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ RedisConnection.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ entities
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ Product.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ Quotation.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ QuotationItem.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ Usuario.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ events
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ ProductCreatedEvent.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ handlers
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ ProductCommandHandler.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ ProductQueryHandler.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ queries
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ QueryHandler.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ servlets
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ HelloServlet.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ ProductCommandServlet.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ ProductServlet.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ QuotationServlet.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ UsuarioServlet.class
 ┃ ┃ ┃ ┃ ┗ application.properties
 ┃ ┃ ┃ ┣ lib
 ┃ ┃ ┃ ┃ ┣ checker-qual-3.5.0.jar
 ┃ ┃ ┃ ┃ ┣ commons-pool2-2.6.2.jar
 ┃ ┃ ┃ ┃ ┣ jedis-3.5.2.jar
 ┃ ┃ ┃ ┃ ┣ postgresql-42.2.20.jar
 ┃ ┃ ┃ ┃ ┗ slf4j-api-1.7.30.jar
 ┃ ┃ ┃ ┗ web.xml
 ┃ ┃ ┣ index.jsp
 ┃ ┃ ┣ listadoCotizaciones.jsp
 ┃ ┃ ┣ listadoProductos.jsp
 ┃ ┃ ┗ mostrarUsuarios.jsp
 ┃ ┣ classes
 ┃ ┃ ┣ cl
 ┃ ┃ ┃ ┗ playground
 ┃ ┃ ┃ ┃ ┗ triggersapp
 ┃ ┃ ┃ ┃ ┃ ┣ commands
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ CreateProductCommand.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ DeleteProductCommand.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┗ UpdateProductCommand.class
 ┃ ┃ ┃ ┃ ┃ ┣ database
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ DatabaseConnection.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┗ RedisConnection.class
 ┃ ┃ ┃ ┃ ┃ ┣ entities
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ Product.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ Quotation.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ QuotationItem.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┗ Usuario.class
 ┃ ┃ ┃ ┃ ┃ ┣ events
 ┃ ┃ ┃ ┃ ┃ ┃ ┗ ProductCreatedEvent.class
 ┃ ┃ ┃ ┃ ┃ ┣ handlers
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ ProductCommandHandler.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┗ ProductQueryHandler.class
 ┃ ┃ ┃ ┃ ┃ ┗ servlets
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ HelloServlet.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ ProductCommandServlet.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ ProductServlet.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┣ QuotationServlet.class
 ┃ ┃ ┃ ┃ ┃ ┃ ┗ UsuarioServlet.class
 ┃ ┃ ┗ application.properties
 ┃ ┣ generated-sources
 ┃ ┃ ┗ annotations
 ┃ ┣ generated-test-sources
 ┃ ┃ ┗ test-annotations
 ┃ ┣ maven-archiver
 ┃ ┃ ┗ pom.properties
 ┃ ┣ maven-status
 ┃ ┃ ┗ maven-compiler-plugin
 ┃ ┃ ┃ ┣ compile
 ┃ ┃ ┃ ┃ ┗ default-compile
 ┃ ┃ ┃ ┃ ┃ ┣ createdFiles.lst
 ┃ ┃ ┃ ┃ ┃ ┗ inputFiles.lst
 ┃ ┃ ┃ ┗ testCompile
 ┃ ┃ ┃ ┃ ┗ default-testCompile
 ┃ ┃ ┃ ┃ ┃ ┣ createdFiles.lst
 ┃ ┃ ┃ ┃ ┃ ┗ inputFiles.lst
 ┃ ┣ test-classes
 ┃ ┗ ROOT.war
 ┣ .gitignore
 ┣ Dockerfile
 ┣ docker-compose.yml
 ┣ init.sql
 ┣ mvnw
 ┣ mvnw.cmd
 ┗ pom.xml

Componentes Principales

  • Servicios REST: Implementados usando servlets.
  • Manejo de Comandos: Utiliza handlers para los comandos.
  • Consultas: Utiliza handlers para las consultas.
  • Base de Datos: PostgreSQL como base de datos principal.
  • Cache: Redis para almacenamiento en caché y publicación de eventos.