Atomia provisioning element transformations
Atomia Provisioning element transformations allow the one who writes the provisioning description to use expressions in order to transform service property values. There are two types of transformations:
- Parameter value transformations
- Input property value transformations
Parameter value transformations
Parameter value transformations are used to define expressions used for generating part service property values. They can be used when part services are defined within a complex service or within the initialization section of a complex service, see Simple service description.
Transformation expressions can be composed of literals, special characters, service property values, service resource properties and account properties.
- Special characters:
- + – String concatenation:
<serviceProperty name="Dir"> <!-- in this expression, value of the property after the transformation will be 'abcdef' --> <expression>abc+def</expression> </serviceProperty>
- $ – Provisioning service selector. When put before a literal, the system will assume the literal to be a complex service name. It is used to access the complex service owner of the part service. This literal cannot be the name of the simple service but rather a complex service. To access the parent simple service use the service path special character / as in the following example:
<serviceProperty name="Label"> <!-- in this expression, value of the property DomainPrefix of the CsMailSupport complex service is used as a value for the Label property. --> <expression>$CsMailSupport::DomainPrefix</expression> </serviceProperty> <serviceProperty name="Data"> <!-- in this example, simple service MailService is part service of the CsMailSupport and parent service for the service, owner of the Data property. --> <!-- value of the DomainData property of the MailService service is used as a value for the Data property. --> <expression>$CsMailSupport/MailService::DomainData</expression> </serviceProperty>
- / – Service path. Used for constructing service paths in expressions.
<serviceProperty name="Label"> <!-- in this expression, value of the property DomainPrefix of the CsMailSupport complex service is used as a value for the Label property. --> <expression>$CsMailSupport/$MailDomain/$MailService::DomainPrefix</expression> </serviceProperty>
- :: – Parent complex service property accessor, used for accessing service property values. It allows you to include parent complex service property in expression values.
<serviceProperty name="Label"> <!-- in this expression, value of the property DomainPrefix of the CsMailSupport complex service is used as a value for the Label property. --> <expression>$CsMailSupport::DomainPrefix</expression> </serviceProperty>
- . – This character is used for accessing properties or resource properties of a specific service instance (check list of key words below).
<serviceProperty name="Data"> <!-- MailDomainInstance is the name of the service instance, property of which is going to be used. --> <expression>#Instance(MailDomainInstance).MailIpAddress</expression> </serviceProperty>
- \ – Escape character. Used for escaping all special characters.
<serviceProperty name="Path"> <expression>\\public_html\\index\.html</expression> </serviceProperty>
- ( and ) – Used when creating complex expressions to force evaluation order, just as in any programming language.
<serviceProperty name="Path"> <expression>($CsMailSupport::DomainPrefix and $CsMailSupport::Name) eq (some_value)</expression> </serviceProperty>
- + – String concatenation:
- Operators
- Used for expressions that should represent some kind of condition.
- and – Logical
and
operator. - or – Logical
or
operator. - eq – Equality operator.
- neq – Not-equal operator.
- lt – Lower then operator.
- gt – Greater then operator.
- le – Less or equal operator.
- ge – Greater or equal operator.
<serviceProperty name="Path"> <expression>($CsMailSupport::IsActive and $CsMailSupport::IsComplex) eq ($CsMailSupport::StatusFlag or "true")</expression> </serviceProperty>
- and – Logical
- .. – Parent service operator. Used when constructing service paths in expressions. It has similar meaning as “../” in folder path, that is, it tells system to go one service up in the service hierarchy.
<serviceProperty name="Path"> <expression>$../../$CsWebSite::Name</expression> </serviceProperty>
- Used for expressions that should represent some kind of condition.
- Keywords
- #Instance() – If there is more than one child in the service instances that appears in the service path, the service path cannot be successfully resolved and in that case the “instance name” should be used. It accesses a specific service instance in order to get its property values as needed for the value transformation. This keyword acts as a command and requires one argument to be passed. This argument is the name of the instance, property of which are needed:
<add partName="MailDomain" instanceName="MailDomainInstance"> ... <add partName="DnsZoneRecord" > <initPropertyList> <propertyTransformation> <simpleTransformer> <serviceProperty name="Data"> <expression>#Instance(MailDomainInstance).Resource.MailIpAddress</expression> </serviceProperty> </simpleTransformer> </propertyTransformation> </initPropertyList> </add> </add>
- #Account() – Represents account id, owner of the service.
- null – Keyword
null
represents null value.
- #Instance() – If there is more than one child in the service instances that appears in the service path, the service path cannot be successfully resolved and in that case the “instance name” should be used. It accesses a specific service instance in order to get its property values as needed for the value transformation. This keyword acts as a command and requires one argument to be passed. This argument is the name of the instance, property of which are needed:
Input property value transformations
Input value transformations are used to transform service property values the moment when they are specified. Expressions are written in the same manner as for property value transformations.
<simpleService name="Name" providingModule="ModuleName"> <propertyList> <property name="PropertyNameForService" > <inputValueTransformation>literal\.+$Service::Property</inputValueTransformation> </property> <propertyList> </simpleService>
Specifying service path:
Expressions use service path whenever a service property value is needed. Service path system is very similar to directory paths. Generally speaking, there are two types of service paths:
- Absolute path – Path begins with
/
. First service in the path must be root service.<serviceProperty name="SomeProperty"> <expression>/$RootComplexService/$ComplexService2/$SimpleServiceRoot2/$SecondChild1::ChildProperty1</expression> </serviceProperty>
- Relative path – Path begins with service name. By default, all service paths are treated as if the begin from the complex service owner (in example below that is
ComplexServiceOwner
). Complex service owner is a complex service that “owns” part service description, for which we are calculating expression (see example below). In case that path begins with$this
service path is evaluated starting with service for which expression is evaluated (in example below that isServiceWithExpressions
).<complexService name="ComplexServiceOwner"> <complexServicePropertyList> <complexServiceProperty name="CProp1" storeType="encrypt"/> </complexServicePropertyList> <partList> <partService name="ServiceWithExpressions"> <propertyTransformation> <simpleTransformer> <serviceProperty name="SRootProp1"> <expression>$ComplexServiceOwner::CProp1</expression> </serviceProperty> <serviceProperty name="SRootProp2"> <expression>$../::CProp1</expression> </serviceProperty> <serviceProperty name="SRootProp3"> <expression>$this/$../$../SomeOtherService::CProp1</expression> </serviceProperty> </simpleTransformer> </propertyTransformation> </partService> </partList> </complexService>
A service name in service path can be described in following forms:
- Concrete service name (type 1) – i.e. $ComplexService1 (in this case, system will try to find service
ComplexService1
as child service of the current service in the path). - $this (type 2) – represents service for which expression is evaluated.
- $.. (type 3) – represents parent service of the current service in the path.
- $Instance (type 4) – works similar as
#Instance
keyword. Finds child service with given instance name.
In case of concrete service names and instance names (types 1 and 4) it is possible to additional specify service by setting properties to filter:
<serviceProperty name="ChildProperty2"> <expression>$../$ComplexService1/$Instance(Ins1)/$FirstChild[ChildProperty1="value1"]::ChildProperty1</expression> </serviceProperty> or <serviceProperty name="ChildProperty2"> <expression>$../$ComplexService1/$Instance(Ins1[InstanceProperty1="value1"])::InstanceProperty1</expression> </serviceProperty>