Orbeon Forms's jar file (ops-cli.jar
) is executable via the java
-jar
mechanism. However, it depends on a number of libraries that must be
in the 'lib' directory beneath the directory containing
ops-cli.jar
. It is recommended to expand the WAR file, and refer
to the ops-cli.jar
file under the WAR file's WEB-INF
directory.
Command Line Applications
- 1. Introduction
- 2. Command Line Interface
- 3. Examples
1. Introduction
You can use Orbeon Forms to build standalone command-line applications running pipelines. Use cases include: creating a hardcopy of a web site, importing or exporting XML data to and from a relational database, testing pipelines, automating repetitive operations on XML files (selection, transformation, aggregation, etc.). Orbeon Forms becomes your "XML toolbox".
2. Command Line Interface
Orbeon Forms ships with a command line interface (CLI). The easiest way to run it is to use
the executable ops-cli.jar
file and pass it a pipeline file:
java -jar ops-cli.jar pipeline.xpl
In this case, a pipeline can use relative URLs, or, if using absolute URLs, can use
either the file:
protocol to access files or, equivalently, the
oxf:
protocol.
Sometimes, it is better to group files under a resources sandbox addressed by
the oxf:
protocol. This is the standard way of accessing resources
(files) within web applications, but it is also useful with command-line
applications. In such cases, specify a resource manager root directory with the
-r
option, for example:
java -jar ops-cli.jar -r . oxf:/pipeline.xpl
or:
java -jar ops-cli.jar -r C:/my-example oxf:/pipeline.xpl
When specifying a resource manager root directory, it is mandatory to use a protocol and an absolute path within the sandbox, as shown above.
3. Examples
Orbeon Forms comes with simple examples of command-line applications under the
src/examples/cli
directory. To run those examples, from a command
prompt, enter either one of the subdirectories and run the java
command
following the explanations above, for example, from the simple
directory:
java -jar /path/to/orbeon-war/WEB-INF/ops-cli.jar stdout.xpl
or, from the transform
directory:
java -jar /path/to/orbeon-war/WEB-INF/ops-cli.jar transform.xpl
Notice that those two example pipelines use serializers, for example:
It is important to note that, when running from within a servlet or portlet environment, serializers send their data to the web client, such as a web browser. When running from a command-line environment, serializers output data to the standard output.