Getting Started

From CDK-Taverna 2.0 Wiki

Jump to: navigation, search

Contents

How to install the CDK-Taverna 2.0 plugin in Taverna

  1. To work with the plugin you have first to install the Taverna workbench.
    Click here to get the latest version.
  2. Start the Taverna workbench.
  3. Goto → Advanced → Updates and plugins

    GettingStarted 1.jpg

  4. Press the “Find New Plugins” button and choose in the upcoming panel “Add update site”.

    GettingStarted 2.jpg

  5. Type in the name and the URL of the CDK-Taverna 2.0 plugin and confirm selection.
    URL: http://www.ts-concepts.de/cdk-taverna2/plugin/

    GettingStarted 3.jpg

  6. After restarting the applicaton the configuration panel should appear.
    GettingStarted 11.jpg

    In this dialog it is possible to determine the working directory of the plugin. The directory is used for caching and logging purposes. Additionally you can decide to let the plugin manage the caching of data instead of using the memory or the provenance database of Taverna itself. This will increase the performance a little bit if in memory usage is not activated. Also it is possible to compress the cached data to reduce disk usage.
  7. Finally the plugin should be available in the service panel.

How to install the CDK-Taverna 2.0 sources and the developer workbench

  1. Get Maven 2
    You get the latest version and the installation instructions here
  2. Get the Maven 2 plugin for Eclipse
  3. Get the latest Tortoise SVN here.
  4. Checkout the CDK-Taverna 2.0 SVN repository
    Repository URL: https://cdktaverna2.svn.sourceforge.net/svnroot/cdktaverna2/trunk

    GettingStarted 10.jpg

  5. Import the Maven project to eclipse
    • Goto → File → Import → Maven/Existing Maven Projects

      GettingStarted 6.jpg

    • Use the wizard to create a new project from the CDK-Taverna 2.0 root directory
  6. Build the project with Maven command line tool:
    • mvn –DskipTests=true clean install
    • Note: It’s very important to skip the unit tests during the first build. Retry step 5 when mvn command freezes.

      GettingStarted 7.jpg

  7. If Maven misses any dependencies, compare the version in the pom files with the version of the missing ones. When the versions are different, change the versions in the pom files and try again.
  8. This time, rebuild the project using the maven command line tool with unit tests:
    • mvn clean install
      If the build screen looks like this:

      GettingStarted 8.jpg


      You have installed successfully th CDK-Taverna 2.0 plugin sources.
    • Note: If Eclipse is missing the tools.jar dependency you have to do both:
      • Configure eclipse to use the JDK instead of JRE
      • Add -vm argument that points to the JDK home in the eclipse.ini file.
        E.g.:
        -vm
        C:\jdk1.6.0\bin\java.exe

How to run the CDK-Taverna 2.0 developer workbench

To run the Taverna developer workbench left click on TavernaWorkbenchWithPlugin.java ? Run As ? Java Application
The class file is located in the UI-Bindings module in the package org.openscience.cdk.applications.taverna.ui in the test source folder.
Note:

  • If you want to use the developer workbench, you have to run successfully mvn clean install with unit tests!
  • Use the following VM arguments and adjust the memory usage to fit your machine:
    -Xmx1024m -XX:MaxPermSize=256m
    -Dsun.swing.enableImprovedDragGesture
    -Dtaverna.startup=.


GettingStarted 9.jpg

How to write your own CDK-Taverna 2.0 activity

  1. All CDK-Taverna 2.0 activities have to inherit from the AbstractCDKActivity class. So it is the most important class when developing new activities. To create a new class inherited from the AbstractCdkTaverna class right click on target package and goto New -> Class. In the upcoming panel add the name of the activity and define as superclass the AbstractCDKActivity. Press finish to create the class.

    GettingStarted 12.jpg

  2. After creating the empty backbone of the activity class it has to be filled with life. There are seven empty methods and the constructor:
    • Constructor:
      It is used mainly for setting the port names. The following code sets an input and an output port with the name "structures".
    this.INPUT_PORTS = new String[] { "Structures" };  
    this.OUTPUT_PORTS = new String[] { "Structures" }; 
    • protected void addInputPorts():
      The input ports have to be registered in this method. If you want to add an input port for listening to CmlChemFile objects you have to add the following line of code:
    this.addInput(this.INPUT_PORTS[0], 1, true, null, byte[].class);
    Note: The CMLChemFile class is not a object type which can be directly registered to the Taverna API. The CDK-Taverna API de/serializes the object in the background and uses a byte stream for inter port communication. If you want to get deeper into this matter have a look at the project sources.
    • protected void addOutputPorts():
      Adding output ports is much easier because you haven't take care of object types:
    this.addOutput(this.OUTPUT_PORTS[0], 1);
    Note: The specified value after the port name is the port depth (Same input ports). A depth of 0 let's you only register a single object to a port. Depth 1 a list of objects and depth 2 a list list of objects and so on.
    • public void work():
      This is the main method of the activitiy which does all the work. Normally it consits of three steps:
    1. Get input:
      To receive the CMLChemFile data from the input port use the following line:
      List<CMLChemFile> chemFileList = this.getInputAsList(this.INPUT_PORTS[0], CMLChemFile.class);
    2. Do work:
      This is the part where you process your data.
    3. Set output:
      Finally you have to register your processed data to an output port:
      this.setOutputAsObjectList(chemFileList, this.OUTPUT_PORTS[0]);
    • public String getActivityName():
      Define here the activity name which is shown in the service panel.
    • public String getFolderName():
      Sets the foldername of the activity.
    • public String getDescription():
      Not used.
    • public HashMap<String, Object> getAdditionalProperties():
      This method is used to define additional properties for configuration purposes.
  3. Finally the new activity has to be registered to be visible for Taverna. Therefor the full class name (package + class name) has to be added to the following meta data file:
    cdk-taverna-2-activity-ui\src\main\resources\META-INF\services\org.openscience.cdk.applications.taverna.AbstractCDKActivity

For further details on how to write CDK-Taverna 2.0 activities have a look at the sources of the project. Going into more detail would go beyond the scope of this wiki.

Contact

For further questions, feel free to contact us at the CDK-Taverna mailing list:
https://lists.sourceforge.net/lists/listinfo/cdk-taverna

Personal tools