Persistence
The Persistence interface is responsible for storing the AAS model.
Each Persistence configuration supports at least the following configuration properties:
Name |
Allowed Value |
Description |
Default Value |
|---|---|---|---|
initialModel |
String |
An |
|
initialModelFile |
String |
Path to a model file to load initially. |
In-Memory
The In-Memory Persistence keeps the AAS model in the local memory. This means, that once FA³ST Service is stopped or crashes, all changes made during runtime are lost.
Important
If you use In-Memory Persistence from code by setting the initialModel property, the passed instance of Environment will be modified directly (as always the case in Java with pass-by-reference).
If you do not want the original instance to be modified by FA³ST Serivce, call DeepCopyHelper.deepCopy(...) with the Environment to create a copy before passing it to FA³ST.
Configuration
In-Memory Persistence has no additional configuration properties.
1{
2 "persistence":
3 {
4 "@class": "org.eclipse.digitaltwin.fa3st.service.persistence.memory.PersistenceInMemory",
5 "initialModel": "{pathTo}/fa3st-service/misc/examples/model.json"
6 },
7 //...
8}
File-based
The File-based Persistence stores the AAS model in a file according to the AAS specification. Therefore, changes are stored permanently even when FA³ST Service is stopped or crashes.
Important
Each modification of the model results in writing the whole model to the file which might become a performance issue for larger models.
Configuration
Name |
Allowed Value |
Description |
Default Value |
|---|---|---|---|
dataDir |
String |
Path where the model file created by the persistence should be saved. |
. |
dataformat |
AASX |
Data format to use when storing. |
same as |
keepInitial |
Boolean |
If true, |
true |
1{
2 "persistence":
3 {
4 "@class": "org.eclipse.digitaltwin.fa3st.service.persistence.file.PersistenceFile",
5 "initialModelFile": "{pathTo}/fa3st-service/misc/examples/model.json",
6 "dataDir": ".",
7 "keepInitial": true,
8 "dataformat": "XML"
9 },
10 //...
11}
Mongo
The Mongo Persistence stores the AAS model in a MongoDB according to the AAS specification. Therefore, changes are stored permanently even when FA³ST Service is stopped or crashes.
Important
Each modification of the model results in only writing the specific part to the MongoDB document which should improve performance
Configuration
Name |
Allowed Value |
Description |
Default Value |
|---|---|---|---|
connectionString |
String |
The connection string where the MongoDB is located. |
|
database |
String |
The name of the database to be used inside the MongoDB. |
|
override |
Boolean |
If true, FA³ST persistence will always override the previous database, this might result in data loss. |
false |
1{
2 "persistence":
3 {
4 "@class": "org.eclipse.digitaltwin.fa3st.service.persistence.mongo.PersistenceMongo",
5 "connectionString": "mongodb://localhost:27017",
6 "database": "fa3st-database",
7 "override": true
8 },
9 //...
10}