Tutorial 1. Setting up RestFlow

Timothy McPhillips edited this page Jun 8, 2013 · 10 revisions

This chapter describes how to set up an environment for writing and running RestFlow workflows.

1. Check installed version of Java

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)

2. Download the RestFlow standalone jar

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.

3. Install RestFlow

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.

4. Extract the samples (optional)

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!

5. Create an alias for RestFlow (optional)

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!
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.