-
Notifications
You must be signed in to change notification settings - Fork 1
Tutorial 1. Setting up RestFlow
This chapter describes how to set up an environment for writing and running RestFlow workflows.
RestFlow requires Java version 1.7. To determine the version of java installed on your computer use the -version option to the java command. For example,
$ java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
$
RestFlow is distributed as a jar (Java archive) file. There are two versions of the jar file for each release of RestFlow. One jar is relatively small (less than 1 MB) and includes just the compiled RestFlow classes and a minimum of additional resources. The other jar is larger (about 20 MB) and includes all of the third-party libraries that RestFlow depends on. These tutorials assume you are using this larger, standalone distribution of RestFlow.
You can download the latest (version 1.0 beta) standalone jar here.
Once you have downloaded the standalone jar, save the file in a convenient location and rename it to something like restflow.jar. RestFlow can now be run using the java -jar command. The jar file includes several sample workflow scripts which can be accessed from the command line using the classpath scheme.
Test your installation by running the hello1.yaml workflow. Assuming restflow.jar is in your current working directory type:
java -jar restflow.jar -f classpath:/samples/hello/hello1.yaml
If the RestFlow jar is stored elsewhere, qualify restflow.jar with the path to that file. If you stored the jar file in the bin subdirectory of your home directory (on a Unix platform), running RestFlow would look something like this:
$ java -jar ~/bin/restflow.jar -f classpath:/samples/hello/hello1.yaml
Hello World!
$
RestFlow can be run similarly on Windows platforms.
If you would like to browse and edit the sample workflows included in the RestFlow jar, type the following (qualifying the path to the RestFlow jar as necessary) from a working directory and extract them to your filesystem:
jar xf restflow.jar samples
To run a script residing on the filesystem, you can use the file scheme:
$ java -jar ~/bin/restflow.jar -f file:samples\hello\hello1.yaml
Hello World!
The file: qualifier is optional, however. By default RestFlow looks for workflows on your filesystem. So this will work, too, if samples is a subdirectory of your working directory:
$ java -jar ~/bin/restflow.jar -f samples\hello\hello1.yaml
Hello World!
On Unix platforms you can create an alias for more conveniently running RestFlow at the command line. For example, if you have saved the RestFlow jar to the bin subdirectory of your home directory, the following bash command will create an alias for running RestFlow simply by typing restflow at the command prompt.
alias restflow='java -jar ~/bin/restflow.jar'
If you use csh or tcsh the command is:
alias restflow java -jar ~/bin/restflow.jar
The hello1.yaml demo then can be run using the alias:
$ restflow -f classpath:/samples/hello1.yaml
Hello World!
$