Skip to content
Success

Changes

Summary

  1. Allow default resource metadata to be set in the model (commit: fad36b2) (details)
Commit fad36b2ed0152578dc5374731fda27b86b720840 by timothyjward
Allow default resource metadata to be set in the model

Provider instances have the ability to independently set metadata values, however in most cases metadata is common to all instances of a model and it is relatively static. It therefore makes sense to be able to define default metadata at the resource model level which is applied to the instance when it is first created.

Note that only the Extra metadata is used to populate the defaults. This prevents other data about the resource (e.g. the resource type and value type) from being added and bloating the metadata. To differentiate default metadata values from metadata values which are set later the default metadata values will have no associated timestamp. This is in line with the behaviour for default resource values.

Signed-off-by: Tim Ward <timothyjward@apache.org>
(commit: fad36b2)
The file was modifiedcore/impl/src/main/java/org/eclipse/sensinact/core/impl/snapshot/ResourceSnapshotImpl.java
The file was modifiedcore/impl/src/test/java/org/eclipse/sensinact/core/twin/impl/SensinactTwinTest.java
The file was modifiedcore/api/src/main/java/org/eclipse/sensinact/core/model/ResourceBuilder.java
The file was modifiedcore/impl/src/main/java/org/eclipse/sensinact/core/model/impl/ResourceBuilderImpl.java
The file was modifiedcore/api/src/main/java/org/eclipse/sensinact/core/model/Resource.java
The file was modifiedcore/impl/src/main/java/org/eclipse/sensinact/core/model/nexus/ModelNexus.java
The file was modifiedcore/impl/src/main/java/org/eclipse/sensinact/core/model/impl/ResourceImpl.java
The file was modifiedcore/models/metadata/src/main/resources/model/metadata.ecore
The file was modifiedcore/models/metadata/src/main/resources/model/metadata.genmodel
The file was modifiedcore/impl/src/test/java/org/eclipse/sensinact/core/model/impl/ModelBuildingTest.java