Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1fc983b
DTR initial commit
Sep 9, 2025
a957cd8
feature printer addition
Sep 9, 2025
d26858f
custom documentation
Sep 9, 2025
bd1ea30
adding SPDX-License-Identifier to the new added files
Sep 9, 2025
322f005
review suggested changes from Arno
Sep 10, 2025
536e9ee
UT's
Sep 12, 2025
df4edc9
feature aas digital twin registry
Sep 14, 2025
c71b94f
feature digital twin registry
Sep 14, 2025
9019393
log level from TRACE --> INFO
Sep 14, 2025
18cb042
Merge branch 'main' into feature-impr/digital-twin-registry
FaheemBhatti Sep 17, 2025
edf654a
merge failure resolve
Sep 17, 2025
dc9c695
update parent pom to revert not needed changes
Sep 17, 2025
3fcb341
refactoring acc to the requested changes
Sep 22, 2025
c0887a3
docs updation
Sep 22, 2025
44ca62d
revert cosmetic changes on parent pom
Sep 22, 2025
017da72
remove db details
Sep 22, 2025
c61e2ea
remove circular reference
Sep 22, 2025
e5eb15e
removing circular ref
Sep 22, 2025
0294630
cosmetic changes revert
Sep 22, 2025
c883574
improve log statement in the DiscoveryIntegrationAasRegistrytest class
Sep 22, 2025
58ab66c
exclusion optimization and discovery behaviour adjust acc to actual
Sep 23, 2025
5eccbe5
resolve test failures in the discovery feature integration, add disco…
Sep 24, 2025
3ca5865
dtr module to InMemory from MongoDB to test workflows
Sep 27, 2025
23112eb
updating the registry poms
Oct 13, 2025
e983206
pom updatin
Oct 13, 2025
d1820ff
pom updation
Oct 14, 2025
5a85b3a
removing potential dependecies causing bean pollution
Oct 14, 2025
9f53b63
test properties for the aas registry digital twin feature
Oct 14, 2025
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
33 changes: 33 additions & 0 deletions .github/workflows/basyx_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,39 @@ jobs:
exit 1;
fi
test-basyx-aasdigitaltwinregistry:
runs-on: ubuntu-latest
name: AAS Digital Twin Registry Service Test
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven

- name: Build BaSyx
run: mvn clean install ${MVN_ARGS_BUILD_BASYX}

- name: Test AAS Digital Twin Registry Service
run: mvn test -f "basyx.aasdigitaltwinregistry/pom.xml"

- name: Fail if no Surefire/Failsafe reports found
run: |
if ! find . -type f \( -path "*/target/surefire-reports/*.xml" -o -path "*/target/failsafe-reports/*.xml" \) | grep -q .; then
echo "No Surefire or Failsafe test reports found. Failing CI.";
exit 1;
fi
- name: Fail if no Surefire/Failsafe reports found
run: |
if ! find . -type f \( -path "*/target/surefire-reports/*.xml" -o -path "*/target/failsafe-reports/*.xml" \) | grep -q .; then
echo "No Surefire or Failsafe test reports found. Failing CI.";
exit 1;
fi
- name: Stop environment
if: always()
run: docker compose --project-directory ./ci down
2 changes: 2 additions & 0 deletions .github/workflows/docker-milestone-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
path: basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker
- name: submodel-registry-log-mongodb
path: basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker
- name: digitaltwinregistry
path: basyx.aasdigitaltwinregistry/basyx.digitaltwinregistry.component

steps:
- name: Checkout Code
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docker-snapshot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
path: basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker
- name: submodel-registry-log-mongodb
path: basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker
- name: digitaltwinregistry
path: basyx.aasdigitaltwinregistry/basyx.digitaltwinregistry.component

steps:
- name: Checkout Code
Expand Down
151 changes: 151 additions & 0 deletions basyx.aasdigitaltwinregistry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@


# BaSyx Digital Twin Registry

## Overview
The **Digital Twin Registry** serves as a combined module that merges the capabilities of `AASRegistry` and `AASDiscovery`.
When a client calls the `/shell-description` endpoint, the module dynamically constructs both an `AssetAdministrationShellDescriptor` and an `aasDiscoveryDocumentEntity`.

This dual-output ensures that the asset shell becomes immediately discoverable and accessible, blending registry and discovery functionalities in a seamless operation.

---

## How It Works

- **Endpoint Integration**

A single REST endpoint (`/shell-description`) triggers the generation of:
- An **AAS Descriptor**, representing the asset's metadata and management interface.
- A **Discovery Document**, enabling other components to locate or resolve the AAS.

- **Unified Workflow**
By combining `AASRegistry` and `AASDiscovery`, the module streamlines the typical sequential two-step — *discover then retrieve* — into a single integrated operation.

---

## Module Structure in the BaSyx SDK

- **New Module Introduction**
Within the main BaSyx SDK, a new module — `digitaltwinregistry` — has been introduced.
It follows the **decorator pattern**, meaning it wraps around existing functionality to extend behavior without modifying original code.

- **Delegate-Based Design**
At its core, the module implements or creates a **delegate** for the `ShellDescriptorsApiDelegate` interface.
This delegate intercepts API calls (particularly related to shell descriptions) and injects the registry-and-discovery logic — making the module effectively pluggable and maintainable.

---

## Summary

In essence, the **Digital Twin Registry module**:

- Combines **registry** and **discovery** into a unified action via `/shell-description`.
- Is implemented as a **decorator delegate** (`ShellDescriptorsApiDelegate`), making it both modular and maintainable.
- Seamlessly integrates with existing BaSyx storage options and aligns with broader architectural goals, such as centralized registries, tagging, and scalable discovery.

## Environment
This document describes the environment variables used to configure the BaSyx Digital Twin Registry application. The application supports multiple profiles with different storage backends.

---

## Configuration Files
The application uses three YAML configuration files:

- `application.yml` - Base configuration
- `application-InMemory.yml` - In-memory storage profile
- `application-MongoDB.yml` - MongoDB storage profile

---

## Environment Variables

### Base Configuration (`application.yml`)

| Environment Variable | Default Value | Description |
|-----------------------|---------------|-------------|
| `SPRING_PROFILE` | MongoDB | Active Spring profile (`InMemory` or `MongoDB`) |
| `LOGGING_LEVEL` | INFO | Logging level for root and BaSyx components |

---

### Server Configuration

| Property | Default Value | Description |
|----------------|---------------|-------------|
| `server.port` | 8081 | HTTP server port |

---

### CORS Configuration

| Property | Value | Description |
|--------------------------------|-----------------------------------------------------|-------------|
| `basyx.cors.allowed-methods` | GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD | Allowed HTTP methods |
| `basyx.cors.allowed-origins` | * | Allowed origins (CORS) |

---

### Management Endpoints

| Property | Value | Description |
|------------------------------------------|------------------------------|-------------|
| `management.endpoints.web.exposure.include` | health,metrics,mappings | Exposed actuator endpoints |

---

### SpringDoc/Swagger Configuration

| Property | Value | Description |
|-----------------------------------|--------------------|-------------|
| `springdoc.api-docs.enabled` | true | Enable API documentation |
| `springdoc.swagger-ui.enabled` | true | Enable Swagger UI |
| `springdoc.swagger-ui.path` | /swagger-ui.html | Swagger UI path |
| `springdoc.swagger-ui.csrf.enabled` | false | Disable CSRF protection for Swagger |

---

## InMemory Profile Configuration

**Profile Name:** `InMemory`

### Environment Variables
_No additional environment variables required for InMemory profile._

### Configuration Properties

| Property | Value | Description |
|---------------------|------------|-------------|
| `basyx.backend` | InMemory | Use in-memory storage backend |
| `registry.type` | InMemory | Registry type |
| `registry.discovery.enabled` | true | Enable discovery service |

### Auto-configuration Exclusions
The InMemory profile excludes MongoDB auto-configuration:

- `org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration`
- `org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration`

---

## MongoDB Profile Configuration

**Profile Name:** `MongoDB`

### Environment Variables

| Environment Variable | Default Value | Description |
|---------------------------|-----------------------------------------|-------------|
| `AUTHENTICATION_DATABASE` | aasregistry | MongoDB authentication database name |
| `DATABASE_HOST` | localhost | MongoDB host address |
| `DATABASE_PORT` | localhost | MongoDB port (**Note:** should be a numeric port) |
| `DATABASE_USERNAME` | smartsystemhub | MongoDB username |
| `DATABASE_PASSWORD` | smartsystemshubdatabaseforfactoryX | MongoDB password |

### Configuration Properties

| Property | Value | Description |
|---------------------|---------|-------------|
| `basyx.backend` | MongoDB | Use MongoDB storage backend |
| `registry.type` | MongoDB | Registry type |
| `registry.discovery.enabled` | true | Enable discovery service |
| `basyx.aasdiscoveryservice.mongodb.collectionName` | aasregistry | MongoDB collection name |
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM eclipse-temurin:17
USER nobody
WORKDIR /application
ARG JAVA_OPTS
ENV JAVA_OPTS=$JAVA_OPTS
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} basyxExecutable.jar

COPY src/main/resources/application.yml application.yml
COPY src/main/resources/application-MongoDB.yml application-MongoDB.yml
COPY src/main/resources/application-InMemory.yml application-InMemory.yml

ARG PORT=8081
ENV SERVER_PORT=${PORT}
ARG CONTEXT_PATH=/
ENV SERVER_SERVLET_CONTEXT_PATH=${CONTEXT_PATH}
EXPOSE ${SERVER_PORT}

HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s \
CMD curl --fail http://localhost:${SERVER_PORT}${SERVER_SERVLET_CONTEXT_PATH%/}/actuator/health || exit 1

ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar basyxExecutable.jar
Loading
Loading