Sun Identity Manager Deployment Reference

About the XPRESS Language

XPRESS is a functional language that uses syntax based on XML. Every statement in the language is a function call that takes zero or more arguments and returns a value. Identity Manager provides a rich set of built-in functions, and you can also define new functions. XPRESS also supports the invocation of methods on any Java class and the evaluation of JavaScript within an expression.

Prefix Notation

The XPRESS language makes no distinction between a function call and what languages such as C refer to as an expression operator. This results in a syntactical style known as prefix notation. Prefix notation differs from the more common infix notation in that the operator of an expression is written first, followed by the operands. For example, consider the following simple logical expression written in C using infix notation:

x == 42

If C used prefix notation, the previous statement would be written:

== x 42

If C provided no expression operators and instead supplied only functions, the statement could be written as follows:

equals(x, 42)

Prefix notation is easily understood if you think in terms of calling functions rather than writing expressions.

XML Syntax and Example

XPRESS uses an XML syntax that is easy to parse and manipulate and can be embedded naturally in other XML vocabularies used within Identity Manager. The names of the XML elements are the names of functions to be called. Nested elements are the arguments to the function. In addition, there are beginning and end tags for each element (in this case, <add></add>).


<add> <ref>counter</ref> <i>10</i> </add>

In the preceding example, the <add> element represents a call to the function named add. This function is passed two arguments:

The value returned by the add function will then be the result of adding the integer 10 to the current value of the variable counter. Every function call either returns a value or performs an operation on one of its arguments. For example, if the ref call returns the value of the counter, then the <i> call returns the integer 10, and the <add> call returns the addition of the two calls.

Another example is the classic Hello World program, which is written in XPRESS as follows:

<print><s>Hello World!</s></print>

Integration with Identity Manager

Although XPRESS can be used with a standalone interpreter, it is typically embedded within an application that wants to use XPRESS statements to control or customize their behavior. This application is called the host application. Two of the more important host applications within the Identity Manager system are workflow and forms.

The host application makes calls to the XPRESS interpreter and supplies services to the interpreter. One of the more important services that the host application provides is the resolution of external variable references. Expressions often reference variables that are not defined within the expression, and the host application must then provide the values of these variables. In the case of the workflow host application, an expression can reference any variable defined within the workflow process. In the forms host application, an expression can reference the value of any form field or defvar whose value is set before the expression is evaluated.

Why Use Expressions?

Expressions are used primarily for the following tasks:

For information on using expressions in workflow scripts or editing forms, see Chapter 1, Workflow.