|PREV PACKAGE NEXT PACKAGE||FRAMES NO FRAMES|
Stepsin the io library.
|DisplayStep||For each associated
|GetStep||Retrieve the contents of a specified URL resource, and push the contents as a String object onto the evaluation stack.|
|IoRuleSet||RuleSet for the Step definitions supported by the io library.|
|PeekStep||Write the top value from the evaluation stack to standard output, without removing it.|
|ReadStep||Read the contents of the specified file from the filesystem, and push the contents as a String object onto the evaluation stack.|
|WriteStep||Pop the top value from the evaluation stack, and write its contents as a string to the specified file in the filesystem (replacing any previous contents in that file).|
Steps in the io library.
This package contains org.apache.commons.workflow.Step implementations for the io library. This library includes Steps for importing information from (or exporting information to) external locations.
The sections below define each of the Step definitions included in this
library, utilizing the XML syntax that is recognized by the Digester used to
process your Activity definition files. Although you can use any namespace
prefix, the convention is to declare
io as the namespace prefix,
as in the following example:
<base:activity id="Demonstration Activity" xmlns:base="http://commons.apache.org/workflow/base" xmlns:core="http://commons.apache.org/workflow/core" xmlns:io="http://commons.apache.org/workflow/io" > <io:write file="topitem.txt"/> </base:activity>
NOTE - It is not required that you use the XML syntax, processed with a Digester, to initialize the Steps associated with each Activity. However, this usage is very convenient, and is likely to be the most common case, so the Steps are documented from that perspective. To use the underlying implementation classes directly, see the Javadocs for each Step implementation class, just as you would for any other Java class.
The io:display Step evaluates the properties specified by
<io:descriptor> elements, converts them to
String (if necessary), and prints them to Java's standard output.
The io:display element recognizes the following attributes:
You may nest any number of io:descriptor elements within a io:display element. All of them will be evaluated and displayed in order specified.
In the following example, the "address" and "customer" beans will
be converted to Strings (by calling their
and the results displayed to standard output.
<io:display > <io:descriptor xpath="address"/> <io:descriptor xpath="customer"/> </io:display>
The io:get Step connects to a specified URL, retrieves the corresponding value as a String, and pushes the result on to the evaluation stack.
The io:get element recognizes the following attributes:
In the following example, the home page of a local web server is retrieved and pushed on to the evaluation stack as a String:
The io:peek Step makes a copy of the top item on the evaluation stack, converts it to a String (if necesary), and prints it to standard output. This is useful for debugging, and is shorthand for the following:
<core:duplicate/> <io:display> <io:descriptor/> </io:display>
The io:peek element recognizes the following attributes:
The io:read Step reads the characters of the specified file, converts them to a String, and pushes this String on to the evaluation stack.
The io:read element recognizes the following attributes:
In the example below, the contents of the specified file are read, converted to a String, and pushed on to the evaluation stack:
The io:write Step pops the top item from the evaluation stack, converts it to a String (if necessary), and writes the characters to the specified file.
The io:write element recognizes the following attributes:
In the example below, the contents of the specified file are written based on the contents of the popped evaluation stack element:
An io:descriptor element is a description of the mechanism by which an arbitrary Java object (typically a JavaBean) in some Scope, is referenced. This element recognizes the following attributes:
nameattribute. If not specified, the corresponding bean will be searched for in all Scopes, in ascending numeric order.
scopeattributes) for specifying the bean instance to be accessed by this descriptor.
The syntax for XPath expressions is a sequence of one or more identifier strings, separated by forward slash ("/") characters. The expression is evaluated as follows:
When deciding what bean a particular descriptor applies to, the following rules are applied, in this priority order:
Contextis popped off the stack and consumed.
FIXME - Support the
for access to bean properties via the Commons Beanutils package.
|PREV PACKAGE NEXT PACKAGE||FRAMES NO FRAMES|