# chargetimeeu/java-oca-ocpp architecture

> Architecture diagram of the GitHub repository chargetimeeu/java-oca-ocpp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chargetimeeu/java-oca-ocpp
- Repository: https://github.com/chargetimeeu/java-oca-ocpp

## Overview

1. This repository is a Java library, not an application. Its purpose is to provide reusable OCPP protocol implementations for two roles: Central System/CSMS and Charge Point/Charging Station. There is no runtime entrypoint; consumers assemble the library into their own application.

2. The architecture is split by protocol version and transport. The base OCPP 1.6 stack is in `ocpp-common`, `ocpp-json`, `ocpp-v1_6`, and `ocpp-v1_6-soap`. The newer stack is in `ocpp-v2`, which supports OCPP 2.0.1 and 2.1 with a multi-protocol design. Test and example modules sit alongside these core packages.

3. `ocpp-common` is the transport-agnostic core. It contains the main session and communication abstractions: `Client`, `Server`, `Session`, `Communicator`, `Listener`, `Transmitter`, `Receiver`, promise/repository types, and the request dispatcher/feature repository. This is the boundary where protocol logic is separated from wire encoding and socket mechanics.

4. The core data flow is event-driven and request/response oriented. Incoming wire messages are decoded by a transport layer, passed to a `Communicator`, routed through a `RequestDispatcher`, matched against a registered feature, then completed via a promise/confirmation handler. Outgoing calls travel in the opposite direction: feature code creates a request, the communicator serializes it, and the transmitter sends it over the active session.

5. `ocpp-json` provides the JSON transport implementation for OCPP 1.6. It adapts the common communicator to WebSocket-based messaging through `JSONCommunicator`, `WebSocketListener`, `WebSocketReceiver`, and `WebSocketTransmitter`. The `wss` package adds WebSocket Secure factory/socket builders, so transport security is handled at this layer rather than in the core protocol model.

6. `ocpp-v1_6` contains the OCPP 1.6 protocol surface itself: feature classes, feature profiles, request/confirmation message models, enums, validation helpers, and profile-specific event handlers. This module is the protocol domain layer; it defines what messages exist and how each OCPP 1.6 feature should behave, independent of whether the transport is JSON or SOAP.

7. The 1.6 model layer is large and strongly typed. Requests and confirmations are separated into packages such as `core`, `firmware`, `localauthlist`, `reservation`, `remotetrigger`, `securityext`, and `smartcharging`. This reflects the OCPP specification’s feature-profile decomposition and makes the API boundaries align with the spec sections.

8. `ocpp-v1_6-soap` is the SOAP transport implementation for the same 1.6 protocol. It includes SOAP-specific client/server communicators, WSDL resources, HTTP/SOAP handlers, and a timeout session decorator. This module is separate from JSON because SOAP has different message framing, endpoint handling, and request lifecycle semantics.

9. `ocpp-v2` is the newer, broader protocol branch. It introduces multi-protocol APIs (`IMultiProtocolClientAPI`, `IMultiProtocolServerAPI`), multi-protocol session and WebSocket components, and `PerMessageDeflateExtension` for WebSocket compression. It supports both OCPP 2.0.1 and 2.1 from a shared transport/runtime.

10. The v2 architecture shifts from “feature profiles” to “functions.” Under `v201` and `v21`, there are many `Feature` classes plus `Function`-style groupings and handler interfaces. This reflects the newer OCPP model, where protocol capabilities are organized around functions and messages rather than the older 1.6 profile structure.

11. The v2 model layer is even more expansive, with separate message and type hierarchies for 2.0.1 and 2.1. It contains protocol messages, enums, and rich domain types for charging, transactions, tariffs, DER control, certificates, monitoring, periodic event streams, and related capabilities. This module is where most schema-level differences between 2.0.1 and 2.1 are expressed.

12. Testing is a major architectural concern. `ocpp-v1_6-test` and `ocpp-v2-test` provide integration-style test harnesses, fake central systems/charging stations, dummy handlers, and protocol-specific specs. The tests are organized per feature and per transport, which mirrors the production module boundaries and validates both protocol logic and transport behavior.

13. The `ocpp-v1_6-example` tree contains runnable sample applications and configurations for JSON and SOAP client/server implementations. These examples are not part of the library core, but they show how consumers wire the abstractions together in a real application.

14. Build and delivery are multi-module and cross-tooling: Gradle and Maven files exist side by side, with GitHub Actions, Travis configuration, code coverage, and CodeQL scanning. That indicates the repo is maintained as a distributable library with multiple published artifacts rather than a single deployable service.

Main entry points: [`ocpp-common/src/main/java/eu/chargetime/ocpp`](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-common/src/main/java/eu/chargetime/ocpp) (Common core), [`ocpp-v2/src/main/java/eu/chargetime/ocpp`](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp) (V2 runtime), [`ocpp-json/src/main/java/eu/chargetime/ocpp`](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-json/src/main/java/eu/chargetime/ocpp) (JSON transport), [`ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature`](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature) (1.6 features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build & CI"]
  node_build_root["Gradle/Maven<br/>build system<br/>[build.gradle]"]
  node_build_maven["Parent POM<br/>build descriptor<br/>[pom.xml]"]
end

subgraph group_core16["OCPP 1.6 stack"]
  node_common_core["Common core<br/>transport-agnostic core"]
  node_common_model["Base model<br/>shared protocol model"]
  node_json_transport["JSON transport<br/>websocket transport"]
  node_soap_transport["SOAP transport"]
  node_v16_features["1.6 features<br/>protocol features"]
  node_v16_profiles["1.6 profiles<br/>profile handlers"]
  node_v16_models["1.6 messages<br/>typed protocol model"]
  node_v16_json_api["JSON clients<br/>library facade"]
end

subgraph group_v2["OCPP 2.x stack"]
  node_v2_runtime["V2 runtime<br/>multi-protocol runtime"]
  node_v2_function["Function layer<br/>capability layer"]
  node_v201_features["2.0.1 features<br/>protocol features"]
  node_v201_models["2.0.1 model<br/>protocol schema"]
  node_v21_features["2.1 features<br/>protocol features"]
  node_v21_models["2.1 model<br/>protocol schema"]
end

subgraph group_tests["Tests & examples"]
  node_v16_tests["1.6 tests<br/>integration harness"]
  node_v2_tests["V2 tests<br/>integration harness"]
  node_v16_examples["1.6 examples<br/>sample apps"]
end

node_build_root -->|"builds"| node_common_core
node_build_root -->|"builds"| node_json_transport
node_build_root -->|"builds"| node_soap_transport
node_build_root -->|"builds"| node_v2_runtime
node_build_maven -->|"publishes"| node_common_core
node_common_model -->|"supports"| node_common_core
node_common_core -->|"adapts to"| node_json_transport
node_common_core -->|"adapts to"| node_soap_transport
node_common_core -->|"routes"| node_v16_features
node_v16_features -->|"composes"| node_v16_profiles
node_v16_models -->|"defines"| node_v16_features
node_json_transport -->|"exposes"| node_v16_json_api
node_v16_json_api -->|"uses"| node_v16_features
node_v16_json_api -->|"uses"| node_json_transport
node_v16_tests -->|"verifies"| node_v16_features
node_v16_tests -->|"verifies"| node_json_transport
node_v16_tests -->|"verifies"| node_soap_transport
node_v16_examples -->|"demonstrates"| node_v16_json_api
node_v16_examples -->|"demonstrates"| node_soap_transport
node_v2_runtime -->|"orchestrates"| node_v2_function
node_v2_runtime -->|"supports"| node_v201_features
node_v2_runtime -->|"supports"| node_v21_features
node_v2_function -->|"binds"| node_v201_features
node_v2_function -->|"binds"| node_v21_features
node_v201_features -->|"uses"| node_v201_models
node_v21_features -->|"uses"| node_v21_models
node_v2_tests -->|"verifies"| node_v2_runtime
node_v2_tests -->|"verifies"| node_v201_features
node_v2_tests -->|"verifies"| node_v21_features

click node_build_root "https://github.com/chargetimeeu/java-oca-ocpp/blob/master/build.gradle"
click node_build_maven "https://github.com/chargetimeeu/java-oca-ocpp/blob/master/pom.xml"
click node_common_core "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-common/src/main/java/eu/chargetime/ocpp"
click node_common_model "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-common/src/main/java/eu/chargetime/ocpp/model"
click node_json_transport "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-json/src/main/java/eu/chargetime/ocpp"
click node_soap_transport "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6-soap/src/main/java/eu/chargetime/ocpp"
click node_v16_features "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature"
click node_v16_profiles "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile"
click node_v16_models "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model"
click node_v16_json_api "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6-json/src/main/java/eu/chargetime/ocpp"
click node_v2_runtime "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp"
click node_v2_function "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/feature/function"
click node_v201_features "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/feature"
click node_v201_models "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model"
click node_v21_features "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/v21/feature"
click node_v21_models "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/v21/model"
click node_v16_tests "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6-test/src/test/groovy/eu/chargetime/ocpp/test"
click node_v2_tests "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2-test/src/test/java/eu/chargetime/ocpp/test"
click node_v16_examples "https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6-example"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_build_root,node_build_maven toneBlue
class node_common_core,node_common_model,node_json_transport,node_soap_transport,node_v16_features,node_v16_profiles,node_v16_models,node_v16_json_api toneAmber
class node_v2_runtime,node_v2_function,node_v201_features,node_v201_models,node_v21_features,node_v21_models toneMint
class node_v16_tests,node_v2_tests,node_v16_examples toneRose
```

## Components

### Build & CI

Multi-module build, publishing, and automation

- [Gradle/Maven](https://github.com/chargetimeeu/java-oca-ocpp/blob/master/build.gradle): build system · Root build and cross-tooling for published library artifacts · `build.gradle`
- [Parent POM](https://github.com/chargetimeeu/java-oca-ocpp/blob/master/pom.xml): build descriptor · Maven aggregation and module publishing metadata · `pom.xml`

### OCPP 1.6 stack

Transport-agnostic core, 1.6 protocol model, and its transports

- [Common core](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-common/src/main/java/eu/chargetime/ocpp): transport-agnostic core · Sessions, communicators, promises, dispatching, and feature registration · `ocpp-common/src/main/java/eu/chargetime/ocpp`
- [Base model](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-common/src/main/java/eu/chargetime/ocpp/model): shared protocol model · Message abstractions and validation used by the common layer · `ocpp-common/src/main/java/eu/chargetime/ocpp/model`
- [JSON transport](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-json/src/main/java/eu/chargetime/ocpp): websocket transport · OCPP 1.6 JSON/WebSocket communicator and socket wiring · `ocpp-json/src/main/java/eu/chargetime/ocpp`
- [SOAP transport](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6-soap/src/main/java/eu/chargetime/ocpp): soap transport · OCPP 1.6 SOAP client/server, handlers, and WSDL-backed wiring · `ocpp-v1_6-soap/src/main/java/eu/chargetime/ocpp`
- [1.6 features](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature): protocol features · Feature classes for the OCPP 1.6 API surface · `ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature`
- [1.6 profiles](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile): profile handlers · Client/server profile composition and event handlers for 1.6 · `ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile`
- [1.6 messages](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model): typed protocol model · Requests, confirmations, enums, validation, and spec-aligned domain types · `ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model`
- [JSON clients](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6-json/src/main/java/eu/chargetime/ocpp): library facade · Convenience client/server entry points for JSON transport · `ocpp-v1_6-json/src/main/java/eu/chargetime/ocpp`

### OCPP 2.x stack

Shared multi-protocol runtime plus 2.0.1 and 2.1 protocol branches

- [V2 runtime](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp): multi-protocol runtime · Shared multi-protocol client/server APIs, sessions, and WebSocket helpers · `ocpp-v2/src/main/java/eu/chargetime/ocpp`
- [Function layer](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/feature/function): capability layer · Function abstractions that replace 1.6-style profiles in v2 · `ocpp-v2/src/main/java/eu/chargetime/ocpp/feature/function`
- [2.0.1 features](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/feature): protocol features · OCPP 2.0.1 feature set and function bindings · `ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/feature`
- [2.0.1 model](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model): protocol schema · 2.0.1 messages, types, enums, and rich domain objects · `ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model`
- [2.1 features](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/v21/feature): protocol features · OCPP 2.1 feature set and expanded function bindings · `ocpp-v2/src/main/java/eu/chargetime/ocpp/v21/feature`
- [2.1 model](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2/src/main/java/eu/chargetime/ocpp/v21/model): protocol schema · 2.1 messages, types, enums, and advanced energy/tariff/DER domains · `ocpp-v2/src/main/java/eu/chargetime/ocpp/v21/model`

### Tests & examples

Integration harnesses and sample consumer applications

- [1.6 tests](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6-test/src/test/groovy/eu/chargetime/ocpp/test): integration harness · Feature-, transport-, and model-level tests for the 1.6 stack · `ocpp-v1_6-test/src/test/groovy/eu/chargetime/ocpp/test`
- [V2 tests](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v2-test/src/test/java/eu/chargetime/ocpp/test): integration harness · Multi-protocol integration tests and fake CSMS/station implementations · `ocpp-v2-test/src/test/java/eu/chargetime/ocpp/test`
- [1.6 examples](https://github.com/chargetimeeu/java-oca-ocpp/tree/master/ocpp-v1_6-example): sample apps · Runnable JSON/SOAP consumer examples showing library assembly · `ocpp-v1_6-example`

## Connections

- Gradle/Maven → Common core: builds · Root build includes the shared library modules
- Gradle/Maven → JSON transport: builds · Root build includes the JSON transport module
- Gradle/Maven → SOAP transport: builds · Root build includes the SOAP transport module
- Gradle/Maven → V2 runtime: builds · Root build includes the v2 runtime module
- Parent POM → Common core: publishes · Maven metadata targets the shared core artifact
- Base model → Common core: supports · Base message types support the transport-agnostic protocol core
- Common core → JSON transport: adapts to · JSON communicator and sockets plug into the common session flow
- Common core → SOAP transport: adapts to · SOAP communicator and HTTP handlers plug into the common session flow
- Common core → 1.6 features: routes · Dispatcher resolves feature requests registered by 1.6 feature classes
- 1.6 features → 1.6 profiles: composes · Feature classes are grouped into client/server profiles and handlers
- 1.6 messages → 1.6 features: defines · Protocol message classes back the 1.6 feature implementations
- JSON transport → JSON clients: exposes · JSON transport is surfaced through convenience client/server APIs
- JSON clients → 1.6 features: uses · JSON facade wires protocol features into consumer apps
- JSON clients → JSON transport: uses · Facade delegates to the JSON communicator layer
- 1.6 tests → 1.6 features: verifies · Tests exercise 1.6 feature behavior and profile composition
- 1.6 tests → JSON transport: verifies · Tests cover JSON transport behavior
- 1.6 tests → SOAP transport: verifies · Tests cover SOAP transport behavior
- 1.6 examples → JSON clients: demonstrates · Samples show how to assemble JSON client/server applications
- 1.6 examples → SOAP transport: demonstrates · Samples show how to assemble SOAP client/server applications
- V2 runtime → Function layer: orchestrates · Shared runtime coordinates capability functions and sessions
- V2 runtime → 2.0.1 features: supports · Multi-protocol runtime supports the OCPP 2.0.1 branch
- V2 runtime → 2.1 features: supports · Multi-protocol runtime supports the OCPP 2.1 branch
- Function layer → 2.0.1 features: binds · Functions group and route 2.0.1 capabilities
- Function layer → 2.1 features: binds · Functions group and route 2.1 capabilities
- 2.0.1 features → 2.0.1 model: uses · 2.0.1 features are backed by the 2.0.1 message/type model
- 2.1 features → 2.1 model: uses · 2.1 features are backed by the 2.1 message/type model
- V2 tests → V2 runtime: verifies · Integration tests exercise the shared multi-protocol runtime
- V2 tests → 2.0.1 features: verifies · Tests cover OCPP 2.0.1 function/feature behavior
- V2 tests → 2.1 features: verifies · Tests cover OCPP 2.1 function/feature behavior
