# davidjavilabs/p3_corba architecture

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

- Interactive diagram: https://gitdiagram.com/davidjavilabs/p3_corba
- Repository: https://github.com/davidjavilabs/p3_corba

## Overview

##### Main Components
- Bibliotec.idl – The interface definition file that specifies the CORBA interfaces (the contract) for the library services.
- ServidorBiblioteca – The CORBA server implementation that registers its services with the naming service and implements the methods defined in the IDL.
- ClienteBiblioteca – The client application that acts as a consumer of the CORBA services offered by ServidorBiblioteca.
- ORB and Naming Service – The CORBA runtime used; “tnameserv” is used as the naming service to enable the client to locate the server.

##### Relationships and Interactions
- The IDL file acts as the central contract that ties the implementations (server) and consumers (clients) together.
- The ServidorBiblioteca registers its CORBA object with the naming service (provided by “tnameserv”) which acts as a directory.
- The ClienteBiblioteca uses the ORB to access the naming service, fetch the reference to the remote CORBA object, and then invokes library management methods.
- Data flows from the client to the naming service (for lookup), then to the server and back to the client.

##### Architectural Patterns and Design Principles
- There is a clear separation of concerns: the client is solely responsible for user interactions and method invocations, while the server encapsulates the business logic and state (such as tracking book popularity or rental history).
- The use of CORBA implies a distributed object architecture where the interface abstraction (IDL) decouples the client from the server implementation.
- The design leverages decoupling through middleware (ORB and naming service) which abstracts the network details.

##### Relevant Technologies
- Java (version 8) for implementation.
- CORBA for distributed object communication.
- The IDL compiler “idlj” is used for generating Java bindings from the IDL definitions.
- “tnameserv” as the CORBA naming service to aid in object lookup.

## Diagram (Mermaid)

```mermaid
graph TD
    bib["Biblioteca.idl"]:::idl

    subgraph "Client Side"
        direction TB
        cli["ClienteBiblioteca"]:::client
        orbC["ORB (Client)"]:::corba
    end

    subgraph "CORBA Infrastructure"
        direction TB
        ns["tnameserv (Naming Service)"]:::corba
    end

    subgraph "Server Side"
        direction TB
        orbS["ORB (Server)"]:::corba
        serv["ServidorBiblioteca"]:::server
    end

    bib -->|"defines_interface"| serv
    bib -->|"defines_interface"| cli
    cli -->|"invoke_CORBA_lookup"| orbC
    orbC -->|"lookup_remote_object"| ns
    ns -->|"resolve_registration"| orbS
    orbS -->|"invoke_method"| serv
    serv -->|"register_service"| ns

    click bib "https://github.com/davidjavilabs/p3_corba/blob/main/Biblioteca.idl"
    click serv "https://github.com/davidjavilabs/p3_corba/blob/main/ServidorBiblioteca.java"
    click cli "https://github.com/davidjavilabs/p3_corba/blob/main/ClienteBiblioteca.java"

    classDef idl fill:#ffdd00,stroke:#333,stroke-width:2px;
    classDef client fill:#aaffaa,stroke:#333,stroke-width:2px;
    classDef server fill:#ffcc99,stroke:#333,stroke-width:2px;
    classDef corba fill:#bbdfff,stroke:#333,stroke-width:2px;
```
