# mateocarballo/entregable-ad-4 architecture

> Architecture diagram of the GitHub repository mateocarballo/entregable-ad-4, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mateocarballo/entregable-ad-4
- Repository: https://github.com/mateocarballo/entregable-ad-4

## Overview

- Application Entry Point – Show Main.java as the starting point.
- Database Connection Layer – Include separate components for:
- BaseX Connection (represented by ConexionBaseX.java and the BaseX drivers in the libs folder)
- MongoDB Connection (represented by ConexionMongo.java and the mongo-java-driver in the libs folder)
- Utility Components – Represent utility classes like StringResources.java to illustrate support services.
- Database Setup Scripts – Although not part of runtime, include the creacion_dbs scripts (basex.xml and mongodb.js) to emphasize the deployment and configuration layers.

- That ConexionBaseX.java sends queries (or commands) to the BaseX server (configured using basex.xml) and that ConexionMongo.java links to the MongoDB server (populated via mongodb.js).
- That the business logic (possibly within Main.java or within future service layers not explicitly shown at this stage) interacts with the Model classes representing entities, which in turn may trigger operations on one or both databases.

##### Embrace Architectural Patterns and Design Principles
- Layered Architecture – Clearly separate the presentation/interaction layer (console menu system), the business logic, and the data access layers.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Layer
    A["Main Application (Main.java)"]:::app
    U["Utilities: StringResources (StringResources.java)"]:::util
    D1["Domain Entity: User (User.java)"]:::model
    D2["Domain Entity: Videojuego (Videojuego.java)"]:::model

    %% Database Connections
    subgraph "Database Connections"
        B["BaseX Connector (ConexionBaseX.java)"]:::conn
        C["MongoDB Connector (ConexionMongo.java)"]:::conn
    end

    %% Databases
    subgraph "Databases"
        BS["BaseX Server"]:::db
        MB["MongoDB Server"]:::db
    end

    %% Setup Scripts & Driver Libraries
    subgraph "Setup & Drivers"
        F["BaseX Setup Script (basex.xml)"]:::setup
        G["MongoDB Setup Script (mongodb.js)"]:::setup
        L1["BaseX Driver: BaseX-ligera.jar"]:::drv
        L2["BaseX Driver: baseX-completa.jar"]:::drv
        M["MongoDB Driver: mongo-java-driver-3.12.14.jar"]:::drv
    end

    %% Connections between Layers
    A -->|"calls"| B
    A -->|"calls"| C
    A -->|"uses"| D1
    A -->|"uses"| D2
    A -->|"utilizes"| U

    %% Domain interactions with Database Connectors
    D1 -->|"triggers"| C
    D2 -->|"triggers"| B

    %% Connectors interacting with Databases
    B -->|"queries"| BS
    C -->|"queries"| MB

    %% Connectors using Driver Libraries
    B -->|"uses"| L1
    B -->|"uses"| L2
    C -->|"uses"| M

    %% Setup Scripts configuring Databases
    F -->|"configures"| BS
    G -->|"configures"| MB

    %% Click Events
    click A "https://github.com/mateocarballo/entregable-ad-4/blob/main/src/main/Main.java"
    click B "https://github.com/mateocarballo/entregable-ad-4/blob/main/src/conexion/ConexionBaseX.java"
    click C "https://github.com/mateocarballo/entregable-ad-4/blob/main/src/conexion/ConexionMongo.java"
    click D1 "https://github.com/mateocarballo/entregable-ad-4/blob/main/src/model/User.java"
    click D2 "https://github.com/mateocarballo/entregable-ad-4/blob/main/src/model/Videojuego.java"
    click U "https://github.com/mateocarballo/entregable-ad-4/blob/main/src/utilities/StringResources.java"
    click F "https://github.com/mateocarballo/entregable-ad-4/blob/main/creacion_dbs/basex.xml"
    click G "https://github.com/mateocarballo/entregable-ad-4/blob/main/creacion_dbs/mongodb.js"
    click L1 "https://github.com/mateocarballo/entregable-ad-4/blob/main/libs/BaseX-ligera.jar"
    click L2 "https://github.com/mateocarballo/entregable-ad-4/blob/main/libs/baseX-completa.jar"
    click M "https://github.com/mateocarballo/entregable-ad-4/blob/main/libs/mongo-java-driver-3.12.14.jar"

    %% Styles
    classDef app fill:#9fdf9f,stroke:#333,stroke-width:2px;
    classDef conn fill:#ffcc99,stroke:#333,stroke-width:2px;
    classDef db fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef model fill:#FFE4B5,stroke:#333,stroke-width:2px;
    classDef util fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef setup fill:#f2d7d5,stroke:#333,stroke-width:2px;
    classDef drv fill:#d1c4e9,stroke:#333,stroke-width:2px;
```
