# chkal/krazo architecture

> Architecture diagram of the GitHub repository chkal/krazo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chkal/krazo
- Repository: https://github.com/chkal/krazo

## Overview

##### Main Components

a) Core MVC Components:
- Controllers Layer (org.eclipse.krazo.core)
- View Engines (org.eclipse.krazo.engine)
- Model Management (org.eclipse.krazo.core.ModelsImpl)
- Binding System (org.eclipse.krazo.binding)

b) Integration Components:
- Jersey Integration (jersey/)
- RESTEasy Integration (resteasy/)
- JAX-RS Integration (org.eclipse.krazo.jaxrs)

c) Security Components:
- CSRF Protection (org.eclipse.krazo.security)
- Form Validation (org.eclipse.krazo.binding.validate)

d) Infrastructure:
- CDI Integration (org.eclipse.krazo.cdi)
- Bootstrap System (org.eclipse.krazo.bootstrap)
- Lifecycle Management (org.eclipse.krazo.lifecycle)

##### Relationships and Data Flow

**[HTTP Request] → [JAX-RS Layer] → [Krazo Core] → [Controller] → [View Engine] → [HTTP Response]**
- ↕               ↕               ↕
- [Security Layer]  [CDI Layer]    [Model Layer]

##### Specific Implementation Details

a) Request Processing Pipeline:
**PreMatchingRequestFilter → PostMatchingRequestFilter → Controller → ViewResponseFilter → ViewableWriter**

b) View Resolution Chain:
**ViewEngineBase → ViewEngineFinder → Specific View Engine (JSP/Facelets)**

##### Component Relationships

- How the binding system connects to controllers
- How view engines interact with the core
- How security filters integrate into the request pipeline
- How CDI manages component lifecycle

##### Integration Points

Integration with:
- Jakarta RESTful Web Services
- CDI (Context and Dependency Injection)
- Bean Validation
- Different view technologies (JSP, Facelets)

##### Cross-Cutting Concerns

How these aspects span multiple components:
- Security (CSRF, validation)
- Locale handling
- Event system
- Configuration management

**[Client Layer]**
- ↓
**[Integration Layer (Jersey/RESTEasy)]**
- ↓
**[Core MVC Layer]**
- ↓
**[Infrastructure Layer]**

- Component types
- Integration points

Keep the abstraction level high enough to show the overall architecture while including enough detail to understand the component interactions and system boundaries.

- How requests flow through the system
- Where to add new features
- How components interact
- Integration points with external systems
- Security boundaries and implementation

Remember to include version information and any specific server compatibility notes (WildFly, Glassfish, Liberty) as mentioned in the README.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef core fill:#b3d1ff,stroke:#333
    classDef integration fill:#90EE90,stroke:#333
    classDef security fill:#ffb3b3,stroke:#333
    classDef infrastructure fill:#fff2b3,stroke:#333
    classDef external fill:#e6e6e6,stroke:#333

    %% Client Layer
    Client[Client Request]:::external

    %% Integration Layer
    subgraph IntegrationLayer["Integration Layer"]
        Jersey["Jersey Integration"]:::integration
        RESTEasy["RESTEasy Integration"]:::integration
        JAXRS["JAX-RS Integration"]:::integration
    end

    %% Security Layer
    subgraph SecurityLayer["Security Layer"]
        CSRF["CSRF Protection"]:::security
        FormValidation["Form Validation"]:::security
    end

    %% Core MVC Layer
    subgraph CoreLayer["Core MVC Layer"]
        Controllers["Controllers Layer"]:::core
        ViewEngines["View Engines"]:::core
        ModelMgmt["Model Management"]:::core
        BindingSystem["Binding System"]:::core
    end

    %% Infrastructure Layer
    subgraph InfraLayer["Infrastructure Layer"]
        CDI["CDI Integration"]:::infrastructure
        Bootstrap["Bootstrap System"]:::infrastructure
        Lifecycle["Lifecycle Management"]:::infrastructure
        EventSystem["Event System"]:::infrastructure
        LocaleHandler["Locale Handler"]:::infrastructure
        URIMgmt["URI Management"]:::infrastructure
        FormProc["Forms Processing"]:::infrastructure
    end

    %% Relationships
    Client --> Jersey & RESTEasy
    Jersey & RESTEasy --> JAXRS
    JAXRS --> CSRF
    CSRF --> Controllers
    Controllers --> ViewEngines
    Controllers --> ModelMgmt
    FormValidation --> BindingSystem
    BindingSystem --> Controllers
    CDI --> Controllers
    Bootstrap --> JAXRS
    Lifecycle --> Controllers
    EventSystem --> CoreLayer
    LocaleHandler --> CoreLayer
    URIMgmt --> CoreLayer
    FormProc --> BindingSystem

    %% Click events for component mapping
    click Controllers "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/core/"
    click ViewEngines "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/engine/"
    click ModelMgmt "https://github.com/chkal/krazo/blob/master/core/src/main/java/org/eclipse/krazo/core/ModelsImpl.java"
    click BindingSystem "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/binding/"
    click Jersey "https://github.com/chkal/krazo/tree/master/jersey/src/main/java/org/eclipse/krazo/jersey/"
    click RESTEasy "https://github.com/chkal/krazo/tree/master/resteasy/src/main/java/org/eclipse/krazo/resteasy/"
    click JAXRS "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/jaxrs/"
    click CSRF "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/security/"
    click FormValidation "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/binding/validate/"
    click CDI "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/cdi/"
    click Bootstrap "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/bootstrap/"
    click Lifecycle "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/lifecycle/"
    click EventSystem "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/event/"
    click LocaleHandler "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/locale/"
    click URIMgmt "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/uri/"
    click FormProc "https://github.com/chkal/krazo/tree/master/core/src/main/java/org/eclipse/krazo/forms/"

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Integration Components]:::integration
        L3[Security Components]:::security
        L4[Infrastructure Components]:::infrastructure
        L5[External Systems]:::external
    end
```
