Token elements

The Token element outputs a string segment. All output string segments for a given rule are concatenated in the order that they are specified. This creates the string rule output for the event, notification, labeling, and cross namespace naming rules. Many of the Token element parameters work together to control the behavior of the rule engine. These related parameters are described below.

Purpose

The rule engine is directed to the current node by the nested Relationship elements. The actions performed by theToken element are performed on the current node. If the Token element exists outside any Relationship element, it acts against the parameters of the root instance, the instance that was mapped to the policy.

Parameters

The following are the parameters for the Token element. For purposes of these descriptions, the term string refers to the value of the attribute identified by the Token keyword attribute which the parsing function acts on:

keyword and value parameters
These parameters define the string value that is output as a string segment.
  • When the keyword is set to ATTR, the value is set to the attribute name that is to be output.
  • When the keyword is set to LITERAL, the value is the literal that is output as the string segment
  • When the keyword is set to FUNC, the value can be set to class, shortclass, or label which results in, respectively, the class name of the current resource, the rightmost part of the class name, and the display label of the current resource.
  • When the keyword is set to SOURCETOKEN and the value is set to a particular product name that provides the source token value along with their resource, attribute, and relationship data, the rule engine outputs the source token value for the resource.
case (optional)
The case parameter instructs the rule engine to apply the specified case to the output string. The possible values are UPPER and LOWER.
The token, delimiters, and string_delimiter optional parameters allow the string outputted by the Token element to be manipulated before it is output.
token (optional)
The token parameter instructs the rule engine how to manipulate a string before it is it outputted. Optional values for this parameter are contained in the ScrConfig.xml file include first, last, allButFirst, allButFirstTwo, allButFirstTwo, allButFirstTwo, firstTwo, lastTwo, findMatchOccurrence, format, excludeString, getExecutable, and javaRegexReplace. The token attribute works in conjunction with the delimiters and string_delimiter attributes.
delimiters (optional)
The delimiters parameter specifies the delimiter used by the rule engine to break up the string. If more that one character is provided anyone of them causes the string to be broken up into segments. The default is a (.). Examples of other values include @, |, and :.
string _delimiter (optional)
The string_delimiter parameter tells the rule engine to treat its value as a single delimiter. For example, you can use the string atto break up the string abbyatthispace into two tokens abby and this place.
A Token element can also use regular expression behaviors to extract data from a resource attribute value:
javaregex and occurrence parameters
The javaregex and the occurence parameters cause the nth matching region or occurrence of a regular expression within the input attribute value string
javaregex =	"a.b" occurrence=1
			input string = 	"aababbacbadb" 
			
This returns aab.
javaregex and format parameters
The form of the substitute pattern in the format string is ${n} where n represents the nth matching occurrence of the regular expression in the incoming string. You will always get an output so you must test the string if necessary to first detect if it should be acted upon. An example of this is:
<Token keyword='ATTR' value='cdm:Name' javaregex="a.b" 
format="This ${1} and that ${2}" />		    
If the input attribute value string, the value of the cdm:Name attribute for the current resource, is aabcccccabbacbadb then the output string segment would be This aab adn that abb.
javaregexreplace
This regular expression replaces regular expressions in the format string with the matched regions in the incoming string.
An example of this is:
            javaregexreplace="This ${a.b, 2} and that ${a.d, 2}" 
            input string = 			"aababbaadabd" 
                 			

Optionally, a condition element can be contained by, or is a sub-element of, the Token element. In this case the parameter that the condition is acting upon is defined by the string being outputted by the attributes of the Token element.