Customizing Object References
This chapter describes how to customize:
-
References for Java-based workflows
-
References for Tcl-based workflows
References for Java-based Workflows
You can use references in the XML content definitions of all Java-based workflows.Java-based workflows consist of request workflows (Provisioning view group) and real-time workflows (Connectivity view group).References for Java-based workflows can occur anywhere in the XML content.To avoid constant repetition of definitions and also to be able to use variables from higher level sections in lower level sections you can use resolution variables.Resolution variables are stored in the section "resolutionVariables".Only one "resolutionVariables" section is permitted per XML node.
Reference Definition
A reference is a variable that is resolved and replaced during runtime by its value.
The syntax of a reference is:
${DN4ID(variable)@attribute@attribute@…@attribute}
where variable can be:
-
THIS - the actual object. Don’t define a resolution variable named THIS. It will replace the predefined THIS variable.
-
SUPERIOR - the superior object. Don’t define a resolution variable named SUPERIOR. It will replace the predefined SUPERIOR variable. The following example shows how Superior Domain Node is referenced from the Java-based Server object:
${DN4ID(SUPERIOR)@dxmSsl}
-
resVar - the name of a resolution variable.
-
superior-DN - the superior-DN meta attribute. Use this as an alternative to the predefined SUPERIOR resolution variable. The following example shows how to navigate two steps up:
grandparentOfChanelfolder="${DN4ID(THIS)@dxmSpecificAttributes(channelparent)@superior-DN@superior-DN@dxmDisplayName}
Using Simple References
Here are two examples for references:
The example:
${DN4ID(THIS)@dxmSpecificAttributes(ssl)}
Inserts the value of the specific attribute ssl of the actual object variable.
The example:
${DN4ID(mappingscript)@dxmContent}
Inserts the value of the dxmContent attribute of the mapping script resolution variable.
Access to Multi-value Attributes
Specifying $\{DN4ID(THIS)@description} returns always the first value of the description attribute. For multi-value attributes you can get all the values as comma separated list.
Specify the following constructs:
<description>${DN4ID(THIS)@description,mv}</description>
<resourcefamily>${DN4ID(THIS)@dxmSpecificAttributes(resourceFamily),mv}</resourcefamily>
The output may look like:
<description>desc2,Error Activity</description> <resourcefamily>LDAP,ABC</resourcefamily>
If mv is specified and only a single value is present the result is:
<description>Error Activity</description> <resourcefamily>LDAP</resourcefamily>
Resolution Variables
Resolution variables are defined in the section <resolutionVariables> with this syntax:
<resolutionVariables> <resolutionVariable name="..." value="..." .../> <resolutionVariable ... </resolutionVariables>
Each resolution variable represents exactly one LDAP entry (the LDAP entry is specified by an "identifying attribute")
Attributes of a resolution variable include:
-
name - the variable name. Use this name to reference the variable.
-
identAttr - the identifying attribute. This attribute defaults to cn. Use dn to identify the variable via the DN.(internally a baseobject search is performed).
-
value - the value of the identifying attribute that identifies the entry.
-
baseVar - the name of a resolution variable that represents the root. Under this root, the object must be unique. This attribute defaults to dxmc=DirXMetahub.
-
objectclass - the object class of the LDAP entry. This attribute defaults to *.
Technically, these attributes result in an LDAP search to get the corresponding entry.
Here are some examples of resolution variable that are used in the workflow element of a real-time workflow:
<resolutionVariables> <resolutionVariable name="topicSet" objectclass="dxmTopic" value="TOPIC_PROVISION_TO_TS" identAttr="dxmTopicName" /> <resolutionVariable name="activities" baseVar="THIS" objectclass="dxmIDMActivityDefinition" multivalue="true" /> <resolutionVariable name="workflow" equalsVar="THIS" /> </resolutionVariables>
The variable topicSet gets its value from the attribute dxmTopicName. The relevant object is searched under the node dxmC=DirXmetahub with the filter objectclass="dxmTopic" and value="TOPIC_PROVISION_TO_TS".
The activities variable is defined as a multivalue variable. It searches under the actual object (THIS) all objects with objectclass="dxmIDMActivityDefinition". This list can be used to load later on the XML content of all these objects to include it into the current XML definition.
Multi-value Resolution Variables
If a resolution variable may represent more than one LDAP entry (an array of entries) specifies the attribute "multivalue". This feature is used for the foreach processing instructions.
In the following example the resolution variable activities represents all LDAP entries with the objectclass dxmIDMActivityDefinition under the base object THIS:
<resolutionVariable name="activities" baseVar="THIS" objectclass="dxmIDMActivityDefinition" multivalue="true"/>
To access the entries use the [] operator specifying the index of the array. The array index starts with 0. The following example accesses the second entry of the resolution variable activities and returns the value of the dxmContent attribute:
${DN4ID(activities)[1]@dxmContent}
If you want to sort the result use the attribute
sortAttribute="attribute"
where attribute specifies the attribute that is used to sort the result. Only one attribute can be specified. Sorting is always performed in ascending order. This feature is used with framework filters. To keep the sequence constant a sequence number is specified for every filter. In the following example the dxmSequenceNumber attribute is used to sort the result:
sortAttribute="dxmSequenceNumber"
Meta Tags
Meta tags are used to avoid definition-specific Java implementations. These tags are only evaluated when the XML fragments are expanded and exported into the workflow server, and instruct the configuration manager to include content from LDAP attributes.
Initial content meta tags are stored as XML processing instructions <?IDMCONF … ?>. This notation indicates to the XML parser that these elements are to be evaluated by the application. "IDMCONF" is an identifier for the Identity Manager Configuration.
Include LDAP Attribute Tag
With the "INCLUDELDAPATTRIBUTE" operation, the content of an LDAP attribute of the same or another LDAP entry can be included:
<?IDMCONF INCLUDELDAPATTRIBUTE REF="${DN4ID(channel)@dxmContent}" ?>
The "REF" attribute expects a reference to the LDAP attribute. Note that the content of the included LDAP attribute has to be well-formed XML! It again has to be expanded the same way as the parent.
| The attribute may be multivalued. In this case, the include operation is performed in a loop for each value. |
You can use an extended notation:
<?IDMCONF INCLUDELDAPATTRIBUTE REF="${DN4ID(channel)@dxmContent}" PATH="template" ?>
If PATH is not present the whole XML document is exported.
Specifying PATH means to export the given path and its children. In this example, the element "template" and it’s children are exported.
Path is relative to the root element and path elements are separated by '/'.
Example:
<content contentType="ReplacementAttributeDefinition">
<template mappingType="constant" match="description">
<value>Test of the constant template</value>
</template>
</content>
To export the value element specify PATH="template/value"
Loop Tags
The operation "FOREACH" and "ENDFOREACH" allow for including values of several LDAP entries defined by a multi-value resolution variable in between a loop:
<?IDMCONF FOREACH channel IN ${channels} ?>
<this will be included for each value of variable ${channels} />
<?IDMCONF ENDFOREACH ?>
The content will be included for each value of the loop variable (here: ${channels}, which is assumed to be multi-value). This construct allows to follow multi-value LDAP references and include the content of a set of referenced LDAP attributes as part of an enveloping XML construct.
The included content is expected to be well-formed XML!
In the following example the multi-value resolution variable activities represents all LDAP entries with object class dxmIDMActivityDefinition under the base object THIS. In this example THIS represents a workflow object, for example a realtime workflow object with usually two activities: join and error.
For each LDAP entry (represented by the variable activity) in the list of all LDAP entries represented by the variable activities, for example returned by a search operation, the dxmContent attribute is expanded via the INCLUDELDAPATTRIBUTE tag, once for the join activity and once for the error activity.
<resolutionVariables>
<resolutionVariable name="activities" baseVar="THIS" objectclass="dxmIDMActivityDefinition" multivalue="true"/>
<activities>
…
<!-- insert activities from LDAP entries here! -->
<?IDMCONF FOREACH activity IN ${activities} content=<content><?IDMCONF INCLUDELDAPATTRIBUTE REF="${activity@dxmContent} ?&></content> ?>
</activities>
Conditional Include Tag
Use the if construct to insert a configuration section depending on an attribute of a resolution variable. The body of the if branch must be a syntactically correct XML structure (for example a complete XML section/tag).The if construct is like the XSLT if construct: there is no else branch.
The syntax is as follows:
<?IDMCONF if-begin test="resolutionVariable operator 'value'"?>*
xmlBopy
<?IDMCONF if-end ?>**
where
-
resolutionVariable is a resolution variable
-
operator is one of the following operators:
-
== string comparison for equality ignoring case
-
!= string comparison for non equality ignoring case
-
-
value is a constant text value
-
xmlBody is the conditional XML body specification.
In the following example, the connection’s support for SSL depends upon the specific attribute ssl:
<?IDMCONF if-begin test="${ssl} == 'true'"?>
${DN4ID(connectedDirectory)@dxmService-DN@dxmSecurePort}}
<?IDMCONF if-end ?>
<?IDMCONF if-begin test="${ssl} != 'true'"?>
${DN4ID(connectedDirectory@dxmService-DN@dxmDataPort}
<?IDMCONF if-end ?>
| With the component descriptions, it can be used the first time for individual properties, not just for complete XML elements. |
Include Attribute Mapping Tag
Attribute mappings in data-synchronization workflows are formulated as <attrMapping>, <idMapping> or <postMapping> within a XML <mappingDefinition> element. Here is an example:
<attrMapping name="sAMAccountName" mappingType="direct"> <value>dxrName</value> </attrMapping>
If the mapping is realized via Java code (mappingType="java"), the Java source code and the compiled unit are placed in extra LDAP entries. They lie underneath the channel entry identified by their attribute name. The compiled unit is found in the LDAP attribute "dxmCompiled" (see /1/). Exceptions: For <idMapping> a fixed Name “dxmIDMapping” and for <postMapping> a fixed name “dxmPostMapping” is used to identify the LDA entries ( because here is no attribute name available).
Such a construct makes the downloading more complex. Most of the XML can be taken as it is. Only if the mapping Type is "java", the corresponding AttributeMapping entry has to be read, and the content of the LDAP attribute "dxmCompiled" inserted as <code> sub-element. Here the resulting element:
<attrMapping name="sAMAccountName" mappingType="java"> <code>RMO8c3Nlb…GRvcmY=</code> </attrMapping>
Virtually the same is needed for identification mapping <idMapping> …
<idMapping type="urn:oasis:names:tc:SPML:1:0#DN" mappingType="direct"> <value>dxrPrimaryKey</value> </idMapping>
… and <postMapping>.
This transformation cannot be formulated with the above processing instructions. Therefore we introduce a new one named "INCLUDEATTRMAPP
<?IDMCONF INCLUDEATTRMAPPING REF="${DN4ID(THIS)@dxmAttrMapping}" ?>
The "REF" attribute expects a reference to the LDAP attribute, which holds one <mappingDefinition> element. The implementation has to replace the <value> element of all java-based mappings in <attrMapping>, <idMapping> and <postMapping> by the <code> element, which holds the compiled Java code.
| The content of the included LDAP attribute has to be well-formed XML! It again has to be expanded the same way as the parent. |
Include Specific Attributes as Property List Tag
DirX Identity holds some attributes as specific attributes at various LDAP entries. Important entries for the real-time workflows are: root node, configuration entry "dxmC=Configuration,dxmC=DirXmetahub", each connected directory and each channel. They are stored in the format "attributeName value".
Mapping in the real-time workflows makes use of a list of environment attributes. They are collected from several entries (listed above) and stored in the following XML format:
<property name="…" value="… "/>
The following processing instruction reads these specific attributes and stores them in this XML format:
<?IDMCONF INCLUDESPECIFICATTRIBUTE REF="$\{DN4ID(THIS)@dxmSpecificAttribute}" ?>
The "REF" attribute expands to an LDAP attribute in some entry, which contains the attributes in specific format.
Insert Conditional Attributes Tag
The value of some attribute may depend on the value of another property. For example, the target system port usually depends on the SSL flag of the bind profile. The insertCondAtt operation allows you to include referenced content on a condition. Here is an example:
<connection pagedRead="false" pagedTimelimit="0" pagesize="100"
password="${DN4ID(bindprofileTS)@dxmPassword}"
server="${DN4ID(targetSystem)@dxmService-DN@dxmAddress}"
type="${DN4ID(targetSystem)@dxmDirectoryType-DN@dxmType}"
user="${DN4ID(bindprofileTS)@dxmUser}">
<?IDMCONF insertCondAtt attName="port" test="${DN4ID(bindprofileTS)@dxmSSL} == 'true'"
true="${DN4ID(targetSystem)@dxmService-DN@dxmSecurePort}"
false="${DN4ID(targetSystem)@dxmService-DN@dxmDataPort}" ?>
<?IDMCONF insertCondAtt attName="ssl" test="${DN4ID(bindprofileTS)@dxmSSL} == 'true'"
true="true"
false="false" ?>
</connection>
In the example shown here, some attributes of the connection are fixed (pagedRead, password, …). The attributes port and ssl depend on the dxmSSL attribute of the bindprofile. The instruction inserts an attribute of the given name to the enclosing element (here connection). If the test expression matches then the attributevalue is set to the one specified after “true=” otherwise the value of false is taken. If the expression can’t be evaluated as the referenced attribute isn’t present, false is assumed.
The example shown here can be resolved to:
<connection pagedRead="false" pagedTimelimit="0"
pagesize="100"
password="{SCRAMBLED}QXNMJR50BlNzIXQsBCA3"
server="server11" type="ADS" user=”metatest@mh4.mycompany.de” port="636" " ssl="true“/>
Reference Scope
References defined in a ResolutionVariables section of Node X have the scope "X and all children of X".
Variables defined in a ResolutionVariables section of Node Y under Node X are valid in Node Y and all of its children.
If variable "a" is defined in Node X and Node Z, where the structure looks like this:
<x> (definition of resolution variable a) <y> <z> (another definition of resolution variable a) </z> </y> </x>
In this case, the first variable a is used in x and y. The second definition is only valid in z. There is no way to reference the variable "a" of Node X in or under Node Z.
Reference Resolution Errors
In the next example the dxmUrlPrefix and dxmSpecificAttributes(systemid) attributes have to be resolved:
<connection
type="Soap"
url="http://${DN4ID(connectedDirectoryCN)@...@dxmUrlPrefix}
.${DN4ID(bindprofileCN)@...@dxmType}">
<property
name="systemID"
value="${DN4ID(connectedDirectoryCN)
@dxmSpecificAttributes(systemid)}"
/>
...
If a resolution expression cannot be resolved, a warning is generated and by default the attribute is removed completely.
<connection type="Soap"> <property name="systemID" />
In the DirX Identity Manager the attribute name is inserted and surrounded with '#'.For example:
<connection type="Soap" url="http://machineA:1111/###@dxmUrlPrefix###.Notes"> <property name="systemID" value="###@dxmSpecificAttributes(systemid)###"/>
References for Tcl-based Workflows
You can extend connectivity configuration objects that relate to Tcl-based workflows with additional attributes (called "properties" in the DirX Identity Manager usage documentation) so that they are easily accessible for editing using DirX Identity Manager.These attributes and also the attributes from the standard DirX Identity schema can be referenced in command lines or text files (Ini files, Tcl script files).Using this generic mechanism guarantees consistency over the whole DirX Identity system.
The syntax for a reference description is XML-like:
<?_reference_/>
References can be simple or complicated constructs.If references retrieve values, then these values can contain references again.This allows you to set up a hierarchy of references.
Because references can be nested, DirX Identity does not allow more than 20 levels to avoid endless loops.
Reference description types include:
-
Single-value references
-
Multi-value references
-
Reference variables
This section describes these topics as well as the following reference description features:
-
Reference description abbreviation
-
Relative references
-
File name handling
Single-Value References
Single-value references include:
-
Fixed references
-
Variable references
Fixed References
DirX Identity uses the following fixed-value references:
-
<?Date/> - is replaced by the current date.
-
<?Time/> - is replaced by the current time.
-
<?Gmtime/> - is replaced by a timestamp representing the current date and time with respect to Greenwich Mean Time zone. The timestamp format is: 4 digits for the year, and 2 digits for month, day of month, hour, minutes and seconds. For example, October 12th, 2008 09:34:25, GMT is represented by the string 20081012093425Z.
-
<?Localtime/> - is replaced by a timestamp representing the current date and time with respect to the time zone of the machine hosting the C++-based server. The format is the same as for the reference <?Gmtime/>.
-
<?InstallPath/> - is replaced by the installation path stored in the relevant C++-based server object.
-
<?WorkPath/> - is substituted by the work path stored in the relevant C++-based server object.
-
<?DeltaInputData/> - is replaced by the delta information that DirX Identity delivers to agents. This tag allows a customer-specific agent to use this information. See the "Delta Handling" sections for further details.
Variable References
Another type of reference starts at a fixed object (set at runtime for the actual running workflow) and can follow any distinguished name an object contains to another object. This method produced relative references that are very reliable against structural changes in the configuration database.
References of this type have the following syntax:
<?StartObject@DistName@DistName@…@ValueSpec/>
The available StartObjects are:
-
Activity - the actual running activity when a workflow is running.
-
Configuration - a pointer to the configuration object in the configuration database.
-
Job - the actual running job when a workflow is running.
-
loopVar - the variable to handle multi value attributes in loops.
-
MappingFunctions - a pointer to the mapping function folder in the configuration object.
-
Workflow - the actual running workflow.
-
Root - a pointer to the root object of the Connectivity configuration.
Some of these objects are not static; they are determined by the C++-based server at runtime (for example: the current activity that is running at the moment determines the activity start object). The loopVar construct allows for the handling of multi-value attributes (see the section "Loops" for further details).
DistName is a distinguished name in the directory with three possible representations:
-
SingleValueAttribute - if it is a single value attribute. For example:
?Job@Agent-DN@… -
MultiValueAttribute[DisplayName] - if it is a multi value attribute and a specific value must be selected by using the display name. For example:
<?Job@OutputChannel-DN[MyFirst]@…> -
MultiValueAttribute[OtherAttribute=Value] - if it is a multi value attribute and a specific value must be selected by using any other attribute besides the display name. For example:
<?Job@OutputChannel-DN[Anchor=Mapping]@…>
|
DirX Identity is tolerant if you define a selection with [OtherAttribute=Value]. If only one element is present in the target list that does not have this attribute specified, this element is taken even if it does not fulfill the condition. No error is reported in this case. If the single element contains another attribute value, an error is reported. Example:
|
ValueSpec can be one of:
- SingleValueAttribute
-
a property name. For example:
?Activity@Description/ - MultiValueAttribute(Name)
-
allows for the extraction of values from a list of name / value pairs separated by a space character. For example:
<?Job@SpecificAttributes(Trace)/> which extracts the value from a name/value pair (for example, if the value is 'Trace On', it retrieves 'On' as the value). - SubstringAttributeValue
-
here we have several possibilities:
- Attribute[start:end]
-
allows you to extract a part of the string. For example:
<?Activity@Description[0:9]/> with Description='This is my description' evaluates to 'This is my'. Note that the first character is accessed by the value 0. Start or end may be empty ([:5] or [5:]).
- Attribute.$n or Attribute.name
-
to extract specific parts of the string (parts are separated by blanks).
For example: <?Job@SpecificAttrib…/>-
'… utes.name(Trace)' with 'Trace Enabled' evaluates to 'Trace'
-
'… utes(Trace).$0' with 'Trace Enabled' evaluates to 'Trace Enabled'
-
'… utes(Trace).$1' with 'Trace Enabled' evaluates to 'Trace'
-
'… utes(Trace).$2' with 'Trace Enabled' evaluates to 'Enabled'
-
'… utes(Trace).$2[1:2] ' with 'Trace Enabled' evaluates to 'En'
If the n-th field does not exist, an empty string is returned. -
Additional specifiers for ValueSpec can be used to handle special situations:
- $default
-
allows you to define a default value when the attribute or one of the defined DistName references could not be retrieved.
-
…SingleValueAttribute($default="value")
-
…MultiValueAttribute($default="value")
Examples:
-
…@FileName($default="data.ldif")
-
…@SpecificAttributes(Trace,$default="0")
-
…@OutputChannel-DN@FileName($default="data.ldif") → will succeed even if no output channel is present.
-
| If DirX Identity encounters a broken DN reference or has problems reading a defined DN reference, the reference resolution will report an error. |
Multi-Value References
MultiValueProperties can be handled with:
-
A default mechanism
-
Loops
Default Mechanism
If an attribute at the end of the reference chain contains multiple values, all values are concatenated using the comma as separator.
If an [index] range is defined for creating a substring of the attribute value, each value of the substring is built prior to concatenation of the values.
Example:
SpecificAttributes='a b;c d;e f'
<?Job@SpecificAttributes/> evaluates to 'a b,c d,e f'
<?Job@SpecificAttributes[1:1]/> evaluates to 'a,c,e'
Loops
Loop constructs provide a special handling mechanism. These definitions allow the system to extract a variable loopVar which can then be used in a cmdline construct to define exactly how it looks.
<?loop loopVar=<?object…@multivaluedAttribute/>
cmdline="… <?loopVar@object …@attribute($specifier,$specifier,…)/> …"
/loop>
Note that no newline is written at the end of the cmdline. If a newline is required, it must be written as \n. In a cmdline expression, the following quoting applies:
\n → newline
\t → tab
\r → carriage return
\\ → \
In all other cases, \c yields c, the character itself. Note that a cmdline expression ending in \\\n will result in a backslash at the end of the line.
Possible definitions in the cmdline are:
<?loopVar/>
<?loopVar.name/>
<?loopVar.$n/>
<?loopVar[start:_end_]/>
<?loopVar.$n[start:_end_]/>
Additional specifiers for ValueSpec can be used to handle specific situations:
-
$default - allows you to define a default value when the attribute could not be retrieved.
…SingleValueAttribute($default="value")
…MultiValueAttribute($default="value")
Note: Using this feature extensively might lead to strange behavior because errors in the configuration (for example missing values) are no longer detected. -
$sorted - allows you to sort the result that is returned from the loopVar expression. This is especially useful to sort the SelectedAttributes for a CSV workflow. The SelectedAttributes list contains a leading number, which is used for sorting, and which is automatically removed before used in the cmdline expression.
This option can be used in combination with other options (for example $optional). Then the options must be separated by a comma. -
$optional - allows you to define whether the result that is returned from the loopVar expression must contain 0 to n or 1 to n values. In the first case, no error is reported when the multi-valued attribute does not contain a value.
This option can be used in combination with other options (for example $sorted). The options must then be separated by a comma.
<?loop loopVar=?Job@dxmTCLFurtherScript_DN/>
cmdline="source \"<?loopVar@dxmFileName($optional)/>\""
/loop>
This loop creates source statements out of the TCLFurtherScripts objects at the job. Using $optional bewares of error messages if the job does not contain a TCLFurtherScript.
If the attribute dxmSelectedAttributes contains the values:
SN surname
GN givenName
Tel phone
then the specification:
returns the string
SN,GN,Tel
and
<?Job@InputChannel_DN@SelectedAttributes.$2/>
results in
surname,givenName,phone
In both cases error messages are generated when the SelectedAttributes are empty. Use $optional to avoid this situation.
A loop over all the values of the previous attribute:
<?loop loopVar=<?Job@InputChannel_DN@SelectedAttributes/>
cmdline ="<?loopVar.name/>=<?loopVar.$2/>\n"
/loop>
can be used to create the result:
SN=surname
GN=givenName
Tel=phone
Also in this case an error is produced when the SelectedAttributes list is empty. You can avoid this situation in two ways:
<?loop loopVar=<?Job@InputChannel_DN@SelectedAttributes($optional)/>
cmdline ="<?loopVar.name/>=<?loopVar.$2/>\n"
/loop>
With $opional set no cmdline is generated.
<?loop loopVar=<?Job@InputChannel_DN@SelectedAttributes($default="sn surname")/>
cmdline ="<?loopVar.name/>=<?loopVar.$2/>\n"
/loop>
With $default set a fixed commandline is generated:
sn=surname
References in References
DirX Identity supports two mechanisms:
-
Variables
-
Hierarchical References
Note: Nested references are only supported to a depth of 20. Otherwise an error is reported. This prevents infinite loops.
Variables
To enhance readability of scripts with references, variables can be defined. First, the variable must be defined at the beginning of the script:
<?set var=any_string/>
where var defines the name of the variable and reference can be any string or reference definition. Then the variable can be used:
<?$var/>
The set statement produces a resolved line as output. Therefore you should place it into a comment line of your configuration file. This is especially useful for debugging. Alternatively you can use the set_non_verbose statement that suppresses the output line completely.
<?set_nv var=any_string/>
The scope of the variable definition is limited to the current object being processed with the reference mechanism. Variables declared in INI file templates are neither known to Tcl scripts, nor to attribute configuration files.
Variables declared in Tcl scripts are accumulated. Since Tcl scripts are processed in the order "Tcl control script", "Tcl mapping script", "Tcl further script", and "Tcl profile script", variables defined in the control script are also known in the mapping script or in the profile script.
In case of recursively-defined tags, the variables are propagated top-down and bottom-up.
Definition: <?set_nv src=rh_<?Job@InputChannel-DN@RoleName/>/>
Usage: …<?$src/>
As shown in the example, variable definitions may contain tags.
# <?set timestamp=<?date/>-<?time/>/>
# <?set workflow=<?Workflow@DisplayName/>/>
# <?set started=<?$workflow/> started at <?$timestamp/>/>
# <?$started/>
In this case, the tags are evaluated recursively, e.g.
# <?set timestamp=2002-05-23-15:14:39/>
# <?set workflow=ADS2Meta/>
# <?set started=ADS2Meta started at 2002-05-23-15:14:39/>
# ADS2Meta started at 2002-05-23-15:14:39
# <?set timestamp=\<?date\/>-\<?time\/>/>
# <?set workflow=\<?Workflow@DisplayName\/>/>
# <?set started=\<?$workflow\/> started at \<?$timestamp\/>/>
# <?$started/>
This example shows that you can also define tags in the variable values that are evaluated when the variable is referenced, rather than during variable definition. For this purpose, the tags <? and /> have to be escaped using \ as escape character.
This sequence is evaluated to:
# <?set timestamp=<?date/>-<?time/>/>
# <?set workflow=<?Workflow@DisplayName/>/>
# <?set started=<?$workflow/> started at <?$timestamp/>/>
# ADS2Meta started at 2002-05-23-15:14:39
Hierarchical References
Hierarchical references can be used to set up a flexible parameter concept.
Let’s assume a Tcl script needs the parameter base_obj. The reference points to a specific attribute in the output channel of a job.
-
(1) set base_obj "<?job@OutputChannel-DN@SpecificAttributes(base_obj)/>"
The referenced attribute can contain again a reference to a central parameter located for example in the central configuration object:
-
(2) base_obj <?Configuration@SpecificAttributes(base_obj,$default="o=pqr")/>
In this case the Configuration object should contain for example an entry "base_obj ou=people,o=pqr". Then this value is delivered to the previous construct (2) and in a second step provided to the Tcl line via (1).
If no entry is available in the Configuration object then the default value "o=pqr" is used from (2).
If the central value shall no longer be used then a fixed value can be entered into (2), for example base_obj c=DE.
Abbreviating Reference Descriptions
Since almost all the attributes in the Connectivity configuration subtree dxmc=DirXMetahub start with the prefix "dxm", this prefix can be dropped.
Example:
<?Workflow@dxmMetahubSyncServer_DN@dxmServer_DN@dxmAddress/>
can be written more elegantly and shorter:
<?Workflow@MetahubSyncServer_DN@Server_DN@Address/>
If an attribute name is requested from the DIT that does not have the prefix dxm, and this attribute does not exist in the search result, the value of attribute dxmname is taken. If the attribute dxmname is not found in the search result, it is reported to be missing (if no $default or $optional specifier is used).
Using Relative References
If strings are to be concatenated, an attribute can be referenced relative to the object that has been defined to get the previous attribute value. You can then define a relative reference (it starts with an @):
Example:
<?Workflow@dxmMetahubSyncServer_DN @dxmServer_DN@dxmAddress/>:
<?@dxmDataPort/>
File Name Handling
For the attribute "…@dxmFileName" or "…@FileName" the absolute path name of the referenced file is created automatically by the C++-based server. The working path of the activity and the installation path is included. Also the channel mapping is taken into account to calculate the correct path.
| File names can also contain reference tags. |
Complex Example
The following example demonstrates the power of the tag syntax. The use of variables and nested tags is demonstrated. To simplify the documentation, line numbers are added which must not be present in a real code example. Because some lines are very long, they are wrapped, which is indicated by a "/" character which is also not part of the real code. The example is used in the DirX Identity default applications to build the encrypted attributes section in configuration files.
[EncryptedAttributes] 1 <?loop 2 3 loopVar=<?Workflow@Activity-DN[IsStartActivity=TRUE]@RunObject-DN@ / OutputChannel-DN[Anchor=DATA]@SelectedAttributes($sorted)/> 4 5 cmdline= 6 "<?set_nv innerLoopCmd=\<?loop 7 8 Loopvar=\<?Job@InputChannel-DN@ConnDir-DN@AttrConfigFile-DN@ / AttrConfigItem(Abbr:<?loopvar.name/>,$optional)&($7=Encryption:Y).$3[8:$-2]\/> 9 10 Cmdline=\"\<?Loopvar.name\/>=1\" 11 12 \/loop>/><?$innerLoopCmd/>" 13 14 /loop>
The whole expression serves to create the encrypted attributes section of an ini file. In step one, all selected attributes of the output channel have to be determined. In the second step, the AttrConfigItems of the connected directory are evaluated.
Then, for each selected attribute obtained in step one, it is checked whether the AttrConfigItem of this attribute is encrypted. In this case, the name is extracted from a substring of the third field of the item. This name then is printed and followed by "=1", resulting for example in a statement like "password=1".
To get all selected attributes of the output channel, a loop is opened in line 1. The loopVar has the assigned attribute "selectedAttributes" of the output channel object, whose (multi-valued) entries are sorted (defined by option $sorted).
The command line is executed once for each value contained in "SelectedAttributes". It contains two actions: Setting of variable "innerLoopCmd" (line 6). This setting ends with the closing tag in line 12.
The second action is evaluating this variable. Since the result of the evaluation is a loop statement, this (inner) loop then is executed. Note, that we have constructed a nested loop here that makes use of variables, what is normally not supported by the tag syntax.
The inner loop statement starts with \<?loop in line 6 and ends with \/loop> in line 12. The tags have to be escaped by \, otherwise it would interfere with the outer loop.
The loopVar of the inner loop has assigned the AttrConfigItem (multi-valued) attribute of the outputchannel object. From this multi-value attribute, the line assigned to the selected attribute contained in the loopVar defined in line 3 is extracted.
This is done by the statement …@AttrConfigItem(Abbr:<?loopvar.name/>,$optional) … in line 8. The <?loopvar.name/>-Tag in line 8 is nested into the <$set_nv tag starting in line 6. Since nested tags are evaluated from inside to outside, first the value contained in the outer loopVar (e.g. "password") is replaced in the expression.
Then the whole expression is assigned to the variable "innerLoopCmd". The AND-relation to the Encryption flag is done with "&($7=Encryption:Y)" in line 8. Thus, for SelectedAttributes contained in AttrConfigItem flagged with "Encryption:Y" the line is chosen and a substring of the third field $3 is extracted.
Defining the range $3[8:$-2], 8 characters are cut from the left and two characters are cut from the right, extracting exactly the name from the expression.
In the commandline of the inner loop (line 10), the expression <?LoopVar.name/>=1 is written. Loopvar is either empty (in case the expressions in line 8 do not match) or does contain exactly one value, the name of the attribute to be encrypted.
In case of an empty loopVar, no output is written. In case the loopVar contains the name, the expression <name>=1 is written.
Thus, the whole complex expression evaluates to an empty string or for example to something like "password=1".