# covesa/capicxx-wamp-tools architecture

> Architecture diagram of the GitHub repository covesa/capicxx-wamp-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/covesa/capicxx-wamp-tools
- Repository: https://github.com/covesa/capicxx-wamp-tools

## Overview

##### Project type and purpose
- This is an extensible “code‐generation tool” project for CommonAPI WAMP bindings.
- It provides:
- A Java/Xtend core library that reads Franca IDL (​.fidl​) files and generates WAMP binding code.
- A standalone CLI (jar) for headless code generation.
- An Eclipse-based UI plugin to invoke generation from the IDE.
- Example projects (C++ server + JS client) and an automated test suite.
- Eclipse feature/update-site and target-platform modules for distribution.

##### File structure
Top-level Maven/Eclipse modules:
- org.genivi.commonapi.wamp            ← core generator library (Xtend+Java)
- org.genivi.commonapi.wamp.cli        ← standalone CLI front-end (Java)
- org.genivi.commonapi.wamp.ui         ← Eclipse plugin front-end
- org.genivi.commonapi.wamp.examples   ← sample Franca models + generated C++/JS code + crossbar scripts
- org.genivi.commonapi.wamp.tests      ← unit tests (Java/Xtend), Mocha tests, C++ runtime tests
- org.genivi.commonapi.wamp.feature    ← Eclipse feature descriptor
- org.genivi.commonapi.wamp.updatesite← update site packaging + scripts
- org.genivi.commonapi.wamp.releng     ← release-engineering scripts/config
- org.genivi.commonapi.wamp.target     ← Eclipse target platform definitions

##### README
- Confirms that the core is a code generator for CommonAPI WAMP.
- Outlines the CLI usage, command-line options, and notes a separate C++ runtime library dependency.
- Mentions an experimental JS generator integrated into Franca IDE (Franca 13+).

##### Main components & their relationships
A. Franca IDL Input
→ fed into the core generator library (org.genivi.commonapi.wamp).

B. Front-ends:
1. CLI module
- Depends on the core library.
- Packs as “org.genivi.commonapi.wamp.cli-<version>.jar”.
- Exposes command-line flags (-f, -d, -np, etc.).

2. Eclipse UI plugin
- Dependent on core library.
- Contributes menu item in Franca sub-menu (“Generate JS code for Autobahn-binding”).
- Reads workspace .fidl files and invokes the same generator modules.

C. Core generator library (generator modules)
- Contains Xtend generators for:
– Proxy code
– Stub adapter code
– Types support
– Deployment specs
– Automake/CMake helper scripts
- Preference & validation classes for configurable generation parameters.
- Verification & model-builder utilities.

D. Outputs
- C++ code (stub, proxy, types, deployment spec)
- JS client proxy + example blueprint files
- Generated code lands in configurable dest folders (common, proxy, stub, subdirs).

E. External dependencies
- Franca IDL (input format)
- capicxx-wamp-runtime (C++ runtime library)
- Node.js + Autobahn|JS (for generated JS clients & Mocha tests)
- Crossbar router (for WAMP transport in examples/tests)
- CMake build system (for C++ server examples & tests)

F. Examples & tests
- org.genivi.commonapi.wamp.examples:
– Several testcases (example10, example12, etc.) with .fidl models
– CMakeLists, client index.html + server .cpp/.hpp stubs
– workdir scripts (runServer.sh, runRESTClient.sh) + crossbar config.
- org.genivi.commonapi.wamp.tests:
– Java/Xtend unit tests for generator correctness
– Mocha tests driving a real WAMP router + generated code
– Reference C++ deployment adapters for verification

G. Distribution & release
- Feature, updatesite, releng, target modules to assemble an Eclipse update site & target platform.

##### Architectural patterns & design principles
- Modular, plugin-based architecture (Maven multimodule).
- Clear “front-ends vs. core” separation: both CLI and UI invoke the same generator code.
- Generator logic implemented in Xtend (meta-programming) with dependency injection (Guice modules).
- Test-driven: unit tests (Xtend/Java), integration tests (Mocha + C++).
- Example-driven documentation & verification.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Input
    FrancaIDL["Franca IDL\n(.fidl)"]:::external

    %% Front-ends
    subgraph "Front-ends"
        direction TB
        CLI["CLI Front-end\n(org.genivi.commonapi.wamp.cli)"]:::javaModule
        UI["Eclipse UI Plugin\n(org.genivi.commonapi.wamp.ui)"]:::javaModule
    end

    %% Core Library
    subgraph "Core Generator Library"
        direction TB
        CoreGen["Core Generator Library\n(org.genivi.commonapi.wamp)"]:::javaModule
        subgraph Generators
            direction TB
            GenXtend["Xtend Generators\n/src/.../generator"]:::javaModule
            DeploySpec["Deployment Spec\n/src/.../deployment"]:::javaModule
            Preferences["Preferences & Validation\n/src/.../preferences & verification"]:::javaModule
            Standalone["Standalone Setup\nWampGeneratorFrancaStandaloneSetup.java\nWampGeneratorModule.java"]:::javaModule
        end
    end

    %% Outputs
    subgraph "Generated Outputs"
        direction TB
        CPPCode["C++ Code\n(stub, proxy, types)"]:::generated
        JSCode["JS Client Proxy\n& examples"]:::generated
    end

    %% External Dependencies
    subgraph "External Dependencies"
        direction TB
        Capix["capicxx-wamp-runtime\n(C++)"]:::external
        NodeJS["Node.js & Autobahn|JS"]:::external
        Crossbar["Crossbar Router"]:::external
        CMake["CMake Build System"]:::external
    end

    %% Examples & Tests
    subgraph "Examples & Tests"
        direction TB
        Examples["Example Projects\n(org.genivi.commonapi.wamp.examples)"]:::tests
        Tests["Automated Test Suite\n(org.genivi.commonapi.wamp.tests)"]:::tests
    end

    %% Distribution
    subgraph "Distribution Modules"
        direction TB
        Feature["Eclipse Feature\n(org.genivi.commonapi.wamp.feature)"]:::distribution
        UpdateSite["Update-site Packaging\n(org.genivi.commonapi.wamp.updatesite)"]:::distribution
        Releng["Release Engineering\n(org.genivi.commonapi.wamp.releng)"]:::distribution
        Target["Target Platform\n(org.genivi.commonapi.wamp.target)"]:::distribution
    end

    %% README & Metadata
    README["Project README & Metadata\n(README.md, LICENSE, CI)"]:::external

    %% Relationships
    FrancaIDL -->|"parses"| CoreGen
    CLI -->|"invokes"| CoreGen
    UI -->|"invokes"| CoreGen
    CoreGen -->|"generates"| CPPCode
    CoreGen -->|"generates"| JSCode
    CPPCode -->|"build with"| CMake
    JSCode -->|"tests with"| NodeJS
    JSCode -->|"routes via"| Crossbar
    Examples -->|"use models & scripts"| CoreGen
    Examples -->|"run with"| CMake
    Tests -->|"validate outputs"| CPPCode
    Tests -->|"validate outputs"| JSCode
    Feature -->|"bundles"| UI
    Feature -->|"includes"| CoreGen
    UpdateSite -->|"packages"| Feature
    Releng -->|"scripts"| UpdateSite
    Target -->|"defines platform"| UI

    README -->|"documents"| CLI
    README -->|"documents"| UI
    README -->|"documents"| CoreGen

    %% Click Events
    click GenXtend "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp/src/org/genivi/commonapi/wamp/generator"
    click DeploySpec "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp/src/org/genivi/commonapi/wamp/deployment"
    click Preferences "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp/src/org/genivi/commonapi/wamp/preferences"
    click Preferences "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp/src/org/genivi/commonapi/wamp/verification"
    click Standalone "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp/src/org/genivi/commonapi/wamp/WampGeneratorFrancaStandaloneSetup.java"
    click Standalone "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp/src/org/genivi/commonapi/wamp/WampGeneratorModule.java"
    click CLI "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.cli/src/org/genivi/commonapi/wamp/cli/WampGeneratorCommandLineTool.java"
    click UI "https://github.com/covesa/capicxx-wamp-tools/blob/master/org/genivi/commonapi/wamp/ui/CommonApiWampUiPlugin.java"
    click UI "https://github.com/covesa/capicxx-wamp-tools/blob/master/org/genivi/commonapi/wamp/ui/handler/WampGenerationCommand.java"
    click UI "https://github.com/covesa/capicxx-wamp-tools/blob/master/org/genivi/commonapi/wamp/ui/preferences/CommonAPIWampPreferencePage.java"
    click UI "https://github.com/covesa/capicxx-wamp-tools/blob/master/org/genivi/commonapi/wamp/ui/preferences/PreferenceInitializerWamp.java"
    click Examples "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp.examples/models"
    click Examples "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp.examples/src"
    click Examples "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp.examples/workdir"
    click Tests "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp.tests/src/org/genivi/commonapi/wamp/tests"
    click Tests "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp.tests/mochatest"
    click Tests "https://github.com/covesa/capicxx-wamp-tools/tree/master/org.genivi.commonapi.wamp.tests/src/refcode"
    click Feature "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.feature/feature.xml"
    click Feature "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.feature/feature.properties"
    click UpdateSite "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.updatesite/siteTemplate/index.html"
    click UpdateSite "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.updatesite/category.xml"
    click UpdateSite "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.updatesite/scripts/create_file_index.sh"
    click UpdateSite "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.updatesite/scripts/deploy_site.sh"
    click Releng "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.releng/pom.xml"
    click Target "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.target/commonapi_wamp-luna.target"
    click Target "https://github.com/covesa/capicxx-wamp-tools/blob/master/org.genivi.commonapi.wamp.target/commonapi_wamp-oxygen.target"
    click README "https://github.com/covesa/capicxx-wamp-tools/blob/master/README.md"

    %% Styles
    classDef javaModule fill:#ddeeff,stroke:#333,stroke-width:1px
    classDef generated fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef external fill:#ffddcc,stroke:#333,stroke-width:1px
    classDef tests fill:#eeeeee,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef distribution fill:#fff0b3,stroke:#333,stroke-width:1px
```
