Pipes execute sequentially and often require data from previous pipes to perform their tasks. Therefore, you need to be able to pass information in and out of pipes. This is done by defining the type of information you want to pass in or out and where the information is coming from or going to.
There are five types of values that can be passed in and out of pipes:
The key prefix indicates the property value can be used to set a value into the data bucket or access an existing object in the data bucket. For example, key:incomingform.jxpath
Allows you to create a dynamic expressions using XPath. JXPath allows XPath expressions to traverse the DOM, and also other types of data including allowing access to everything that is in the data bucket. The data bucket itself is available at jxpath:$data
, and using the JXPath nomenclature, you can access things such as the Request Path info with jxpath:$data/Request/PathInfo
The XPath expression uses the pipe as its root. The contents of the data bucket are added to the XPath context under the variable $data
. For example, if you wanted a dynamic string (such as a namespace) that changes based on a command parameter, you could type:
jxpath:concat('http://your_company/', $data/info/command, '/1.0')
is the data bucket, the /info
segment is resolved as theMap.get('info')
, which returns a CommandInfo
class. The /command
segment is then resolved as the getCommand
method, resulting in ((CommandInfo)theDataMap.get('info')).getCommand())
JXPath can be used to pass values into pipes such as:
ibm.ReturnDataPipe.mypipeline.content = jxpath:concat('Thank you for
submitting the form called: ', $data/formname)
JXPath can also be pass values out of pipes to be set at a location defined by the JXPath statement. In this case the JXPath statement must resolve to either a DOM element, Java
™ map value, or Java
bean get/set method. For example:
# databucket contains a DOM document at the key "instanceDOM"
# the example below sets a name into that DOM document
ibm.AssignPipe.mypipeline.data.1.key = jxpath:$data/instanceDOM/data/name
ibm.AssignPipe.mypipeline.data.1.value = string:John Doe
# databucket contains a Java Map at the key "myMap"
# the example below sets the string "Blue" into "myMap" at the map
# key "favoriteColor"
ibm.AssignPipe.mypipeline.data.1.key = jxpath:$data/myMap/favoriteColor
ibm.AssignPipe.mypipeline.data.1.value = string:Blue
For detailed information regarding JXPath, see http://jakarta.apache.org/commons/jxpath/
References the pipe instance. To identify the pipe you want to reference, use the name of the pipe followed by the name of its pipeline. For example:
is the pid and submitXFormsSample
is the pipe instance id.
References an OSGi service. To identify the service you want to reference, use its pid. For example, service:ibm.SendEmailPipeFactory. string
A string literal. For example, string:hello defines a simple literal string of "hello".
, you can use alphanumeric characters, period (.), underscore (_), and dash (-).
, you can use any ISO-8859-1 character encoding and Unicode characters can be represented by a Unicode escape sequence.
Parent topic: Passing data between pipes