You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2016/02/02 22:57:58 UTC

[02/11] incubator-taverna-language git commit: taverna language commandline module renamed -> tavlangtool

taverna language commandline module renamed -> tavlangtool

Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/commit/1e13219f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/1e13219f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/1e13219f

Branch: refs/heads/master
Commit: 1e13219f7214e31510dcdc9f446de12920dd3c3a
Parents: 99156bd
Author: Menaka Madushanka <me...@gmail.com>
Authored: Tue Feb 2 11:46:15 2016 +0530
Committer: Menaka Madushanka <me...@gmail.com>
Committed: Tue Feb 2 11:46:15 2016 +0530

----------------------------------------------------------------------
 taverna-tavlangtool/.gitignore                  |    1 +
 taverna-tavlangtool/README.md                   |  425 +++++
 taverna-tavlangtool/pom.xml                     |  213 +++
 taverna-tavlangtool/src/main/java/.gitignore    |    0
 .../apache/taverna/tavlang/CommandLineTool.java |  350 ++++
 .../taverna/tavlang/TavernaCommandline.java     |   29 +
 .../org/apache/taverna/tavlang/tools/Tools.java |   88 +
 .../tavlang/tools/convert/Scufl2Convert.java    |  206 +++
 .../taverna/tavlang/tools/convert/ToJson.java   |  298 ++++
 .../tavlang/tools/convert/ToRobundle.java       |   66 +
 .../tavlang/tools/inspect/ProcessorNames.java   |  169 ++
 .../tavlang/tools/inspect/ServiceTypes.java     |  112 ++
 .../taverna/tavlang/tools/stats/GetWfStat.java  |  193 ++
 .../tavlang/tools/validate/Validate.java        |  151 ++
 .../src/main/resources/.gitignore               |    0
 .../src/main/resources/META-INF/NOTICE          |    7 +
 taverna-tavlangtool/src/test/java/.gitignore    |    0
 .../taverna/tavlang/test/CommandLineTest.java   |   43 +
 .../taverna/tavlang/test/TestConvert.java       |   34 +
 .../apache/taverna/tavlang/test/TestStats.java  |   34 +
 .../apache/taverna/tavlang/test/TestTools.java  |   80 +
 .../taverna/tavlang/test/TestValidate.java      |   49 +
 .../src/test/resources/.gitignore               |    0
 .../test/resources/workflows/t2flow/as.t2flow   | 1674 ++++++++++++++++++
 24 files changed, 4222 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/.gitignore
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/.gitignore b/taverna-tavlangtool/.gitignore
new file mode 100644
index 0000000..916e17c
--- /dev/null
+++ b/taverna-tavlangtool/.gitignore
@@ -0,0 +1 @@
+dependency-reduced-pom.xml

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/README.md
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/README.md b/taverna-tavlangtool/README.md
new file mode 100644
index 0000000..e76cbcd
--- /dev/null
+++ b/taverna-tavlangtool/README.md
@@ -0,0 +1,425 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+# Apache Taverna Language Command Line
+
+
+This is planned as a command line for the
+[Apache Taverna Language](https://github.com/apache/incubator-taverna-language/),
+an API for the 
+[Apache Taverna](http://taverna.incubator.apache.org/) workflows.
+
+This module is a **work in progress** as part of Google Summer of Code 2015.
+
+
+
+## License
+
+(c) 2015 Apache Software Foundation
+
+This product includes software developed at The [Apache Software
+Foundation](http://www.apache.org/).
+
+Licensed under the [Apache License
+2.0](https://www.apache.org/licenses/LICENSE-2.0), see the file
+[../LICENSE](../LICENSE) for details.
+
+The file [NOTICE](src/main/resources/NOTICE) contains any additional attributions and
+details about embedded third-party libraries and source code.
+
+
+# Contribute
+
+Please subscribe to and contact the 
+[dev@taverna](http://taverna.incubator.apache.org/community/lists#dev%20mailing%20list)
+for any questions, suggestions and discussions about 
+Apache Taverna Language Commandline.
+
+Bugs and planned features are tracked in the Jira
+[Issue tracker](https://issues.apache.org/jira/browse/TAVERNA/component/12326903)
+under the `TAVERNA` component _GSOC Taverna Language Command line_. Feel free
+to add an issue!
+
+To suggest changes to this source code, feel free to raise a 
+[GitHub pull request](https://github.com/apache/incubator-taverna-mobile/pulls).
+Any contributions received are assumed to be covered by the [Apache License
+2.0](https://www.apache.org/licenses/LICENSE-2.0). We might ask you 
+to sign a [Contributor License Agreement](https://www.apache.org/licenses/#clas)
+before accepting a larger contribution.
+
+
+# Building and install requirements
+
+## Requisites
+
+* Java 1.7 or newer
+* [Apache Maven](https://maven.apache.org/download.html) 3.2.5 or newer (older
+  versions probably also work)
+
+
+## Building
+
+To build, run:
+
+    mvn clean install
+
+
+# Usage
+
+	usage: tavlang <command> [<args>]
+	
+	The most commonly used tavlang commands are:
+	    convert    Convert the given workflow
+	    help       Display help information about Tvarna
+	    inspect    Inspect the given workflow and show the results on the terminal
+	    validate   Validate the given workflow
+	    version    Show version informantion
+	
+	See 'tavlang help <command>' for more information on a specific command.
+
+# Documentation
+
+The Taverna language command line tool is for accessing the features of the Taverna language modules. 
+The tool has the following functions:
+
+* Conversion
+* Inspection
+* Validation
+* Viewing workflow statistics.
+	
+## Command line structure 
+	
+	$tavlang <command> <options> [arguments and parameters]
+	
+Each command has its own set of options.
+
+###Commands and Options
+The tool has the following major commands:
+
+* convert: Options {-r -- recursive, -i --input, -o --output,}
+* inspect: Options {-l --log}
+* validate: Options {-l --log, -v --verbose}
+* stats: Options {-l --log, -v --verbose}
+
+## Commands in detail
+
+### convert ------------------------------------------------------
+
+Convert the given workflow file/s into a specified output format.
+
+Usage:
+	
+	tavlang convert (--output_fomat) ([[options] [arguments]]|files...)
+	
+ Supported output formats are,
+ 
+ * wfbundle
+ * iwir
+ * json
+ * robundle
+ * structure
+ 
+Options:
+
+ * -r, --recursive : Convert all workflow files in a given directory recursively
+ * -i, --input     : Used with recursive case. Specify the input directory
+ * -o, --output    : Specify the out put directory 
+
+*The tool can only convert into one format at a time
+
+There are two methods for using the conversion command.
+
+####  1. Non-recursive method
+
+Usage: 
+
+	$tavlang convert (--output_format) [options] [arguments] 
+	
+####### Example 1: Without specifying any options
+	
+	$tavlang convert --structure /helloworld.t2flow
+	
+Output:
+
+	/converted/helloworld.structure is created
+
+Convert the helloworld.t2flow into helloworld.structure format and store in the /converted directory
+
+###### Example 2: Convert multiple workflows
+	
+	$tavlang convert --json /helloworld.t2flow /hello.t2flow
+	
+Output:
+	
+	/converted/helloworld.json is created
+	/converted/hello.json is created
+	
+Convert both workflow files and store them in /converted directory
+
+###### Example 3: with options and arguments
+
+	$tavlang convert --wfbundle /helloworld.t2flow -o /output/workflows
+	
+Output:
+	
+	/output/workflows/helloworld.wfbundle is created
+	
+Convert the workflow file/s and store them in the specified output directory
+
+####  2. Recursive method
+
+If there are many workflows in a directory, which are needed to be converted into one single format use this method.
+	
+Usage: 
+	
+	$tavlang convert -r (--output_format) -i workflow_src_dir <options> [arguments]
+
+###### Example 4: Without options and arguments
+
+	$tavlang convert -r --json -i /home/user/workflows
+	
+Convert all the workflows in the input directory into the specified format and store them in the "/home/user/workflows/converted" directory.
+
+Output: Suppose that there are 2 workflow files in the dir 1.t2flow and 2.t2flow
+
+	/home/workflows/converted/1.json is created
+	/home/workflows/converted/2.json is created
+
+###### Example 5: with output dir is specified
+
+	$tavlang convert -r --iwir -i /home/workflows -o /home/final
+	
+Convert all the workflows in the input directory and store them in /home/final directory
+
+Output:
+
+	/home/final/1.iwir is created
+	/home/final/2.iwir is created
+	
+### inspect -----------------------------------------------------------------
+
+Inspect the given workflow file/s and give the inspection report. 
+Supported workflow bundle formats: .wfbundle, .t2flow
+
+Usage:-
+	
+	$tavlang inspect (--inspection_options) <-other-options> [arguments] workflow_undles_to_be_inspected
+	
+Inspection options: 
+
+ * --servicetypes :- List all the service-types used in the workflow
+ * --processornames :- List the tree of the processor names used in the workflow
+ 
+Other Options:
+
+ * -l, --log :- save the inspection report in a text file 
+ 
+###### Example 1: Without any other-options
+
+1. Inspection result for Service types
+
+
+	$tavlang inspect --servicetypes helloworld.wfbundle
+	Service types used in helloworld.wfbundle :
+
+	http://ns.taverna.org.uk/2010/activity/constant
+	**************************************************
+
+2. inspection result for Processor names
+	
+	
+	$tavlang inspect --processornames helloworld.wfbundle
+	Processor tree of helloworld.wfbundle 
+	+ Hello_World
+	  - hello
+	
+###### Example 2: With other options
+The output is the same but the results will be saved in the given file.
+
+	$tavlang inspect --processornames helloworld.wfbundle -l results.txt
+	Processor tree of helloworld.wfbundle 
+	+ Hello_World
+	 - hello
+
+
+The output will be saved in results.txt in the same format.
+
+### validate ----------------------------------------------------------------------
+
+Validates the given workflow file or files and gives the validation report. 
+Validate tool checks for the following problematic conditions.
+
+ * Empty Iteration Strategy Top-Node Problems
+ * Mismatch Configurable Type Problems
+ * Non-Absolute URI Problems
+ * Null Field Problems
+ * Out-Of-Scope Value Problems
+ * Port Mentioned Twice Problems
+ * Port Missing From Iteration Strategy Stack Problems
+ * Wrong Parent Problems
+ * Incompatible Granular Depth Problems
+ 
+Usage:-
+
+	$tavlang validate [options][arguments] input_files
+
+Options:- 
+
+ * -l, --log: Save the validation report in a text file
+ * -v, --verbose: Verbose mode
+
+Supported workflow bundle formats: .t2flow and .wfbundle
+
+###### Example 1: Normal mode
+
+  Validate one workflow bundle
+
+	$tavlang validate helloworld.t2flow
+	
+Output: 
+	
+	Validation started....
+	Validating helloworld.t2flow
+	The workflow helloworld.t2flow has no errors. 
+
+	Validation completed.......
+ 
+  Validate more than one workflow bundles
+ 
+	$tavlang validate ../../workflow2.t2flow ../../workflow3.wfbundle
+
+	Validation started....
+	Validating ../../workflow2.t2flow
+	The workflow workflow2.t2flow has no errors. 
+
+	Validating ../../workflow3.wfbundle
+	The workflow workflow3.t2flow has no errors. 
+
+	Validation completed.......
+
+
+###### Example 2: Verbose mode
+
+The report is more explanatory.
+
+	$tavlang validate -v ../../workflow2.t2flow
+
+	Validation started....
+	Validating ../../workflow2.t2flow
+	The workflow workflow2.t2flow has no errors. 
+
+	The validation report for defaultActivitiesTaverna2.wfbundle......
+	-------------------------------------------------------------------------------- 
+	-->NegativeValueProblems:- null 
+	
+	-->EmptyIterationStrategyTopNodeProblems:- null 
+
+	-->MismatchConfigurableTypeProblems:- null 
+
+	-->NonAbsoluteURIProblems:- null 
+
+	-->NullFieldProblems:- null 
+
+	-->OutOfScopeValueProblems:- null 
+
+	-->PortMentionedTwiceProblems:- null 
+
+	-->PortMissingFromIterationStrategyStackProblems:- null 
+
+	-->WrongParentProblems:- null 
+
+	-->IncompatibleGranularDepthProblems:- null 
+
+	---------------------------------------------------------------------------------
+
+###### Example 3: Saving results to a file
+
+	$tavlang validate workflow2.t2flow -l log2.txt 
+	Validation started.... 
+	Validating workflow2.t2flow 
+	The workflow helloworld.wfbundle has no errors. 
+	Validation completed....... 
+	
+	Results were saved into log2.txt
+
+### stats ----------------------------------------------------------------------------------
+
+A workflow contains several resources.
+
+* Processors
+* Input ports
+* Output ports
+* Data links
+* Control links
+
+The stats command gives a report of the resources used in the workflow.
+
+Usage:- 
+
+	$tavlang stats <options>[arguments] input_files...
+	
+Options:- 
+
+ * -l, – – log : Save results in a log file
+ * -v, – – verbose : verbose mode
+ 
+Supported workflow bundle formats:- .t2flow, .wfbundle
+
+###### Example 1: Normal mode
+
+	$tavlang helloworld.wfbundle
+	>>> Statistics of the workflow bundle: helloworld.wfbundle <<<
+	Name of the workflow = Hello_World
+	 |--> Number of Processors = 1
+	 |--> Number of Data Links = 1
+	 |--> Number of Control Links = 0
+	 |--> Number of Input ports = 0
+	 |--> Number of Output Ports = 1
+ 
+###### Example 2: Verbose mode 
+
+	$tavlang -v ../../../helloworld.wfbundle
+	>>> Statistics of the workflow bundle: helloworld.wfbundle <<<
+	Name of the workflow = Hello_World
+	 |--> Number of Processors = 1
+	 | |--> Processors: 
+	 |      |--> hello
+	 |
+	 |--> Number of Data Links = 1
+	 | |--> Data Links
+	 |      |--> DataLink value=>greeting
+	 |
+	 |--> Number of Control Links = 0
+	 |--> Number of Input ports = 0
+	 |--> Number of Output Ports = 1
+	 | |--> Output Ports
+	 |      |--> OutputWorkflowPort "greeting"
+	 
+###### Example 3: Saving results in a file 
+
+	$tavlang -l ../../results.txt ../../../helloworld.wfbundle
+	>>> Statistics of the workflow bundle: helloworld.wfbundle <<<
+	Name of the workflow = Hello_World
+	 |--> Number of Processors = 1
+	 |--> Number of Data Links = 1
+	 |--> Number of Control Links = 0
+	 |--> Number of Input ports = 0
+	 |--> Number of Output Ports = 1
+
+	Results were saved into ../../results.txt
+	
+-----------------------------------------------------------------------------------------------------------------------------------------
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/pom.xml b/taverna-tavlangtool/pom.xml
new file mode 100644
index 0000000..c23c35f
--- /dev/null
+++ b/taverna-tavlangtool/pom.xml
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+      	<groupId>org.apache.taverna.language</groupId>
+      	<artifactId>taverna-language</artifactId>
+      	<version>0.15.1-incubating-SNAPSHOT</version>
+    </parent>
+    <artifactId>taverna-tavlangtool</artifactId>
+    <name>Apache Taverna Language Commandline</name>
+    <description>Command line for Taverna Language (experimental)</description>
+
+	
+    <dependencies>
+    
+    	<dependency>
+			<groupId>commons-io</groupId>
+			<artifactId>commons-io</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>taverna-scufl2-api</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>taverna-scufl2-wfbundle</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>taverna-scufl2-t2flow</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+<!-- 		<dependency> -->
+<!-- 			<groupId>org.shiwa.iwir</groupId> -->
+<!-- 			<artifactId>iwir</artifactId> -->
+<!-- 			<version>1.1.4</version> -->
+<!-- 			<scope>optional</scope> -->
+<!-- 			<systemPath>${project.build.directory}/taverna-language-commandline/lib/</systemPath> -->
+<!-- 		</dependency> -->
+		
+   	 <dependency>
+		<groupId>no.s11.scufl2</groupId>
+		<artifactId>scufl2-iwir</artifactId>
+		<version>0.2-SNAPSHOT</version>
+        <optional>true</optional>
+    </dependency>
+
+ 
+		
+		<dependency>
+			<groupId>com.thoughtworks.xstream</groupId>
+			<artifactId>xstream</artifactId>
+			<version>1.4.8</version>
+		</dependency>
+
+
+		<!-- <dependency> <groupId>${project.groupId}</groupId> <artifactId>taverna-scufl2-wfdesc</artifactId> 
+			<version>${project.version}</version> <optional>true</optional> </dependency> -->
+		<!-- <dependency> <groupId>org.purl.wf4ever</groupId> <artifactId>scufl2-wfdesc</artifactId> 
+			<version>0.3.7</version> </dependency> -->
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-core</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>taverna-scufl2-ucfpackage</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>taverna-robundle</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>io.airlift</groupId>
+			<artifactId>airline</artifactId>
+			<!-- <version>${io.airlift.airline.version}</version> -->
+			<version>0.7</version>
+		</dependency>
+
+
+	</dependencies>
+
+	<build>
+		<!-- TODO: plugins for launchers and executable jar files? -->
+		<plugins>
+
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>appassembler-maven-plugin</artifactId>
+				<version>1.1.1</version>
+				<executions>
+					<execution>
+						<id>assemble</id>
+						<phase>package</phase>
+						<goals>
+							<goal>assemble</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<repositoryLayout>flat</repositoryLayout>
+					<repositoryName>lib</repositoryName>
+					<assembleDirectory>${project.build.directory}/${project.artifactId}</assembleDirectory>
+					<programs>
+						<program>
+							<mainClass>org.apache.taverna.tavlang.TavernaCommandline</mainClass>
+							<name>tavlang</name>
+						</program>
+					</programs>
+				</configuration>
+			</plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-shade-plugin</artifactId>
+				<version>2.3</version>
+				<executions>
+					<execution>
+						<phase>package</phase>
+						<goals>
+							<goal>shade</goal>
+						</goals>
+						<configuration>
+							<transformers>
+								<transformer
+									implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
+								<transformer
+									implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+									<mainClass>org.apache.taverna.tavlang.TavernaCommandline</mainClass>
+								</transformer>
+								<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
+                    			<addHeader>false</addHeader>
+                    			</transformer>
+							</transformers>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+
+
+		</plugins>
+	</build>
+
+	<repositories>
+		<repository>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+			<snapshots />
+			<id>mygrid-repository</id>
+			<name>myGrid Repository</name>
+			<url>http://www.mygrid.org.uk/maven/repository</url>
+		</repository>
+		
+		<repository>
+			<id>mygrid-snapshot-repository</id>
+			<name>myGrid Snapshot Repository</name>
+			<url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+			<snapshots />
+		</repository>
+
+		<repository>
+			<id>apache.snapshots</id>
+			<name>Apache Snapshot Repository</name>
+			<url>http://repository.apache.org/snapshots</url>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+		</repository>
+	</repositories>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/.gitignore
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/.gitignore b/taverna-tavlangtool/src/main/java/.gitignore
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/CommandLineTool.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/CommandLineTool.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/CommandLineTool.java
new file mode 100644
index 0000000..068c933
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/CommandLineTool.java
@@ -0,0 +1,350 @@
+package org.apache.taverna.tavlang;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import io.airlift.airline.Arguments;
+import io.airlift.airline.Cli;
+import io.airlift.airline.Cli.CliBuilder;
+import io.airlift.airline.Command;
+import io.airlift.airline.Help;
+import io.airlift.airline.Option;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.xml.bind.JAXBException;
+
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.tavlang.tools.convert.Scufl2Convert;
+import org.apache.taverna.tavlang.tools.convert.ToRobundle;
+import org.apache.taverna.tavlang.tools.inspect.ProcessorNames;
+import org.apache.taverna.tavlang.tools.inspect.ServiceTypes;
+import org.apache.taverna.tavlang.tools.stats.GetWfStat;
+import org.apache.taverna.tavlang.tools.validate.Validate;
+
+import com.google.common.collect.Lists;
+
+/*
+ * The command line options for convert, validate and inspect workflows.
+ * Use the airlift/airline library
+ * */
+
+public class CommandLineTool {
+
+	private static Cli<TvnLangTool> parser() {
+		CliBuilder<TvnLangTool> build = Cli.<TvnLangTool> builder("tavlang")
+				.withDescription("Convert, manage workflows")
+				.withDefaultCommand(HelpCommand.class)
+				.withCommand(CommandConvert.class) // Conversion
+				.withCommand(HelpCommand.class) // Help
+				.withCommand(CommandInspect.class) // Inspect
+				.withCommand(CommandValidate.class) // Validate
+				.withCommand(CommandVersion.class) // Version
+				.withCommand(CommandStat.class); // Statistics
+
+		return build.build();
+	}
+
+	public CommandLineTool() {
+	};
+
+	public void parse(String... args) {
+		TvnLangTool command = parser().parse(args);
+		command.execute();
+		System.out.println();
+	}
+
+	public static abstract class TvnLangTool {
+
+		public abstract void execute();
+	}
+
+	// placeholder for output file types
+	public static class Filetypes {
+		@Option(name = "--wfdesc", description = "Convert the workflow file to wfdesc-turtle")
+		public static boolean isWfdesc = false;
+
+		@Option(name = "--wfbundle", description = "Convert the workflow file to wfbundle")
+		public static boolean isWfbundle = false;
+
+		@Option(name = "--robundle", description = "Convert given bundle in to Research Object bundle")
+		public static boolean isRo = false;
+
+		@Option(name = "--structure", description = "Convert the workflow into *.structure")
+		public static boolean isStructure = false;
+
+		@Option(name = "--json", description = "Convert the workflow into json")
+		public static boolean isJson = false;
+
+		
+		@Option(name = "--iwir", description = "Convert scufl2 workflows into IWIR 1.1 specification")
+		public static boolean isIwir = false;
+		
+		
+		// The tool can only handle one output format at a time.
+		// Return the file type which is selected
+		public static String isTrue() {
+			if (isWfdesc)
+				return "wfdesc";
+			else if (isWfbundle)
+				return "wfbundle";
+			else if (isRo)
+				return "robundle";
+			else if (isStructure)
+				return "structure";
+			else if (isJson)
+				return "json";
+			
+			else if (isIwir)
+				return "iwir";
+				
+			
+			else{
+				System.out.println("Invalid argument....");
+				TvnLangTool command = parser().parse("help", "convert");
+				command.execute();
+				return null;
+			}
+				
+		}
+
+	}
+
+	public static class Inspect {
+		@Option(name = "--servicetypes", description = "List the service types used in workflow")
+		public static boolean servicetypes = false;
+
+		@Option(name = "--processornames", description = "List a tree of processor names used in workflow")
+		public static boolean processor = false;
+
+		public String getWay() {
+			if (servicetypes)
+				return "servicetypes";
+			else if (processor)
+				return "processornames";
+			else{
+				System.out.println("Invalid argument....");
+				TvnLangTool command = parser().parse("help", "inspect");
+				command.execute();
+				return null;
+				
+			}
+				
+		}
+
+	}
+
+	// Placeholder for optional parameters: Ex: -i, -o
+	public static class Optional {
+
+		// The input file or directory
+		@Option(name = { "-i", "--input" }, description = "Input file/ file dir for conversion")
+		public static String in_file_dir;
+
+		// The out put file or directory. When this is set, all the converted
+		// files will be saved into the directory that specified.
+		@Option(name = { "-o", "--output" }, description = "Output file/ directory")
+		public static String out_file_dir;
+
+		public static String getInFile() {
+			return in_file_dir;
+		}
+
+		public static String getOutFile() {
+			return out_file_dir;
+		}
+
+	}
+
+	@Command(name = "help", description = "Display help information about Tvarna")
+	public static class HelpCommand extends TvnLangTool {
+		@Inject
+		public Help help;
+
+		@Override
+		public void execute() {
+			help.call();
+		}
+	}
+
+	// Command for convert workflows
+	@Command(name = "convert", description = "Convert the given workflow")
+	public static class CommandConvert extends TvnLangTool {
+		@Inject
+		Optional optional = new Optional();
+
+		@Inject
+		Filetypes filetypes = new Filetypes();
+
+		@Arguments(usage = "<output format> <input files> ", description = "List of files to be converted.\n "
+				+ "Give the list of files to be converted without -i/-o and the converted files will be saved in to /converted folder in the same dir")
+		public final List<String> files = Lists.newArrayList();
+
+		// When this is true, the command will run recursively in a directory.
+		@Option(name = { "-r", "--recursive" }, description = "Execute the command recursively")
+		public boolean recurse = false;
+
+		// Option for validate the given workflow when converting
+		@Option(name = { "-V", "--validate" }, description = "Validate the workflow before convert")
+		public boolean validate = false;
+
+		@Override
+		public void execute() {
+			
+			//Validate before convert
+			if(validate){
+				Validate validate = new Validate(files, null, false);
+				if(validate.getCheck()){
+					System.out.println("Conversion failed...! Workflow bundle has errors");
+					return;
+				}else{
+					runcommand();
+				}
+			}
+		}
+			
+		public void runcommand(){
+			if (Filetypes.isRo) {
+				try {
+					new ToRobundle(files, Optional.getOutFile());
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+//				else if(Filetypes.isIwir || Filetypes.isJson || Filetypes.isStructure || Filetypes.isWfbundle || Filetypes.isWfdesc)
+			} else if(Filetypes.isIwir || Filetypes.isJson || Filetypes.isStructure || Filetypes.isWfbundle || Filetypes.isWfdesc){
+				if (recurse) {
+					new Scufl2Convert(Filetypes.isTrue(),
+							Optional.getInFile(), Optional.getOutFile());
+				} else {
+					new Scufl2Convert(Filetypes.isTrue(), files,
+							Optional.getOutFile());
+				}
+			}else{
+				System.out.println("Invalid argument....");
+				TvnLangTool command = parser().parse("help", "convert");
+				command.execute();
+			}
+
+		}
+		
+		
+		
+	}
+
+	// Version command
+	@Command(name = "version", description = "Show version informantion")
+	public static class CommandVersion extends TvnLangTool {
+
+		@Override
+		public void execute() {
+			System.out.print(getClass().getPackage().getImplementationTitle());
+            System.out.println(" " + getClass().getPackage().getImplementationVersion());
+		}
+
+	}
+
+	// Command for inspection of workflows....!!
+	@Command(name = "inspect", description = "Inspect the given workflow and show the results on the terminal")
+	public static class CommandInspect extends TvnLangTool {
+
+		@Inject
+		Inspect inspect = new Inspect();
+
+		@Option(name = { "-l", "--log" }, description = "Specify the file name where results should be stored ([some dir]/log.txt)")
+		public String file;
+
+		@Arguments(usage = "<option> <input files>", description = "Inspect the given workflow")
+		public List<String> toInspect = Lists.newArrayList();
+
+		@Override
+		public void execute() {
+			if (Inspect.processor) {
+				try {
+					new ProcessorNames(toInspect, file);
+
+				} catch (ReaderException | IOException | JAXBException e) {
+					e.printStackTrace();
+				}
+			} else if (Inspect.servicetypes) {
+				try {
+					new ServiceTypes(toInspect, file);
+				} catch (IOException | ReaderException e) {
+					e.printStackTrace();
+				}
+
+			}else{
+				System.out.println("Invalid argument....");
+				TvnLangTool command = parser().parse("help", "inspect");
+				command.execute();
+			}
+
+		}
+
+	}
+
+	// Command for validation
+	@Command(name = "validate", description = "validate the given workflow")
+	public static class CommandValidate extends TvnLangTool{
+	
+		@Option(name = { "-l", "--log" }, description = "Specify the file name where results should be stored ([some dir]/log.txt)")
+		public String file;
+		
+		@Option(name = {"-v", "--verbose"}, description = "Verbose mode")
+		public boolean verbose;
+
+//		@Arguments(usage = "<option> <input files> <output dir>", description = "Validate the given workflow file/s")
+		@Arguments(usage = "input files", description = "Validate the given workflow file/s")
+		public List<String> toValidate = Lists.newArrayList();
+
+		@Override
+		public void execute() {
+		
+			Validate validate = new Validate(toValidate, file, verbose);
+			
+
+		}
+
+	}
+	
+	//Command for getting workflow stats
+	@Command (name = "stats", description = "Shows the workflow statistics")
+	public static class CommandStat extends TvnLangTool{
+
+		
+		@Option(name = {"-l", "--log"}, description ="Save the workflow statictics in a file")
+		public String file;
+		
+		@Option(name = {"-v", "--verbose"}, description = "Verbose mode")
+		public boolean verbose;
+		
+		@Arguments(usage="input files", description = "Enter the workflow bundle files")
+		public List<String> files;
+		
+		@Override
+		public void execute() {
+			
+			GetWfStat stat = new GetWfStat(files, file, verbose);
+			
+		}
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/TavernaCommandline.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/TavernaCommandline.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/TavernaCommandline.java
new file mode 100644
index 0000000..016488c
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/TavernaCommandline.java
@@ -0,0 +1,29 @@
+package org.apache.taverna.tavlang;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class TavernaCommandline {
+
+	public static void main(String args[]){
+		CommandLineTool tool = new CommandLineTool();
+		tool.parse(args);
+		
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/Tools.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/Tools.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/Tools.java
new file mode 100644
index 0000000..c78c7a2
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/Tools.java
@@ -0,0 +1,88 @@
+package org.apache.taverna.tavlang.tools;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+public class Tools {
+	
+	public static enum ConvertionTools {
+		wfbundle{
+			public String mediaType = "application/vnd.taverna.scufl2.workflow-bundle";
+			
+
+			@Override
+			public String getMediaType(ConvertionTools t) {
+				return this.mediaType;
+			}
+		},
+		json{
+			public String mediaType = "application/ld+json";
+
+
+			@Override
+			public String getMediaType(ConvertionTools t) {
+				return mediaType;
+			}
+		},
+		wfdesc{
+			public String mediaType = "text/vnd.wf4ever.wfdesc+turtle";
+
+
+			@Override
+			public String getMediaType(ConvertionTools t) {
+				// TODO Auto-generated method stub
+//				System.out.println(mediaType);
+				return mediaType;
+			}
+		},
+		robundle{
+
+			@Override
+			public String getMediaType(ConvertionTools t) {
+				return null;
+			}
+		
+		},
+		structure{
+			public String mediaType = "text/vnd.taverna.scufl2.structure";
+			
+			@Override
+			public String getMediaType(ConvertionTools t) {
+				return mediaType;
+			}
+		},
+		
+		iwir{
+				public String mediaType = "application/vnd.shiwa.iwir+xml";
+				
+				@Override
+				public String getMediaType(ConvertionTools t) {
+					return mediaType;
+				}
+		};
+		
+		ConvertionTools(){}
+		
+		public abstract String getMediaType(ConvertionTools t);
+		
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/Scufl2Convert.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/Scufl2Convert.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/Scufl2Convert.java
new file mode 100644
index 0000000..da4dff0
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/Scufl2Convert.java
@@ -0,0 +1,206 @@
+package org.apache.taverna.tavlang.tools.convert;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.io.WriterException;
+import org.apache.taverna.tavlang.tools.Tools.ConvertionTools;
+
+
+/*
+ * Converts 
+ * 	.t2flow --> .wfbundle
+ * 	.t2flow --> .structure
+ * 	.wfbundle --> .structure
+ *  .wfbundle/ .t2flow -> .iwir
+ * two constructors.
+ * Scufl2Convert(List<String> list, String out) --> will save the converted files in 'out folder or a directory named /converted in the same folder.
+ * Scufl2Convert(String in, String out) --> Will convert all the files in the 'in' folder and save them in 'out' folder --> -r must be true.
+ * 
+ * */
+public class Scufl2Convert{
+	
+	private ConvertionTools t;
+	private String MEDIA_TYPE;
+	private String input;
+	private String output;
+	private String type;
+	private List<String> filesList;
+	
+	public Scufl2Convert(String type, List<String> files, String out){
+		this.filesList = files;
+		this.output = out;
+		this.type = type.equals("wfdesc")?".wfdesc.ttl":"."+type;
+		this.MEDIA_TYPE = ConvertionTools.valueOf(type).getMediaType(t);
+		this.convert();
+	}
+	
+	//When recursive case is on....
+	public Scufl2Convert(String type, String in, String out){
+		this.input = in;
+		this.output = out;
+		this.type = type.equals("wfdesc")?".wfdesc.ttl":"."+type;
+		this.MEDIA_TYPE = ConvertionTools.valueOf(type).getMediaType(t);	//Determine the writer media type
+		
+		this.createdir();
+	}
+	
+	//Create the dir if not exists
+	public void createdir(){
+		if(output == null){
+			File outFile = new File(this.input, "converted");
+			try {
+				FileUtils.forceMkdir(outFile);
+				this.output = outFile.getAbsolutePath();
+			} catch (IOException e1) {
+				System.err.println("Error: The directory cannot be created...!!!!");
+				e1.printStackTrace();
+			}
+		}else{
+			File outFile = new File(this.output);
+			try {
+				FileUtils.forceMkdir(outFile);
+				
+			} catch (IOException e1) {
+				System.err.println("Error: The directory cannot be created...!!!!");
+				e1.printStackTrace();
+			}
+		}
+		this.rec_convert(this.input);
+	}
+	
+	//Convert the given file. Return in case of an exception.
+	public boolean convert(){
+		
+		boolean check = false;
+		// If the output folder is given, save the converted files in to that folder.
+		 
+		if(this.filesList.size()>0 && this.output != null){
+			File outFile = new File(this.output);
+			try {
+				FileUtils.forceMkdir(outFile);
+			} catch (IOException e1) {
+				System.err.println("Error: The directory cannot be created...!!!");
+			}
+			for(String file : this.filesList){
+				File t2File = new File(file);
+				
+				convertFile(t2File, outFile);
+				
+			}
+			
+		}
+		
+		 /* If the output file is not given, save the converted files in 
+		  *  '/converted' folder.
+		  */
+		 
+		else if(this.filesList.size()>0 && this.output == null){
+			for(String file : this.filesList){
+				File t2File = new File(file);
+				
+				File outFile = new File(t2File.getParentFile(), "converted");
+				try {
+					FileUtils.forceMkdir(outFile);
+				} catch (IOException e1) {
+					System.err.println("Error: The directory cannot be created...!!!");
+				}
+				
+				convertFile(t2File, outFile);
+				
+			}
+		}else{
+			System.err.println("Error: Argument mismatch");
+			check = false;
+		}
+		
+		return check;
+	}
+	
+	//Convert the files in a given directory and save the converted files in to specified dir or /converted folder.
+	//Recursive conversion
+	public void rec_convert(String dir){
+			
+			File parent = new File(this.input);
+			if(!parent.exists()){
+				System.err.println("Error: Input directory not found");
+			}else{
+				for(File file : parent.listFiles()){
+					if(!file.isDirectory())
+					{
+						File outFile = new File(this.output);
+						convertFile(file, outFile);
+					}
+				}
+			}
+	}
+	
+	//Convert the file
+	public void convertFile(File t2File, File outFile){
+		
+		//Check weather the input files are in valid format...!!!
+		String ext = FilenameUtils.getExtension(t2File.getName());
+		if(!ext.equalsIgnoreCase("t2flow")&&!ext.equalsIgnoreCase("wfbundle")){
+			System.err.println("Error: Invalid input file format...!!!");
+			return;
+		}
+		
+		WorkflowBundleIO wfbio = new WorkflowBundleIO();
+		String filename = t2File.getName();
+		filename = filename.replaceFirst("\\..*", this.type);
+		File scufl2File = new File(outFile.getAbsolutePath(), filename);
+		
+		WorkflowBundle wfBundle;
+		try {
+			wfBundle = wfbio.readBundle(t2File, null);// null --> will guess the media type for reading.
+			
+//			if(this.type.equals(".iwir")){
+//				IwirWriter iww = new IwirWriter();
+//				iww.writeBundle(wfBundle, scufl2File, this.MEDIA_TYPE);
+//			}else
+			
+			if(this.type.equals(".json")){
+				ToJson toJ = new ToJson();
+				toJ.convert(t2File, outFile);
+			}
+			else{
+				wfbio.writeBundle(wfBundle, scufl2File, this.MEDIA_TYPE);
+			}
+			System.out.println(scufl2File.getPath() + " is created.");
+		}catch (ReaderException e){
+			System.err.println("Error: Connot read the file");
+		}catch(IOException e){
+			System.err.println("Error: File not found");
+		}catch(WriterException e) {
+			System.err.println("Error: Cannot write to the file");
+//			e.printStackTrace();
+		}
+	}
+
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/ToJson.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/ToJson.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/ToJson.java
new file mode 100644
index 0000000..f11424c
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/ToJson.java
@@ -0,0 +1,298 @@
+package org.apache.taverna.tavlang.tools.convert;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.taverna.scufl2.api.annotation.Annotation;
+import org.apache.taverna.scufl2.api.annotation.Revision;
+import org.apache.taverna.scufl2.api.common.Child;
+import org.apache.taverna.scufl2.api.common.Ported;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.common.URITools;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.BlockingControlLink;
+import org.apache.taverna.scufl2.api.core.ControlLink;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleWriter;
+import org.apache.taverna.scufl2.api.io.WriterException;
+import org.apache.taverna.scufl2.api.port.DepthPort;
+import org.apache.taverna.scufl2.api.port.GranularDepthPort;
+import org.apache.taverna.scufl2.api.port.Port;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
+
+public class ToJson {
+	public class JsonWriter implements WorkflowBundleWriter {
+
+		@Override
+		public Set<String> getMediaTypes() {
+			return new HashSet<String>(Arrays.asList("application/ld+json",
+					"application/json"));
+		}
+
+		@Override
+		public void writeBundle(WorkflowBundle wfBundle, File destination,
+				String mediaType) throws WriterException, IOException {
+			ObjectNode json = toJson(wfBundle);
+			mapper.writeValue(destination, json);
+		}
+
+		@Override
+		public void writeBundle(WorkflowBundle wfBundle, OutputStream output,
+				String mediaType) throws WriterException, IOException {
+			ObjectNode json = toJson(wfBundle);
+			mapper.writeValue(output, json);
+		}
+
+	}
+
+	
+	private WorkflowBundleIO io = new WorkflowBundleIO();;
+
+	private WorkflowBundleWriter jsonWriter = new JsonWriter();
+
+	private ObjectMapper mapper = new ObjectMapper();
+
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	private URITools uriTools = new URITools();
+
+	public ToJson() {
+		mapper.enable(SerializationFeature.INDENT_OUTPUT);
+		mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+		mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+
+		mapper.setDateFormat(new ISO8601DateFormat());
+
+		// Adding custom writer dynamically
+		List<WorkflowBundleWriter> writers = io.getWriters();
+		writers.add(jsonWriter);
+		io.setWriters(writers);
+	}
+
+	protected void addPorts(Ported ported, ObjectNode p) {
+		ArrayNode inputs = mapper.createArrayNode();
+		for (Port port : ported.getInputPorts()) {
+			inputs.add(toJson(port));
+		}
+		p.put("inputs", inputs);
+
+		ArrayNode outputs = mapper.createArrayNode();
+		for (Port port : ported.getOutputPorts()) {
+			outputs.add(toJson(port));
+			// FIXME: Do we need the id for ports? Needed if we add datalinks
+		}
+		p.put("outputs", outputs);
+	}
+
+	protected ObjectNode annotations(Child<?> bean) {
+		ObjectNode node = mapper.createObjectNode();
+		for (Annotation ann : scufl2Tools.annotationsFor(bean)) {
+			URI annUri = uriTools.uriForBean(ann);
+
+			// TODO: include annotation body?
+		}
+		return node;
+	}
+
+	public void convert(File in, File out) throws ReaderException, IOException,
+			WriterException {
+		String filename = in.getName();
+		filename = filename.replaceFirst("\\..*", ".json");
+		File workflowFile = new File(out.getAbsolutePath(), filename);
+
+		WorkflowBundle wfBundle = io.readBundle(in, null);
+		io.writeBundle(wfBundle, workflowFile, "application/ld+json");
+//		System.out.println(workflowFile);
+
+	}
+
+	protected ObjectNode toJson(Port port) {
+		ObjectNode p = mapper.createObjectNode();
+		p.put("name", port.getName());
+		p.putPOJO("id",
+				uriTools.relativeUriForBean(port, scufl2Tools.findParent(
+						WorkflowBundle.class, ((Child<?>) port))));
+
+		if (port instanceof DepthPort) {
+			DepthPort depthPort = (DepthPort) port;
+			if (depthPort.getDepth() != null) {
+				p.put("depth", depthPort.getDepth());
+			}
+		}
+		if (port instanceof GranularDepthPort) {
+			GranularDepthPort granularDepthPort = (GranularDepthPort) port;
+			if (granularDepthPort.getGranularDepth() != null
+					&& !granularDepthPort.getGranularDepth().equals(
+							granularDepthPort.getDepth())) {
+				p.put("granularDepth", granularDepthPort.getGranularDepth());
+			}
+		}
+		p.putAll(annotations((Child<?>) port));
+		return p;
+	}
+
+	protected JsonNode toJson(Processor proc) {
+		ObjectNode p = mapper.createObjectNode();
+		p.putPOJO("id",
+				uriTools.relativeUriForBean(proc, proc.getParent().getParent()));
+		p.put("name", proc.getName());
+		addPorts(proc, p);
+		p.putAll(annotations(proc));
+
+		List<Workflow> nested = scufl2Tools.nestedWorkflowsForProcessor(proc,
+				proc.getParent().getParent().getMainProfile());
+		if (!nested.isEmpty()) {
+			if (nested.size() == 1) {
+				p.put("nestedWorkflow", toJson(nested.iterator().next()));
+			} else {
+				ArrayNode list = mapper.createArrayNode();
+				for (Workflow w : nested) {
+					list.add(toJson(w));
+				}
+				p.put("nestedWorkflow", list);
+			}
+		}
+		return p;
+	}
+
+	protected JsonNode toJson(Revision currentRevision) {
+		ArrayNode revisions = mapper.createArrayNode();
+		while (currentRevision != null) {
+			ObjectNode rev = mapper.createObjectNode();
+			rev.putPOJO("id", currentRevision.getIdentifier());
+			if (currentRevision.getGeneratedAtTime() != null) {
+				rev.putPOJO("generatedAtTime",
+						currentRevision.getGeneratedAtTime());
+			}
+			currentRevision = currentRevision.getPreviousRevision();
+			if (currentRevision != null) {
+				rev.putPOJO("wasRevisionOf", currentRevision.getIdentifier());
+			}
+			revisions.add(rev);
+		}
+		return revisions;
+	}
+
+	protected ObjectNode toJson(Workflow workflow) {
+		ObjectNode wf = mapper.createObjectNode();
+
+		wf.putPOJO("id",
+				uriTools.relativeUriForBean(workflow, workflow.getParent()));
+
+		wf.put("name", workflow.getName());
+		wf.put("revisions", toJson(workflow.getCurrentRevision()));
+
+		ArrayNode processors = mapper.createArrayNode();
+		for (Processor p : workflow.getProcessors()) {
+			processors.add(toJson(p));
+		}
+		addPorts(workflow, wf);
+		wf.put("processors", processors);
+
+		ArrayNode datalinks = mapper.createArrayNode();
+		for (DataLink link : workflow.getDataLinks()) {
+			datalinks.add(toJson(link));
+		}
+		wf.put("datalinks", datalinks);
+
+		ArrayNode controlLinks = mapper.createArrayNode();
+		for (ControlLink link : workflow.getControlLinks()) {
+			controlLinks.add(toJson(link));
+		}
+		wf.put("controllinks", controlLinks);
+
+		wf.putAll(annotations(workflow));
+
+		return wf;
+	}
+
+	protected JsonNode toJson(ControlLink link) {
+		ObjectNode l = mapper.createObjectNode();
+		if (link instanceof BlockingControlLink) {
+			BlockingControlLink controlLink = (BlockingControlLink) link;
+			l.putPOJO("block", uriTools.relativeUriForBean(
+					controlLink.getBlock(), link.getParent().getParent()));
+			l.putPOJO("untilFinished", uriTools.relativeUriForBean(controlLink
+					.getUntilFinished(), link.getParent().getParent()));
+		}
+		return l;
+	}
+
+	protected JsonNode toJson(DataLink link) {
+		ObjectNode l = mapper.createObjectNode();
+		l.putPOJO("receivesFrom", uriTools.relativeUriForBean(
+				link.getReceivesFrom(), link.getParent().getParent()));
+		l.putPOJO("sendsTo", uriTools.relativeUriForBean(link.getSendsTo(),
+				link.getParent().getParent()));
+		if (link.getMergePosition() != null) {
+			l.put("mergePosition", link.getMergePosition());
+		}
+		return l;
+	}
+
+	public ObjectNode toJson(WorkflowBundle wfBundle) {
+
+		ObjectNode root = mapper.createObjectNode();
+		ArrayNode contextList = root.arrayNode();
+		root.put("@context", contextList);
+		ObjectNode context = root.objectNode();
+		contextList.add("https://w3id.org/scufl2/context");
+		contextList.add(context);
+		URI base = wfBundle.getGlobalBaseURI();
+		context.put("@base", base.toASCIIString());
+		root.put("id", base.toASCIIString());
+
+		// root.put("name", wfBundle.getName());
+		// root.put("revisions", toJson(wfBundle.getCurrentRevision()));
+
+		root.put("workflow", toJson(wfBundle.getMainWorkflow()));
+		root.put("profile", toJson(wfBundle.getMainProfile()));
+
+		return root;
+	}
+
+	private JsonNode toJson(Profile profile) {
+		ObjectNode pf = mapper.createObjectNode();
+
+		pf.putPOJO("id",
+				uriTools.relativeUriForBean(profile, profile.getParent()));
+		// TODO: Activities and configurations
+		return pf;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/ToRobundle.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/ToRobundle.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/ToRobundle.java
new file mode 100644
index 0000000..6ab14bc
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/convert/ToRobundle.java
@@ -0,0 +1,66 @@
+package org.apache.taverna.tavlang.tools.convert;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.taverna.robundle.Bundle;
+import org.apache.taverna.robundle.Bundles;
+
+public class ToRobundle{
+
+	public ToRobundle(List<String> files, String out) throws Exception{
+		
+		Logger logger = Logger.getLogger("");
+		//logger.setLevel(Level.FINER);
+		ConsoleHandler console = new ConsoleHandler();
+		console.setLevel(Level.FINEST);
+		logger.addHandler(console);
+		Logger.getLogger("org.researchobject").setLevel(Level.FINEST);
+		
+		for(String f : files){
+			Path file = Paths.get(f);
+			convert(file);
+		}
+	}
+	
+	//Recursive conversion
+	public ToRobundle(String type, String in, String out) {
+		
+	}
+	
+	public void convert(Path file) throws IOException{
+		try (Bundle bundle = Bundles.openBundle(file)) {
+			
+//			System.out.println(bundle.getManifest().toString());
+			bundle.getManifest().writeAsJsonLD();
+			bundle.getManifest().writeAsCombineManifest();
+		}
+	}
+	
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/inspect/ProcessorNames.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/inspect/ProcessorNames.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/inspect/ProcessorNames.java
new file mode 100644
index 0000000..f93aadc
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/inspect/ProcessorNames.java
@@ -0,0 +1,169 @@
+package org.apache.taverna.tavlang.tools.inspect;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeModel;
+import javax.xml.bind.JAXBException;
+
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.common.URITools;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+/*
+ * list the processor names used in the workflow.
+ * Supported formats: .t2flow, .wfbundle
+ * */
+
+public class ProcessorNames {
+	
+	private List<String> fileList;
+	
+	private String file2;
+	
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	private URITools uriTools = new URITools();
+
+	public ProcessorNames(List<String> fileList, String file) throws ReaderException, IOException, JAXBException{
+		this.fileList = fileList;
+		this.file2 = file;
+		this.show();
+	}
+	
+	public void show() throws ReaderException, IOException, JAXBException{
+		WorkflowBundleIO io = new WorkflowBundleIO();
+		StringBuilder sb = new StringBuilder();
+		
+		for(String file : this.fileList){
+			File file2 = new File(file);
+			if(file2.isDirectory()){
+				for(File f : file2.listFiles()){
+					WorkflowBundle wfb = io.readBundle(f, null);
+					System.out.println("Processor tree of "+ f.getName() +" \n" +this.showProcessorTree(wfb));
+					sb.append("Processor tree of "+ f.getName() +" \n" +this.showProcessorTree(wfb) + "\n");
+				}
+			}else{
+				WorkflowBundle wfb = io.readBundle(new File(file), null);
+				System.out.println("Processor tree of "+ file +" \n" +this.showProcessorTree(wfb));
+				sb.append("Processor tree of "+ file +" \n" +this.showProcessorTree(wfb) + "\n");
+			}
+			
+			
+		}
+		
+		if(this.file2!=null){
+			File log = new File(file2);
+			FileWriter fw = new FileWriter(log);
+			BufferedWriter bw = new BufferedWriter(fw);
+			bw.write(sb.toString());
+			bw.close();
+			fw.close();
+			System.out.println("Results were saved into " + file2);
+		}
+	}
+	
+	private Workflow findNestedWorkflow(Processor processor) {
+		Profile profile = processor.getParent().getParent().getMainProfile();
+		return scufl2Tools.nestedWorkflowForProcessor(processor, profile);
+	}
+
+	private void findProcessors(WorkflowBundle ro, Workflow workflow,
+			DefaultMutableTreeNode parent) {
+		for (Processor processor : workflow.getProcessors()) {
+			DefaultMutableTreeNode processorNode = new DefaultMutableTreeNode(
+					processor.getName());
+			parent.add(processorNode);
+			Workflow wf = findNestedWorkflow(processor);
+			if (wf != null) {
+				findProcessors(ro, wf, processorNode);
+			}
+		}
+
+	}
+
+	public TreeModel makeProcessorTree(WorkflowBundle workflowBundle)
+			throws JAXBException, IOException {
+		Workflow workflow = workflowBundle.getMainWorkflow();
+		TreeModel treeModel = new DefaultTreeModel(new DefaultMutableTreeNode(
+				workflow.getName()));
+		DefaultMutableTreeNode parent = (DefaultMutableTreeNode) treeModel
+				.getRoot();
+
+		findProcessors(workflowBundle, workflow, parent);
+		return treeModel;
+	}
+
+	public List<String> showProcessorNames(WorkflowBundle ro)
+			throws JAXBException, IOException {
+		ArrayList<String> names = new ArrayList<String>();
+		for (Processor processor : ro.getMainWorkflow().getProcessors()) {
+			names.add(processor.getName());
+		}
+		Collections.sort(names);
+		return names;
+	}
+
+	public String showProcessorTree(WorkflowBundle ro) throws JAXBException,
+			IOException {
+		TreeModel treeModel = makeProcessorTree(ro);
+		return treeModelAsString(treeModel);
+	}
+
+	public String treeModelAsString(TreeModel treeModel) {
+		StringBuffer sb = new StringBuffer();
+		Object root = treeModel.getRoot();
+		treeModelAsString(treeModel, root, sb, "");
+		return sb.toString();
+	}
+
+	protected void treeModelAsString(TreeModel treeModel, Object parent,
+			StringBuffer sb, String indentation) {
+		sb.append(indentation);
+		int childCount = treeModel.getChildCount(parent);
+		if (childCount == 0) {
+			sb.append("- ");
+		} else {
+			sb.append("+ ");
+			indentation = indentation + "  ";
+		}
+		sb.append(parent);
+		sb.append("\n");
+		for (int i = 0; i < childCount; i++) {
+			Object child = treeModel.getChild(parent, i);
+			treeModelAsString(treeModel, child, sb, indentation);
+		}
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/inspect/ServiceTypes.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/inspect/ServiceTypes.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/inspect/ServiceTypes.java
new file mode 100644
index 0000000..ddff2ab
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/inspect/ServiceTypes.java
@@ -0,0 +1,112 @@
+package org.apache.taverna.tavlang.tools.inspect;
+
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+/*
+ * List the service types used in workflow.
+ * Supported file formats : .wfbundle, .t2flow
+ * */
+
+public class ServiceTypes {
+	
+	private List<String> filesList;
+	private Set<String> types = new LinkedHashSet<String>();
+	private String save;
+	
+	public ServiceTypes(List<String> filesList, String file) throws IOException, ReaderException{
+		this.filesList = filesList;
+		this.save = file;
+		this.service();
+		
+	}
+	
+	public void service() throws ReaderException, IOException{
+		WorkflowBundleIO io = new WorkflowBundleIO();
+		StringBuilder sb = new StringBuilder();
+		
+		for (String filepath : filesList) {
+			File file = new File(filepath);
+			
+			if(file.isDirectory()){
+				for(File f : file.listFiles()){
+				WorkflowBundle wfBundle = io.readBundle(f, null);
+				System.out.println("Service types used in " + f.getCanonicalPath() + " :" +"\n");
+				sb.append("Service types used in " + f.getCanonicalPath() + " :");
+				for (Profile profile : wfBundle.getProfiles()) {
+					for (Activity activity : profile.getActivities()) {
+						this.types.add(activity.getType().toASCIIString());
+					}
+				}
+				for(String t : types){
+					System.out.println(t);
+					sb.append(t + "\n");
+				}
+				System.out.println("\n**************************************************\n");
+				sb.append("\n**************************************************\n");
+				}
+			}else{
+			// mediaType = null  --> guess
+				WorkflowBundle wfBundle = io.readBundle(file, null);
+				System.out.println("Service types used in " + file.getCanonicalPath() + " :" + "\n");
+				sb.append("Service types used in " + file.getCanonicalPath() + " :");
+				for (Profile profile : wfBundle.getProfiles()) {
+					for (Activity activity : profile.getActivities()) {
+						this.types.add(activity.getType().toASCIIString());
+					}
+				}
+				for(String t : types){
+					System.out.println(t);
+					sb.append(t + "\n");
+				}
+				
+				System.out.println("\n**************************************************\n");
+				sb.append("\n**************************************************\n");
+			}
+		}
+		
+		if(save!=null){
+			File log = new File(save);
+			FileWriter fw = new FileWriter(log);
+			BufferedWriter bw = new BufferedWriter(fw);
+			bw.write(sb.toString());
+			bw.close();
+			fw.close();
+			System.out.println("Results were saved into " + save);
+		}
+		
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/stats/GetWfStat.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/stats/GetWfStat.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/stats/GetWfStat.java
new file mode 100644
index 0000000..7daa38e
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/stats/GetWfStat.java
@@ -0,0 +1,193 @@
+package org.apache.taverna.tavlang.tools.stats;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.ControlLink;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.port.InputPort;
+import org.apache.taverna.scufl2.api.port.OutputPort;
+
+public class GetWfStat {
+	
+	private NamedSet<Workflow> set;
+	private String logFile;
+	private boolean verbose;
+	private StringBuilder str_verb = new StringBuilder();
+	private StringBuilder str_nverb = new StringBuilder();
+	
+	
+	//If given file is a workflow file
+	public GetWfStat(List<String> wf_files, String log, boolean verbose){
+		this.logFile = log;
+		this.verbose = verbose;
+		
+		for(String files : wf_files){
+			File f = new File(files);
+			if(f.isFile()){
+				this.read(f);
+				
+			}else{
+				System.err.println("Error reading the file " + f.getName());
+			}
+		}
+		
+		this.isVerbose();
+		
+		if(log!=null){
+			this.writefile(this.str_verb.toString(), this.logFile);
+		}
+	}
+	
+	//Read the workflow file and extract the resources.
+	//And append them to a String builder
+	public void read(File file){
+		WorkflowBundleIO io = new WorkflowBundleIO();
+		try {
+			WorkflowBundle wf = io.readBundle(file, null);
+			this.set = wf.getWorkflows();
+
+			//String to be written to a file.
+			this.str_nverb.append(">>> Statistics of the workflow bundle: " + file.getName() + " <<<\n");
+			this.str_verb.append(">>> Statistics of the workflow bundle: " + file.getName() + " <<<\n");
+			
+			for(Workflow wrf : set){
+				//TODO :- Take each type of resource and make a system to view them to the user.
+				String name = "Name of the workflow = " + wrf.getName();
+				this.str_verb.append(name + "\n");
+				this.str_nverb.append(name + "\n");
+
+				
+				String noP = "  |--> Number of Processors = " + wrf.getProcessors().size();
+				this.str_verb.append(noP + "\n");
+				this.str_nverb.append(noP + "\n");
+				
+				if(this.verbose && wrf.getProcessors().size()!=0){
+					this.str_verb.append("  |     |--> Processors: " + "\n");
+					
+					for(Processor p : wrf.getProcessors()){
+						this.str_verb.append("  |          |--> " + p.getName() + "\n");
+					}
+					this.str_verb.append("  |" + "\n");
+				}
+				
+				this.str_verb.append("  |--> Number of Data Links = " + wrf.getDataLinks().size() + "\n");
+				this.str_nverb.append("  |--> Number of Data Links = " + wrf.getDataLinks().size() + "\n");
+				
+				if(this.verbose && wrf.getDataLinks().size()!=0){
+					this.str_verb.append("  |     |--> Data Links" + "\n");
+					
+					for(DataLink link : wrf.getDataLinks()){
+						this.str_verb.append("  |          |--> " + link + "\n");
+					}
+					this.str_verb.append("  |" + "\n");
+				}
+				
+				this.str_nverb.append("  |--> Number of Control Links = " + wrf.getControlLinks().size() + "\n");
+				this.str_verb.append("  |--> Number of Control Links = " + wrf.getControlLinks().size() + "\n");
+				
+				
+				if(this.verbose && wrf.getControlLinks().size()!=0){
+					this.str_verb.append("  |     |--> Control Links\n");
+					for(ControlLink link : wrf.getControlLinks()){
+						this.str_verb.append("  |          |--> " + link + "\n");
+					}
+					this.str_verb.append("  |\n");
+				}
+				
+				this.str_nverb.append("  |--> Number of Input ports = " + wrf.getInputPorts().size()+"\n");
+				this.str_verb.append("  |--> Number of Input ports = " + wrf.getInputPorts().size()+"\n");
+				
+				
+				if(this.verbose && wrf.getInputPorts().size()!=0){
+					this.str_verb.append("  |     |--> Input Ports\n");
+					for(InputPort iport : wrf.getInputPorts()){
+						this.str_verb.append("  |          |--> " + iport.toString()+"\n");
+					}
+					this.str_verb.append("  |\n");
+				}
+			
+				this.str_nverb.append("  |--> Number of Output Ports = " + wrf.getOutputPorts().size()+"\n");
+				this.str_verb.append("  |--> Number of Output Ports = " + wrf.getOutputPorts().size()+"\n");
+				
+				if(this.verbose && wrf.getOutputPorts().size()!=0){
+					this.str_verb.append("  |     |--> Output Ports\n");
+					for(OutputPort o_port : wrf.getOutputPorts()){
+						this.str_verb.append("  |          |--> " + o_port.toString()+"\n");
+					}
+					
+					this.str_verb.append("\n");
+				}
+				
+				this.str_nverb.append("\n");
+				this.str_verb.append("\n");
+			}
+			
+		} catch (ReaderException | IOException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	
+	//Saving the output into a log
+	public void writefile(String report, String url){
+		
+			File file = new File(url);
+			
+			if(!file.isFile()){
+				System.err.println("Error in writing the log file...");
+			}
+			
+			FileWriter writer;
+			BufferedWriter bfw;
+			try {
+				writer = new FileWriter(file);
+				bfw = new BufferedWriter(writer);
+				bfw.write(report);
+				bfw.close();
+				writer.close();
+				System.out.println("Results were saved into " + file.getPath());
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		
+	}
+		
+	public void isVerbose(){
+		if(verbose)
+			System.out.println(this.str_verb.toString());
+		else 
+			System.out.println(this.str_nverb.toString());
+	}
+	
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/validate/Validate.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/validate/Validate.java b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/validate/Validate.java
new file mode 100644
index 0000000..fc05e3b
--- /dev/null
+++ b/taverna-tavlangtool/src/main/java/org/apache/taverna/tavlang/tools/validate/Validate.java
@@ -0,0 +1,151 @@
+package org.apache.taverna.tavlang.tools.validate;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidationListener;
+import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
+import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
+
+/*
+ * Takes .wfbundle/ .t2flow as the input
+ * */
+public class Validate {
+
+	private String logfile;
+	private String nonVerbose = "";
+	private String finalrep = "";
+	private boolean verbose;
+	private boolean check = false;
+	
+
+	public Validate(List<String> files, String file, boolean verbose) {
+		this.verbose = verbose;
+		this.logfile = file;
+		System.out.println("Validation started....");
+		for (String f : files) {
+			System.out.println("Validating " + f);
+			File wfile = new File(f);
+			read(wfile);
+			
+		}
+		System.out.println("Validation completed.......");
+		
+		
+		if (this.logfile != null) {
+			saveToLog(this.finalrep);
+		}
+	}
+
+	public void read(File file) {
+		WorkflowBundleIO io = new WorkflowBundleIO();
+		try {
+			this.finalrep += validate(io.readBundle(file, null), file.getName());
+			
+		} catch (ReaderException e) {
+			System.err.println(e.getMessage());
+
+		} catch (IOException e) {
+			System.err.println("Workflow bundle not found!");
+			System.err.println(e.getMessage());
+
+		}
+	}
+
+	public String validate(WorkflowBundle wfb, String file) {
+		
+		StringBuilder report2 = new StringBuilder();
+		CorrectnessValidationListener correctnessValidationListener = new ReportCorrectnessValidationListener();
+		CorrectnessValidator correctnessValidator = new CorrectnessValidator();
+		correctnessValidationListener = correctnessValidator.validate(wfb);
+		String report = correctnessValidationListener.toString().replace(
+				"ReportCorrectnessValidationListener [", "");
+
+		String[] sections = report.split(", ");
+
+		
+		
+		boolean detect = correctnessValidationListener.detectedProblems();
+		if (!detect){
+			report2.append("The workflow " + file + " has no errors. \n\n");
+			this.nonVerbose = "The workflow " + file + " has no errors. \n";
+		}
+			
+		
+//		System.out.println("The validation report for " + file);
+		report2.append("The validation report for " + file + "......\n");
+		report2.append("-------------------------------------------------------------------------------- \n");
+		for (int i = 0; i < sections.length; i++) {
+			String line = "-->"+sections[i].split("=")[0].replace("()", "").replace(
+					"get", "")
+					+ ":- ";
+			report2.append(line);
+			String line2 =  sections[i].split("=")[1].replace("[", "").replace("]","");
+			if(line2.equals("")) report2.append("null \n\n");
+			else report2.append("\t").append(line2).append("\n");
+			
+		
+		}
+		report2.append("--------------------------------------------------------------------------------- \n\n");
+		
+		if(detect){
+			System.out.println("The workflow bundle has following problems: \n"+report2.toString());
+			check = true;
+		}
+		
+		if(verbose){
+			System.out.println(report2.toString());
+		}else{
+			System.out.println(this.nonVerbose);
+		}
+		
+		return report2.toString();
+
+	}
+
+	public void saveToLog(String s) {
+		File logFile = new File(this.logfile);
+		FileWriter logwriter;
+		try {
+			logwriter = new FileWriter(logFile);
+			BufferedWriter blw = new BufferedWriter(logwriter);
+			blw.write(s);
+			blw.close();
+			logwriter.close();
+			System.out.println("Results were saved into " + logFile.getPath());
+		} catch (IOException e) {
+			System.err.println("Error writing to the file \n" + e.getMessage());
+		}
+
+	}
+	
+	public boolean getCheck(){
+		return this.check;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/resources/.gitignore
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/resources/.gitignore b/taverna-tavlangtool/src/main/resources/.gitignore
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/main/resources/META-INF/NOTICE b/taverna-tavlangtool/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..370a8fc
--- /dev/null
+++ b/taverna-tavlangtool/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,7 @@
+Apache Taverna Language
+Copyright 2010-2014 University of Manchester, UK
+Copyright 2014-2015 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/test/java/.gitignore
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/test/java/.gitignore b/taverna-tavlangtool/src/test/java/.gitignore
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/CommandLineTest.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/CommandLineTest.java b/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/CommandLineTest.java
new file mode 100644
index 0000000..6beaa8e
--- /dev/null
+++ b/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/CommandLineTest.java
@@ -0,0 +1,43 @@
+package org.apache.taverna.tavlang.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import org.apache.taverna.tavlang.CommandLineTool;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CommandLineTest {
+	CommandLineTool commandLineTool = new CommandLineTool();
+	
+	@Test
+	public void testHelp(){
+		commandLineTool.parse();
+		commandLineTool.parse("version");
+		commandLineTool.parse("help");
+		commandLineTool.parse("help", "convert");
+		commandLineTool.parse("help", "inspect");
+		commandLineTool.parse("help", "validate");
+		commandLineTool.parse("help", "help");
+	}
+	
+	
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/TestConvert.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/TestConvert.java b/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/TestConvert.java
new file mode 100644
index 0000000..a920db2
--- /dev/null
+++ b/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/TestConvert.java
@@ -0,0 +1,34 @@
+package org.apache.taverna.tavlang.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class TestConvert{
+
+	@Test
+	public void testConvertS() {
+//		fail("Not yet implemented");
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/1e13219f/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/TestStats.java
----------------------------------------------------------------------
diff --git a/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/TestStats.java b/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/TestStats.java
new file mode 100644
index 0000000..4c22377
--- /dev/null
+++ b/taverna-tavlangtool/src/test/java/org/apache/taverna/tavlang/test/TestStats.java
@@ -0,0 +1,34 @@
+package org.apache.taverna.tavlang.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class TestStats {
+
+	@Test
+	public void test() {
+//		fail("Not yet implemented");
+	}
+
+}