+

Search Tips   |   Advanced Search

Expressions

Security Directory Integrator provides the v.6-compatible Expressions feature that allows you to compute parameters and other settings at run time, making the solutions dynamically configurable. This feature expands on the Properties handling found in previous versions.

In addition to support for simple External Properties references (fully compatible with earlier versions), Expressions provide more power in manipulating AssemblyLine and component configuration settings during AL or component initialization and execution. Expressions can also be used for Attribute maps, as well as for Conditions and Link Criteria, alleviating much of the scripting previously required to build dynamically configured solutions. IBM Security Directory Integrator provides an Expression Editor to facilitate building these expressions.

The Expressions feature is built on top of the services provided by the standard Java java.text.MessageFormat class. The MessageFormat class provides powerful substitution and formatting capabilities. Here is a link to an online page outlining this class and its features: http://docs.oracle.com/javase/1.6.0/docs/api/java/text/MessageFormat.html.

Note: The MessageFormat based Expressions shown in this section were the cornerstone of parameter substitution in SDI v.6; in v.7 best practice is to use Advanced (JavaScript) expressions instead. In addition to features described in the above class, SDI provides a number of runtime objects that can be used in expressions—although the availability of some objects will depend on runtime state; for example, whether conn or current defined, or the error entry. The Expressions syntax provides a shorthand notation for accessing the information in these objects, like Attributes in a named entry object, or a specific parameter of a component.

Table 1. Script objects, their usage and availability.
IBM Security Directory Integrator reference Value Availability
work.attrname[.index] The work entry in the current AssemblyLine.

The optional index refers to the nth value of the attribute. Otherwise the first value is used.

This Advanced attribute map:

  ret.value = work.getString
	(“givenName”) +            
		“ “ +                      
		work.getString(“sn”);
can be expressed simply as:
{work.givenName} {work.sn}
AssemblyLine
conn.attrname[.index] The conn entry in the current AssemblyLine.

The optional index refers to the nth value of the attribute. Otherwise the first value is used.

AssemblyLine during attribute mapping
current.attrname[.index] The current entry in the current AssemblyLine

The optional index refers to the nth value of the attribute. Otherwise the first value is used.

AssemblyLine during attribute mapping for Modify
config.param The configuration object of the current component AL. Furthermore, if config is used in the parameter of a Connector, Parser or Function, then it refers to the Config object Interface of that component, for example, JDBC Connector, or XML Parser.

param is the name of the parameter itself, as if you were to make a call to getParam() or setParam(). For example, for the JDBC Connector you could make the following reference:

 {config.jdbcSource]	

AssemblyLine
EventHandler
Connector
Parser
Function Component

alcomponent.name.param The component Interface parameter value of a named AssemblyLine component.

name is the name of the AssemblyLine component

param is the parameter name of the name object

So, the following Expression:

{alcomponent.DB2conn.jdbcSource}
is equivalent to the following scripted call:
DB2conn.connector.getParam
	(“jdbcSource”);
AssemblyLine
property[:storename].name

property[:storename/bidi].name

A TDI-Properties reference.

The optional storename targets a specific Property Store. If no storename is specified, then the default store is used.

name is the property name

bidi will, when present, set the parameter value to forward the call to the referenced Property Store. When bidi is present no other substitution patterns or text is allowed.

Always

JavaScript<<EOF
  script code …  
// Must contain “return”
EOF

Note: v.6 syntax; use Advanced (JavaScipt) option in the Expression Editor instead

Embedded script code used to generate a value for the Expression. This script must return a value.

The “EOF” text used here is an arbitrary string that terminates the JavaScript snippet. The JavaScript is collected until a single line with the EOF string is encountered, or no EOF is flag is set – see the note below.

Note that embedded JavaScript is evaluated using the script engine instance of the AssemblyLine, so you have access to all variables otherwise present for scripting. Note: There is a shorthand form of adding JavaScript that works for input fields that do not support multiple lines (like Link Criteria or the names of Attributes in maps) and can therefore not have the necessary EOF line:

{JavaScript return work.givenName
	+ " " + work.surName} 
Always
Embedded JavaScript in Expressions have access to the script engine of the AssemblyLine. As a result, even script variables defined elsewhere in the AssemblyLine can be accessed. Note that if you reference a variable or object that is not one of those specifically listed in the tables shown in this section, the Expression evaluator will check with the script engine of the AL to see if it is defined there.


Parent topic:

General Concepts