Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ on [Keep a CHANGELOG](http://keepachangelog.com/). This project adheres to

## [Unreleased]

## [21.0.0-SNAPSHOT] - 2026-04-14
### Changed
- Bumped version to `21.0.0-SNAPSHOT` for Java 21 / WildFly 34 migration
- Updated parent and all 50 child module POMs to `21.0.0-SNAPSHOT`
- Updated `cpp.common-bom.version`, `framework-libraries.version`, `framework.version`, and `event-store.version` to `21.0.0-SNAPSHOT`
- Updated `referencedata.version`: `17.103.129` → `17.103.131`
- Migrated all Java source files (158 files) from `javax.*` to `jakarta.*` EE imports for compatibility with Jakarta EE 10
- Replaced `javax:javaee-api` with `jakarta.platform:jakarta.jakartaee-api` in all 30 child module POMs that declared it as a dependency
- Replaced `org.glassfish:javax.json` with `org.glassfish:jakarta.json` in 8 test POMs to align with Jakarta JSON-P 2.x
- Fixed `ProviderAnnotationScanner`: replaced removed `BeanManager.fireEvent()` (CDI 4.0) with `BeanManager.getEvent().fire(event)`
- Updated `ProviderAnnotationScannerTest` to use the CDI 4.0 `BeanManager.getEvent()` API
- Reverted `activiti-embedded-rest` to use `javax.servlet.*` and `javax.transaction.*` imports (Activiti 5.22.0 depends on Spring 4.x which is bound to the `javax.*` namespace); added `javax:javaee-api:8.0.1` as a provided compilation dependency for that module
- Fixed `DefaultSystemIdMapperClientTest`: updated `ZonedDateTime` assertions from `ZoneId.of("UTC")` to `ZoneOffset.UTC` to match Jackson 2.21.x deserialisation of the `"Z"` timezone token

# [17.105.0-M10] - 2026-04-02
### Changed
- Update microservice-framework to 17.105.0-M6 and event-store to 17.105.0-M19 for:
Expand Down
64 changes: 50 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
# Platform Libraries
# cpp-platform-libraries

Common internal libraries used by all [Microservice Framework](https://github.com/CJSCommonPlatform/microservice_framework) based contexts
`uk.gov.moj.platform.libraries:platform-libraries-parent-pom`

## CPP Internal Library Projects
Shared internal libraries used by all CPP bounded-context services. This project provides cross-cutting platform concerns — access control, auditing, feature flags, metrics, search, health checks — as versioned, reusable library JARs consumed by the `cpp-context-*` services through `platform-libraries-bom`.

All internal library projects have been brought in to be sub projects of this one, with a common version number to ease releases
## Position in the hierarchy

# [Access Control](./access-control-parent)
# [Audit Library](./audit-library-parent)
# [Authorisation](./authorisation-parent)
# [Library Utils](./cpp-platform-library-utils)
# [Id Mapper Client](./id-mapper-client)
# [Service-Components](./service-components)
# [System Document Generator Client](./system-documentgenerator-client)
# [System Users Library](./system-users-library)
# [Unified Search](./unifiedsearch-library-parent)
# [Activiti](./activiti-parent)
```
cpp-platform-maven-parent-pom
└── cpp-platform-libraries ← this project
└── cpp-platform-maven-service-parent-pom
└── [all cpp-context-* bounded-context services]
```

`cpp-platform-maven-service-parent-pom` inherits from this project and imports `platform-libraries-bom`, making all platform library versions available to every context service.

## Maven coordinates

| Property | Value |
|---|---|
| `groupId` | `uk.gov.moj.platform.libraries` |
| `artifactId` | `platform-libraries-parent-pom` |
| Parent | `uk.gov.moj.cpp.common:parent-pom` (cpp-platform-maven-parent-pom) |

## Modules

| Module | Artifact group | Description |
|---|---|---|
| `access-control-parent` | `access-control-*` | Drools-based access control evaluation. Loads `.drl` rule files from the classpath to enforce role-based access on incoming requests. Requires a `CJSCPPUID` header. |
| `audit-library-parent` | `audit-*` | Audit recording — writes an audit trail of commands and queries to the audit event store via JMS. Configurable action blacklist via `audit.blacklist` JNDI key. |
| `feature-control` | `feature-control-*` | Remote feature-flag control. Fetches flag values from a remote source and caches them locally. Master switch: `feature-control.enabled` JNDI key. |
| `metrics-micrometer` | `metrics-micrometer` | Micrometer metrics integration for context services — publishes to Azure Monitor. Configured via `micrometer.metrics.*` JNDI keys. |
| `healthchecks-parent` | `healthchecks-*` | MicroProfile health check base classes and WildFly probe registration. |
| `service-components` | `service-components` | Defines the `@ServiceComponent` values specific to the platform tier (beyond the core framework components). |
| `access-control-parent` | | |
| `id-mapper-client` | `id-mapper-client` | REST client for the ID mapper service — maps internal IDs to external references. |
| `system-documentgenerator-client` | `system-documentgenerator-client` | REST client for the document generator service. |
| `system-users-library` | `system-users-library` | Utilities for resolving user identity and roles from the `CJSCPPUID` session token. |
| `unifiedsearch-library-parent` | `unifiedsearch-*` | Client library for the unified search service (Elasticsearch-backed). |
| `activiti-parent` | `activiti-*` | Integration layer for Activiti BPMN workflow engine used in some bounded contexts. |
| `cpp-platform-library-utils` | `cpp-platform-library-utils` | Shared low-level utilities (string helpers, date converters, reflection utilities). |
| `platform-libraries-bom` | `platform-libraries-bom` | BOM that imports all platform library artifacts at a consistent version. |

## Build

```bash
mvn clean install -Denforcer.skip=true
```

The `enforce-moj-latest-interfaces` rule checks that MOJ interface JAR versions are current. During active development use `-Denforcer.skip=true`; this flag skips the standard `enforce-rules` execution but not rules with `<skip>false</skip>` hardcoded.

## JNDI configuration

See the `cp-microservice-framework` [jndi-configuration.md](../cp-microservice-framework/jndi-configuration.md) for `feature-control`, `audit.blacklist`, `micrometer.metrics.*`, and CORS keys — these originate in classes within `cp-microservice-framework` but apply to platform services using this library.
22 changes: 17 additions & 5 deletions access-control-parent/access-control-drools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-parent</artifactId>
<version>17.105.0-M11-SNAPSHOT</version>
<version>21.0.0-SNAPSHOT</version>
</parent>

<artifactId>access-control-drools</artifactId>

<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<groupId>uk.gov.justice.framework-api</groupId>
<artifactId>framework-api-core</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>uk.gov.justice.framework-api</groupId>
<artifactId>framework-api-core</artifactId>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -37,6 +38,17 @@
<groupId>org.drools</groupId>
<artifactId>drools-mvel</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-xml-support</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-commands</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import java.util.Optional;

import javax.json.JsonValue;
import jakarta.json.JsonValue;

/**
* Representation of an action for convenience use with drools integration.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package uk.gov.moj.cpp.accesscontrol.drools;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import java.util.HashMap;
import java.util.Map;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.enterprise.inject.spi.Bean;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.inject.Inject;

import org.kie.api.builder.model.KieBaseModel;
import org.kie.api.builder.model.KieSessionModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import java.util.List;
import java.util.Optional;

import javax.annotation.Priority;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Alternative;
import javax.inject.Inject;
import jakarta.annotation.Priority;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Alternative;
import jakarta.inject.Inject;

import org.kie.api.command.Command;
import org.kie.api.runtime.ExecutionResults;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

/**
* Identifies provider classes, which are used by the access-control module to inject information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import java.util.List;
import java.util.stream.Stream;

import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterDeploymentValidation;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.Extension;
import jakarta.enterprise.event.Observes;
import jakarta.enterprise.inject.spi.AfterDeploymentValidation;
import jakarta.enterprise.inject.spi.Bean;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.Extension;

import org.slf4j.Logger;

Expand Down Expand Up @@ -41,7 +41,7 @@ private void processBean(final Bean<?> bean) {
}

private void fireAllCollectedEvents(final BeanManager beanManager) {
events.forEach(beanManager::fireEvent);
events.forEach(event -> beanManager.getEvent().fire(event));
}

private boolean isProvider(final Bean<?> bean) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package uk.gov.moj.cpp.accesscontrol.providers;

import javax.enterprise.inject.spi.Bean;
import jakarta.enterprise.inject.spi.Bean;

/**
* Event representing the occurrence of a class with an annotation having been
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="all">
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
version="4.0" bean-discovery-mode="all">
</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import java.util.List;
import java.util.Map;

import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.context.spi.Context;
import jakarta.enterprise.context.spi.CreationalContext;
import jakarta.enterprise.inject.spi.Bean;
import jakarta.enterprise.inject.spi.BeanManager;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import java.util.Map;
import java.util.Optional;

import org.drools.core.command.runtime.BatchExecutionCommandImpl;
import org.drools.core.command.runtime.rule.InsertObjectCommand;
import org.drools.commands.runtime.BatchExecutionCommandImpl;
import org.drools.commands.runtime.rule.InsertObjectCommand;
import org.hamcrest.collection.IsCollectionWithSize;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@

import java.util.HashSet;

import javax.enterprise.inject.spi.AfterDeploymentValidation;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.event.Event;
import jakarta.enterprise.inject.spi.AfterDeploymentValidation;
import jakarta.enterprise.inject.spi.Bean;
import jakarta.enterprise.inject.spi.BeanManager;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;

import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
Expand All @@ -35,11 +34,14 @@ public class ProviderAnnotationScannerTest {
@Mock
private BeanManager beanManager;

@Mock
private Event<Object> mockEvent;

@Mock
private Bean<Object> bean;

@Captor
private ArgumentCaptor<ProviderFoundEvent> captor;
private ArgumentCaptor<Object> captor;

private ProviderAnnotationScanner annotationScanner;

Expand All @@ -51,25 +53,24 @@ public void setup() {
@Test
public void shouldFireProviderFoundEvent() throws Exception {
doReturn(TestProvider.class).when(bean).getBeanClass();

mockBeanManagerGetBeansWith(bean);
doReturn(mockEvent).when(beanManager).getEvent();

annotationScanner.afterDeploymentValidation(afterDeploymentValidation, beanManager);

verify(beanManager).fireEvent(captor.capture());
verify(mockEvent).fire(captor.capture());
assertThat(captor.getValue(), instanceOf(ProviderFoundEvent.class));
assertThat(captor.getValue().getBean(), equalTo(bean));
assertThat(((ProviderFoundEvent) captor.getValue()).getBean(), equalTo(bean));
}

@Test
public void shouldNotFireAnyEventForNonProviderEvents() throws Exception {
doReturn(Object.class).when(bean).getBeanClass();

mockBeanManagerGetBeansWith(bean);

annotationScanner.afterDeploymentValidation(afterDeploymentValidation, beanManager);

verify(beanManager, never()).fireEvent(any());
verify(beanManager, never()).getEvent();
}

@SuppressWarnings("serial")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

import javax.enterprise.inject.spi.Bean;
import jakarta.enterprise.inject.spi.Bean;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-providers</artifactId>
<version>17.105.0-M11-SNAPSHOT</version>
<version>21.0.0-SNAPSHOT</version>
</parent>

<artifactId>access-control-assignment-providers</artifactId>
Expand All @@ -17,8 +17,8 @@
<artifactId>rest-client-generator-plugin</artifactId>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${javaee-api.version}</version>
<scope>runtime</scope>
</dependency>
Expand All @@ -41,8 +41,8 @@

<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -66,7 +66,6 @@
<version>${project.version}</version>
</dependency>

<!-- Required by deltaspike tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down Expand Up @@ -104,7 +103,7 @@
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<artifactId>jakarta.json</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Loading
Loading