Extensions.DataType.ResourceLocation

From emotive
Jump to navigation Jump to search

Classification

Name ResourceLocation
Short Description User-defined enumeration
Class Simple Data Type
Base Data Type SimpleType
Default Value Empty
Provide a Literal Yes
SpecifiedBy ISO 13209-4
Standard Compliant Yes

Description

In some use cases, an OTX sequence needs to address certain resources, e.g. XML files, text documents, pictures etc. If this is the case, each resource have to be addressable by a location. The location itself will not be part of the test logic, because it can be different in different runtime environments.
A ResourceLocation represents a string value which addresses a location of a resource associated with an ID. At runtime it can be mapped via an appropriate mapping mechanism to a real address. If the related resource ID cannot be mapped, because a possible mapping table does not contain the ID or the runtime does not support a mapping mechanism, the location is the default location. If no default location is specified, the location is an empty string.

Icons Note.png IMPORTANT — The mapping mechanism is not part of the standard.

When applied to a ResourceLocation, the otx:ToString term will return the location of the ResourceLocation.
Its members have the following semantics:

  • <init> : ResourceLocationLiteral[0..1]
This optional element represents the hard-coded value from which the declared resource will be created. It includes an id which uniquely identifies the resource, an optional default path which is used, if no path was mapped and an optional descrption of the resource type.
Icons Note.png IMPORTANT — If the ResourceLocation declaration is not explicitly initialized (omitted <init> element), the default path will be an empty string.

Literal

The syntax for Literals for complex data types will be used, where the member value is one of the values in the list.

@ResourceLocation:"ID_1"/"D:\file_sample.txt"

Core Conversion

The following table shows the rules for conversion to another data type:

Conversion Result Sample
ToBoolean Undefined (should not be used)
ToInteger Undefined (should not be used)
ToFloat Undefined (should not be used)
ToString Undefined (should not be used)
ToByteField Undefined (should not be used)

Sample

DataType.ResourceLocation ResourceLocation1 = @ResourceLocation:"ID_1"/"D:\file_sample.txt";