Skip to content

Commit 3e3c962

Browse files
committed
Added
1 parent b61e467 commit 3e3c962

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
phase4 is an embeddable, lightweight Java library to send and receive AS4 (Applicability Statement 4) messages. It implements the EBMS 3.0 / AS4 messaging standard with support for multiple network profiles (Peppol, BDEW, CEF, ENTSOG, etc.). Version 4.4.2-SNAPSHOT, Java 17+.
8+
9+
## Build Commands
10+
11+
```bash
12+
# Full build (compile + test)
13+
mvn clean install
14+
15+
# Build without tests
16+
mvn clean install -DskipTests
17+
18+
# Build a single module
19+
mvn clean install -pl phase4-lib -DskipTests
20+
21+
# Build a module and its dependencies
22+
mvn clean install -pl phase4-peppol-client -am -DskipTests
23+
24+
# Run a single test class
25+
mvn test -pl phase4-lib -Dtest=com.helger.phase4.model.pmode.PModeTest
26+
27+
# Run a single test method
28+
mvn test -pl phase4-lib -Dtest=com.helger.phase4.model.pmode.PModeTest#testBasic
29+
30+
# JAXB code generation (phase4-lib only, runs during generate-sources)
31+
mvn generate-sources -pl phase4-lib
32+
```
33+
34+
Tests use JUnit 4. Some integration tests require an embedded Jetty server (ph-oton-jetty).
35+
36+
## Module Architecture
37+
38+
### Core
39+
- **phase4-lib** - Core AS4 library: SOAP/EBMS marshalling, crypto (WSS4J), PMode model, incoming request handling, outgoing client, servlet integration. Everything else depends on this.
40+
41+
### Profile Modules (one per AS4 network)
42+
- **phase4-profile-{name}** - Profile definition, PMode factory, validation. Registers via SPI (`IAS4ProfileRegistrarSPI`).
43+
- **phase4-{name}-client** - Sender utilities for the profile (e.g., `Phase4PeppolSender`).
44+
- **phase4-{name}-servlet** - Incoming message handler SPI implementation for the profile.
45+
46+
Profiles: `peppol`, `bdew`, `cef`, `edelivery2`, `dbnalliance`, `entsog`, `euctp`, `hredelivery`, `eudamed` (client-only).
47+
48+
### Webapps
49+
- **phase4-test-webapp**, **phase4-server-webapp**, **phase4-peppol-webapp** - Deployable WARs for testing/production.
50+
51+
### Other
52+
- **phase4-test** - Shared test utilities and resources.
53+
- **phase4-dynamic-discovery** - SMP-based dynamic discovery support.
54+
55+
## Key Source Paths (within phase4-lib)
56+
57+
| Path (under `src/main/java/com/helger/phase4/`) | Purpose |
58+
|---|---|
59+
| `incoming/AS4RequestHandler.java` | Core incoming message processing (2200 lines) |
60+
| `incoming/AS4IncomingHandler.java` | Incoming message parsing and security validation |
61+
| `sender/AbstractAS4UserMessageBuilder.java` | Base class for building outgoing user messages |
62+
| `client/AbstractAS4Client.java` | Base client with crypto, retry, HTTP configuration |
63+
| `servlet/AS4Servlet.java` | POST endpoint, delegates to `AS4XServletHandler` |
64+
| `model/pmode/PMode.java` | PMode configuration model (parties, MEP, legs) |
65+
| `mgr/MetaAS4Manager.java` | Global singleton managing all sub-managers |
66+
| `profile/IAS4ProfileRegistrarSPI.java` | SPI interface for profile auto-discovery |
67+
| `crypto/` | WSS4J integration, signing/encryption params, key management |
68+
69+
## Key Architectural Patterns
70+
71+
### Profile SPI System
72+
Profiles register via Java ServiceLoader (`META-INF/services/com.helger.phase4.profile.IAS4ProfileRegistrarSPI`). Adding a profile JAR to the classpath auto-registers it. Each profile provides: ID, validator, PMode template factory, and PMode ID provider.
73+
74+
### Manager Factory
75+
`MetaAS4Manager` uses `IAS4ManagerFactory` to create sub-managers (PMode, MPC, duplicate detection, timestamps). Two implementations: `AS4ManagerFactoryInMemory` (development) and `AS4ManagerFactoryPersistingFileSystem` (production, XML files).
76+
77+
### Message Flow
78+
- **Sending**: Profile-specific sender (e.g., `Phase4PeppolSender`) -> `AbstractAS4UserMessageBuilder` -> `AbstractAS4Client` -> HTTP POST with SOAP+attachments
79+
- **Receiving**: `AS4Servlet` -> `AS4XServletHandler` -> `AS4RequestHandler` (parses SOAP, validates security, invokes `IAS4IncomingMessageProcessorSPI` implementations)
80+
81+
### JAXB Code Generation
82+
`phase4-lib` generates Java classes from EBMS/AS4 XSD schemas during `generate-sources` phase. Bindings in `src/main/jaxb/bindings.xjb`, schemas in `src/main/resources/external/schemas/`.
83+
84+
## Dependencies
85+
86+
Core libraries from the ph-* ecosystem: `ph-commons`, `ph-web`, `ph-oton` (Photon web framework), `ph-xsds-*`. Crypto via WSS4J 4.0.1 and XMLSec 4.0.4. Peppol modules use `peppol-commons` and `peppol-reporting`.

0 commit comments

Comments
 (0)