Menu

Tutorial

Jacek

Tutorial for e-Science Central

This tutorial will include basic information about how to use and program e-Science Central. Currently, it is work in progress, so please post a message to esciencecentral-users@lists.sourceforge.net if you can't find here the information you need or the information provided is incorrect/incomplete.

Users Guide

to be continued...

Developers Guide

Developing e-SC blocks

Currently, e-SC supports a number programming languages in which a block can be written. These include: Java, JavaScript, Octave, R and Gnuplot. The following sections show how to develop a simple block in each of the supported languages.

The system gives two options how blocks can be created: using the CODE web tool available through the web UI and using your favourite IDE and maven to upload blocks to a selected instance.

Note: for Java blocks the CODE web tool is not available, so the only option is to develop a block on your desktop and then use maven to compile and upload it.

Creating a Java block

To create your first e-SC Java block you can use a maven archetype that generates an empty block with single input and output. To use the archetype generator issue command:

mvn archetype:generate \
    -DarchetypeGroupId=com.connexience \
    -DarchetypeArtifactId=workflow-block-java \
    -DarchetypeVersion=3.1-SNAPSHOT \
    -DgroupId=org.myblocks \
    -DartifactId=FirstOne \
    -Dversion=1.0 \
    -DinteractiveMode=false

Note: on Windows to join multiple lines in cmd window use '^' instead of '\'.

Note: if this command fails reporting "The desired archetype does not exist (com.connexience:workflow-block-java:3.1-SNAPSHOT)" you need to build the archetypes project.

The command will create a directory FirstOne' with the contents of the default, *empty* block. You may change directory toFirstOne' and build the block with commands:

cd FirstOne
mvn install

If your configuration is correct, you should be able to have block FirstOne uploaded to your instance under category 'My Services'. Try creating a new workflow and add your FirstOne block to the designer pane.

Customizing a Java block

The maven archetype template generates everything which is needed to build a simple block. The directory structure of the FirstOne block generated in the previous section should look like this:

FirstOne /
   src /
      main /
        assembly /
            assembly.xml
         java /
            MyService.java
         lib /
         resources /
            test /
               input-1
            dependencies.xml
            help.html
            icon.jpg
            library.xml
            service.xml
      test /
         java /
   pom.xml

Note: if you decided to build the block the directory structure shown above will include also the `target' directory with the compiled and bundled block code.

Depending on the complexity of your block, to customize it you may need to change only a few of the generated files or all of them. However, most often you will work only with two files: src/main/resources/service.xml' andsrc/main/java/MyService.java'.

File `service.xml' defines the interface of the block as seen by both the block user and block developer. Among other things in defines block properties, input and output ports and entry point for the Java class that implements block's function.

File `MyService.java' implements the actual functionality that the block is supposed to provide. In our FirstOne example the block just copies input data to the output port depending on the value of the "Copy Input" property.

Both files include some basic information, so please look inside to get a better understanding.


Related

Wiki: Tutorial-Maven Archetypes