BaSyx CFG sub model provider
CFG sub model provider servlet
The CFG sub model provider reads all properties that are to be exported as sub model from a main configuration file. The provider creates a conforming sub model structure with meta data and the provided property values from the configuration file. It is implemented by servlet class org.eclipse.basyx.components.servlets.CFGSubModelProviderServlet
. It accepts the following configuration parameter:
- config: Path to configuration file
The following snippet illustrates an Apache Tomcat configuration for the CFG sub model provider Example_CFGProvider. It configures the location of the configuration file inside the WEB-INF folder and configures the URL pattern that is used to access the sub model to /Testsuite/components/BaSys/1.0/provider/cfgsm
<servlet> <servlet-name>Example_CFGProvider</servlet-name> <servlet-class> org.eclipse.basyx.components.servlets.CFGSubModelProviderServlet </servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/config/cfgprovider/samplecfg.properties</param-value> </init-param> <load-on-startup>5</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Example_CFGProvider</servlet-name> <url-pattern>/Testsuite/components/BaSys/1.0/provider/cfgsm/*</url-pattern> </servlet-mapping>
The main configuration file of the CFG sub model provider contains the sub model meta data and sub model properties that are exported by the CFG sub model provider. The following properties are supported for describing sub model meta data. The provider makes sure that meta data is exported as conforming sub model meta data. For a more in depth description, please refer to <<<PDF>>>.
basyx.submodelID ID of sub model basyx.submodelSemantics Sub model semantics type (IRDI/Internal) basyx.semantics Sub model semantics basyx.idType Type of sub model ID (IRDI, URI, Internal) basyx.id Sub model ID according to idType basyx.idShort Short ID of the sub model (e.g. "subsystemTopology") basyx.category Additional coded meta information regarding the element type that affects expected existence of attributes (e.g. "transportSystemTopology") basyx.description Descriptive sub model description (e.g. "This is a machine readable description of the transport system topology") basyx.qualifier The qualifier of this sub model (e.g. "plant.maintransport") basyx.version Sub model version basyx.revision Sub model revision properties Configures the list of properties
For each property, the name, value, type, and meta data may be defined:
<propertyName> Defines value of property <propertyName>.type Defines property type <propertyName>.semanticsInternal Defines property semantics information meta data <propertyName>.category Defines property category meta data <propertyName>.description Defines property type meta data <propertyName>.qualifier Defines property qualifier meta data
Property types and meta data conform to the sub model definition described in <<<>>>.
Servlet configuration example
The following illustrates an example main configuration file with three properties and meta data:
# ############################################################## # Configuration sub model provider configuration file # ############################################################## # ############################################################## # Sub model provider configuration # Name of provided sub model basyx.submodelID = sampleCFG # ############################################################## # Sub model meta data # Sub model semantics type - supported type values are irdi, internal # - This value must be set if the basyx.* properties are to be parsed. If unsure, use "internal" basyx.submodelSemantics = internal # String that describes the sub model semantics e.g. its type (e.g. basys.semantics.transportsystem) basyx.semantics = basys.semantics.test.cfgfile # Type of sub model ID (Identification.IRDI, Identification.URI, Identification.Internal) basyx.idType = Identification.Internal # Sub model ID according to idType basyx.id = basys.components.testsuite.cfgTestSubModel # Short ID of the sub model (e.g. "subsystemTopology") basyx.idShort = CfgFileTestAAS # Additional coded meta information regarding the element type that affects expected existence of attributes (e.g. "transportSystemTopology") basyx.category = basys.components.tests.regression # Descriptive sub model description (e.g. "This is a machine readable description of the transport system topology") basyx.description = BaSys regression test file for CFG file provider # The qualifier of this sub model (e.g. "plant.maintransport") basyx.qualifier = basys.components.regression # Sub model version basyx.version = 1.0 # Sub model revision basyx.revision = 2 # ############################################################## # Exported configuration # List of exported properties properties = cfgProperty1,cfgProperty2,cfgProperty3 # Export property "cfgProperty1" and its meta data cfgProperty1 = exampleStringValue cfgProperty1.type = PropertySingleValued cfgProperty1.semanticsInternal = basys.semantics.internal.cfgProperty1 cfgProperty1.category = configurationProperty cfgProperty1.description = Configuration property description cfgProperty1.qualifier = basys.test.scope # Export property "cfgProperty2" and its meta data cfgProperty2 = 12 cfgProperty2.type = PropertySingleValued cfgProperty2.semanticsInternal = basys.semantics.internal.cfgProperty2 cfgProperty2.category = configurationProperty cfgProperty2.description = Configuration property description \ on multiple lines # Export property "cfgProperty3" and its meta data cfgProperty3 = 45.8 cfgProperty3.type = PropertySingleValued
CFG sub model provider Java example
The following code snippets illustrate the CFG sub model provider use from the JAVA SDK.
- Connect to CFG sub model provider via directory service. CFG sub model provider is available with ID CfgFileTestAAS.
// Connect to sub model "CfgFileTestAAS" VABElementProxy connSubModel = this.connManager.connectToVABElement("CfgFileTestAAS");
- Read property value from a property exported by CFG provider. When non-existint properties are read, a null object is returned.
// Get property value Object value1 = connSubModel.readElementValue("/aas/submodels/sampleCFG/properties/cfgProperty1/value");
- Read property meta data
// Get property meta data value Object value1meta = connSubModel.readElementValue("/aas/submodels/sampleCFG/properties/cfgProperty1/description");
- Read sub model meta data
// Get sub model meta data value Object subModelDescription = connSubModel.readElementValue("/aas/submodels/sampleCFG/description");
- Update propery or sub model value. The CFG provider supports changing, creating, and deletion of property values. It however does not back up properties to a persistent storage. Changes are therefore lost after the provider servlet is restarted.
// Update property value connSubModel.updateElementValue("/aas/submodels/sampleCFG/administration/version", "2.0");
- Create propery or sub model value. The CFG provider supports changing, creating, and deletion of property values. It however does not back up properties to a persistent storage. Changes are therefore lost after the provider servlet is restarted.
// Create property value connSubModel.createElement("/aas/submodels/sampleCFG/administration/version2", "3.0");
- Delete propery or sub model value. The CFG provider supports changing, creating, and deletion of property values. It however does not back up properties to a persistent storage. Changes are therefore lost after the provider servlet is restarted.
// Delete property value connSubModel.deleteElement("/aas/submodels/sampleCFG/administration/version2");
- Read complete sub model
// Get complete sub model Object value3 = connSubModel.readElementValue("/aas/submodels/sampleCFG");