|
| 1 | + |
| 2 | + |
| 3 | +# BaSyx Digital Twin Registry |
| 4 | + |
| 5 | +## Overview |
| 6 | +The **Digital Twin Registry** serves as a combined module that merges the capabilities of `AASRegistry` and `AASDiscovery`. |
| 7 | +When a client calls the `/shell-description` endpoint, the module dynamically constructs both an `AssetAdministrationShellDescriptor` and an `aasDiscoveryDocumentEntity`. |
| 8 | + |
| 9 | +This dual-output ensures that the asset shell becomes immediately discoverable and accessible, blending registry and discovery functionalities in a seamless operation. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## How It Works |
| 14 | + |
| 15 | +- **Endpoint Integration** |
| 16 | + |
| 17 | + A single REST endpoint (`/shell-description`) triggers the generation of: |
| 18 | + - An **AAS Descriptor**, representing the asset's metadata and management interface. |
| 19 | + - A **Discovery Document**, enabling other components to locate or resolve the AAS. |
| 20 | + |
| 21 | +- **Unified Workflow** |
| 22 | + By combining `AASRegistry` and `AASDiscovery`, the module streamlines the typical sequential two-step — *discover then retrieve* — into a single integrated operation. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Module Structure in the BaSyx SDK |
| 27 | + |
| 28 | +- **New Module Introduction** |
| 29 | + Within the main BaSyx SDK, a new module — `digitaltwinregistry` — has been introduced. |
| 30 | + It follows the **decorator pattern**, meaning it wraps around existing functionality to extend behavior without modifying original code. |
| 31 | + |
| 32 | +- **Delegate-Based Design** |
| 33 | + At its core, the module implements or creates a **delegate** for the `ShellDescriptorsApiDelegate` interface. |
| 34 | + This delegate intercepts API calls (particularly related to shell descriptions) and injects the registry-and-discovery logic — making the module effectively pluggable and maintainable. |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +## Summary |
| 39 | + |
| 40 | +In essence, the **Digital Twin Registry module**: |
| 41 | + |
| 42 | +- Combines **registry** and **discovery** into a unified action via `/shell-description`. |
| 43 | +- Is implemented as a **decorator delegate** (`ShellDescriptorsApiDelegate`), making it both modular and maintainable. |
| 44 | +- Seamlessly integrates with existing BaSyx storage options and aligns with broader architectural goals, such as centralized registries, tagging, and scalable discovery. |
| 45 | + |
| 46 | +## Environment |
| 47 | +This document describes the environment variables used to configure the BaSyx Digital Twin Registry application. The application supports multiple profiles with different storage backends. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Configuration Files |
| 52 | +The application uses three YAML configuration files: |
| 53 | + |
| 54 | +- `application.yml` - Base configuration |
| 55 | +- `application-InMemory.yml` - In-memory storage profile |
| 56 | +- `application-MongoDB.yml` - MongoDB storage profile |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## Environment Variables |
| 61 | + |
| 62 | +### Base Configuration (`application.yml`) |
| 63 | + |
| 64 | +| Environment Variable | Default Value | Description | |
| 65 | +|-----------------------|---------------|-------------| |
| 66 | +| `SPRING_PROFILE` | MongoDB | Active Spring profile (`InMemory` or `MongoDB`) | |
| 67 | +| `LOGGING_LEVEL` | INFO | Logging level for root and BaSyx components | |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +### Server Configuration |
| 72 | + |
| 73 | +| Property | Default Value | Description | |
| 74 | +|----------------|---------------|-------------| |
| 75 | +| `server.port` | 8081 | HTTP server port | |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +### CORS Configuration |
| 80 | + |
| 81 | +| Property | Value | Description | |
| 82 | +|--------------------------------|-----------------------------------------------------|-------------| |
| 83 | +| `basyx.cors.allowed-methods` | GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD | Allowed HTTP methods | |
| 84 | +| `basyx.cors.allowed-origins` | * | Allowed origins (CORS) | |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +### Management Endpoints |
| 89 | + |
| 90 | +| Property | Value | Description | |
| 91 | +|------------------------------------------|------------------------------|-------------| |
| 92 | +| `management.endpoints.web.exposure.include` | health,metrics,mappings | Exposed actuator endpoints | |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +### SpringDoc/Swagger Configuration |
| 97 | + |
| 98 | +| Property | Value | Description | |
| 99 | +|-----------------------------------|--------------------|-------------| |
| 100 | +| `springdoc.api-docs.enabled` | true | Enable API documentation | |
| 101 | +| `springdoc.swagger-ui.enabled` | true | Enable Swagger UI | |
| 102 | +| `springdoc.swagger-ui.path` | /swagger-ui.html | Swagger UI path | |
| 103 | +| `springdoc.swagger-ui.csrf.enabled` | false | Disable CSRF protection for Swagger | |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +## InMemory Profile Configuration |
| 108 | + |
| 109 | +**Profile Name:** `InMemory` |
| 110 | + |
| 111 | +### Environment Variables |
| 112 | +_No additional environment variables required for InMemory profile._ |
| 113 | + |
| 114 | +### Configuration Properties |
| 115 | + |
| 116 | +| Property | Value | Description | |
| 117 | +|---------------------|------------|-------------| |
| 118 | +| `basyx.backend` | InMemory | Use in-memory storage backend | |
| 119 | +| `registry.type` | InMemory | Registry type | |
| 120 | +| `registry.discovery.enabled` | true | Enable discovery service | |
| 121 | + |
| 122 | +### Auto-configuration Exclusions |
| 123 | +The InMemory profile excludes MongoDB auto-configuration: |
| 124 | + |
| 125 | +- `org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration` |
| 126 | +- `org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration` |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## MongoDB Profile Configuration |
| 131 | + |
| 132 | +**Profile Name:** `MongoDB` |
| 133 | + |
| 134 | +### Environment Variables |
| 135 | + |
| 136 | +| Environment Variable | Default Value | Description | |
| 137 | +|---------------------------|-----------------------------------------|-------------| |
| 138 | +| `AUTHENTICATION_DATABASE` | aasregistry | MongoDB authentication database name | |
| 139 | +| `DATABASE_HOST` | localhost | MongoDB host address | |
| 140 | +| `DATABASE_PORT` | localhost | MongoDB port (**Note:** should be a numeric port) | |
| 141 | +| `DATABASE_USERNAME` | smartsystemhub | MongoDB username | |
| 142 | +| `DATABASE_PASSWORD` | smartsystemshubdatabaseforfactoryX | MongoDB password | |
| 143 | + |
| 144 | +### Configuration Properties |
| 145 | + |
| 146 | +| Property | Value | Description | |
| 147 | +|---------------------|---------|-------------| |
| 148 | +| `basyx.backend` | MongoDB | Use MongoDB storage backend | |
| 149 | +| `registry.type` | MongoDB | Registry type | |
| 150 | +| `registry.discovery.enabled` | true | Enable discovery service | |
| 151 | +| `basyx.aasdiscoveryservice.mongodb.collectionName` | aasregistry | MongoDB collection name | |
0 commit comments