Skip to content

Maven Module Structure

Philip Helger edited this page Feb 24, 2026 · 22 revisions

Maven Module Structure

Overview

The project is organized into Maven submodules. The parent POM acts as a BOM (Bill of Materials) for dependency version management across all modules.

Spring is used only in the webapp module (Spring Boot application entry point and REST controllers). All other modules are framework-independent and use ph-db for JDBC-based database access, following the same patterns as phoss-smp.

Module Dependency Diagram

graph TD
    parent[phoss-ap-parent]
    api[phoss-ap-api]
    db[phoss-ap-db]
    core[phoss-ap-core]
    fhttp[phoss-ap-forwarding-http]
    fs3[phoss-ap-forwarding-s3]
    fsftp[phoss-ap-forwarding-sftp]
    webapp[phoss-ap-webapp]

    parent --> api
    parent --> db
    parent --> core
    parent --> fhttp
    parent --> fs3
    parent --> fsftp
    parent --> webapp

    db --> api
    core --> api
    core --> db
    fhttp --> api
    fs3 --> api
    fsftp --> api
    webapp --> core
    webapp -.-> fhttp
    webapp -.-> fs3
    webapp -.-> fsftp
Loading

Dashed lines indicate that exactly one forwarding module is included per deployment.

Modules

phoss-ap-parent

The root POM. Acts as the BOM for all dependency version management (phase4, peppol-commons, peppol-reporting, ph-db, ph-commons, Spring Boot, PostgreSQL driver, Flyway, etc.). All submodules inherit from this POM.

phoss-ap-api

Java interfaces, shared model classes, and enums. This is the contract layer that all other modules depend on.

Contains:

  • Forwarding interface (IDocumentForwarder or similar) — implemented by the forwarding modules
  • Notification interface — generic failure notification SPI
  • Retry strategy interface — customizable retry behavior (max attempts, backoff)
  • Document validation interface — optional verification SPI
  • Domain model classes (transaction types, status enums, MLS codes, etc.)
  • Callback interfaces (onSuccessfulAS4Sending, etc.)

Dependencies: Minimal — ph-commons only.

phoss-ap-db

Database access layer for PostgreSQL using ph-db (JDBC wrapper).

Contains:

  • Flyway migration scripts for PostgreSQL (under resources/db/migrate-postgresql/)
  • JDBC manager classes extending AbstractJDBCEnabledManager, one per table group:
    • OutboundTransactionManagerJDBC — CRUD for outbound_transaction and outbound_sending_attempt
    • InboundTransactionManagerJDBC — CRUD for inbound_transaction and inbound_forwarding_attempt
    • ArchivalManagerJDBC — move completed transactions to archive tables
  • DB query logic using DBExecutor with ConstantPreparedStatementDataProvider for parameterized queries
  • Flyway configuration class (similar to SMPFlywayConfiguration in phoss-smp)
  • DataSource provider / JDBC configuration class

Dependencies: phoss-ap-api, ph-db-jdbc, PostgreSQL JDBC driver, Flyway.

No Spring dependencies in this module.

phoss-ap-core

Core business logic and orchestration. This is the central module that ties together AS4 sending/receiving, DB operations, retry scheduling, MLS handling, and reporting.

Contains:

  • Outbound orchestration: receive from API → store → validate → send via phase4 → record attempt → trigger reporting
  • Inbound orchestration: receive via phase4 servlet → duplicate check → store → forward → record attempt → reporting
  • MLS handling: generate MLS responses (as C3), receive and correlate MLS responses (as C2)
  • Retry scheduler: periodic retry of failed outbound sends and failed inbound forwarding
  • Archival scheduler: move completed transactions to archive tables
  • Reporting integration: callbacks and peppol-reporting integration
  • Notification dispatch: invoke generic notification interface on permanent failures
  • Graceful shutdown logic

Dependencies: phoss-ap-api, phoss-ap-db, phase4-peppol-client, phase4-peppol-servlet, peppol-reporting, peppol-commons.

No Spring dependencies in this module.

phoss-ap-forwarding-http

HTTP POST forwarding implementation.

Contains:

  • HTTP POST forwarder (async reporting variant) — posts SBD to configured endpoint
  • HTTP POST forwarder (sync reporting variant) — posts SBD, reads C4 country code from response

Dependencies: phoss-ap-api, Apache HttpClient.

No Spring dependencies in this module.

phoss-ap-forwarding-s3

S3 storage + link forwarding implementation.

Contains:

  • S3 uploader — stores the SBD in a configured S3 bucket
  • Link forwarder — notifies the Receiver Backend with the S3 reference/URL

Dependencies: phoss-ap-api, AWS SDK for S3.

No Spring dependencies in this module.

phoss-ap-forwarding-sftp

SFTP forwarding implementation.

Contains:

  • SFTP uploader — uploads the SBD to a configured SFTP server using ph-jsch abstractions (SftpRunner, ISftp, ISessionFactory)

Dependencies: phoss-ap-api, ph-jsch (com.helger.web:ph-jsch).

No Spring dependencies in this module.

phoss-ap-webapp

The Spring Boot application that assembles everything into a runnable deployment. This is the only module that depends on Spring.

Contains:

  • Spring Boot application entry point
  • REST controllers (outbound submit, status queries, inbound reporting API)
  • AS4 servlet configuration (phase4 Peppol servlet registration)
  • Application configuration (application.properties)
  • Security / authentication (API token handling)
  • Wiring: connects Spring Boot to the non-Spring core via dependency injection of manager instances

Dependencies: phoss-ap-core, Spring Boot, exactly one of the forwarding modules (phoss-ap-forwarding-http, phoss-ap-forwarding-s3, or phoss-ap-forwarding-sftp).

Deployment Assembly

A deployment includes:

phoss-ap-parent
  └── phoss-ap-api
  └── phoss-ap-db
  └── phoss-ap-core
  └── phoss-ap-forwarding-{http|s3|sftp}   (one of these)
  └── phoss-ap-webapp

The forwarding module is selected at build time via Maven profiles or by including the appropriate dependency in the webapp POM.

Clone this wiki locally