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/06/08 12:40:43 UTC
[02/15] incubator-taverna-common-activities git commit: Testing cwl
reader and created cwlserviceprovider, cwlservicedes, cwlconfigurationbean
Testing cwl reader and created cwlserviceprovider,cwlservicedes,cwlconfigurationbean
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/commit/6f710700
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/tree/6f710700
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/diff/6f710700
Branch: refs/heads/cwl-browse
Commit: 6f71070041605beec6e5c67a3415e11880c7324d
Parents: e9b7d21
Author: ThilinaManamgoda <ma...@gmail.com>
Authored: Thu May 26 05:21:09 2016 +0530
Committer: ThilinaManamgoda <ma...@gmail.com>
Committed: Thu May 26 05:21:09 2016 +0530
----------------------------------------------------------------------
.../CWLFiles/binding-test.cwl | 20 ++++
taverna-cwl-activity-ui/CWLFiles/cat2-tool.cwl | 16 +++
taverna-cwl-activity-ui/pom.xml | 62 ++++++----
.../java/org/apache/taverna/cwl/ui/App.java | 16 +++
.../org/apache/taverna/cwl/ui/CWLParser.java | 93 +++++++++++++++
.../CwlActivityConfigurationBean.java | 33 ++++++
.../cwl/ui/serviceprovider/CwlServiceDesc.java | 60 ++++++++++
.../ui/serviceprovider/CwlServiceProvider.java | 112 +++++++++++++++++++
.../taverna/cwl/ui/serviceprovider/Testing.java | 104 +++++++++++++++++
.../java/org/apache/taverna/cwl/ui/AppTest.java | 16 +++
.../cwl/CwlActivityConfigurationBean.java | 12 ++
.../org/apache/taverna/cwl/CwlDumyActivity.java | 8 +-
12 files changed, 525 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/CWLFiles/binding-test.cwl
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/CWLFiles/binding-test.cwl b/taverna-cwl-activity-ui/CWLFiles/binding-test.cwl
new file mode 100644
index 0000000..2905c51
--- /dev/null
+++ b/taverna-cwl-activity-ui/CWLFiles/binding-test.cwl
@@ -0,0 +1,20 @@
+#!/usr/bin/env cwl-runner
+
+class: CommandLineTool
+cwlVersion: cwl:draft-3
+
+inputs:
+ - id: reference
+ type: File
+ inputBinding: { position: 2 }
+
+ - id: reads
+ type:
+ type: array
+ items: File
+ inputBinding: { prefix: "-YYY" }
+ inputBinding: { position: 3, prefix: "-XXX" }
+
+outputs: []
+
+baseCommand: [bwa, mem]
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/CWLFiles/cat2-tool.cwl
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/CWLFiles/cat2-tool.cwl b/taverna-cwl-activity-ui/CWLFiles/cat2-tool.cwl
new file mode 100644
index 0000000..5569156
--- /dev/null
+++ b/taverna-cwl-activity-ui/CWLFiles/cat2-tool.cwl
@@ -0,0 +1,16 @@
+#!/usr/bin/env cwl-runner
+class: CommandLineTool
+cwlVersion: cwl:draft-3
+description: "Print the contents of a file to stdout using 'cat' running in a docker container."
+hints:
+ - class: DockerRequirement
+ dockerPull: debian:wheezy
+inputs:
+ - id: file1
+ type: File
+ - id: file2
+ type: File
+
+outputs: []
+baseCommand: cat
+stdin: $(inputs.file1.path)
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/pom.xml b/taverna-cwl-activity-ui/pom.xml
index 1baac83..da02053 100644
--- a/taverna-cwl-activity-ui/pom.xml
+++ b/taverna-cwl-activity-ui/pom.xml
@@ -1,22 +1,14 @@
<?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.
-
--->
+<!-- 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -46,6 +38,7 @@
<artifactId>taverna-app-configuration-api</artifactId>
<version>${taverna.osgi.version}</version>
</dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -70,11 +63,36 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
+<!-- =====================================These Dependencies were added later !!! =============================================================== -->
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>1.17</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>activity-palette-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+
-
-
+ <!-- ==================================================================================================== -->
</dependencies>
-
-
+
+ <!-- Added these properties to configure new dependencies -->
+ <properties>
+ <t2.ui.api.version>1.5</t2.ui.api.version>
+ </properties>
+ <repositories>
+ <repository>
+ <id>mygrid-repository</id>
+ <name>myGrid Repository</name>
+ <url>http://www.mygrid.org.uk/maven/repository</url>
+ <releases />
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/App.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/App.java b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/App.java
index e897cb7..4abf19f 100644
--- a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/App.java
+++ b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/App.java
@@ -1,3 +1,19 @@
+/*******************************************************************************
+ * 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.
+ *******************************************************************************/
package org.apache.taverna.cwl.ui;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/CWLParser.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/CWLParser.java b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/CWLParser.java
new file mode 100644
index 0000000..1badefd
--- /dev/null
+++ b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/CWLParser.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.
+ *******************************************************************************/
+package org.apache.taverna.cwl.ui;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.yaml.snakeyaml.Yaml;
+
+
+public class CWLParser {
+
+ private File cwlFile;
+
+ private void setUpFile(File cwlFile) {
+
+ this.cwlFile = cwlFile;
+ }
+
+ private void readKeyWords() throws FileNotFoundException {
+
+ Yaml yaml = new Yaml();
+ Map contents = (Map) yaml.load(new FileInputStream(cwlFile));
+
+ for (Object key : contents.keySet()) {
+ if (key.equals("inputs"))
+ for (Object inputPairs : (ArrayList<String>) contents.get(key)) {
+ Map test = (Map) inputPairs;
+ System.out.println(inputPairs);
+
+ for (Object inputKey : test.keySet()) {
+ if (inputKey.equals("id"))
+ System.out.println(test.get(inputKey));
+ else if (inputKey.equals("type")) {
+ try {
+ Map inputType = (Map) test.get(inputKey);
+ for (Object inputTypekey : inputType.keySet()) {
+ if (inputTypekey.equals("inputBinding")) {
+ Map typeInputBinding = (Map) inputType.get(inputTypekey);
+ for (Object inputBindingKey : typeInputBinding.keySet()) {
+
+ System.out.println(
+ inputBindingKey + " " + typeInputBinding.get(inputBindingKey));
+ }
+ } else {
+ System.out.println(inputTypekey + " " + inputType.get(inputTypekey));
+ }
+ }
+ } catch (ClassCastException e) {
+ System.out.println(inputKey + " " + test.get(inputKey));
+ }
+ } else {
+ System.out.println(inputKey + " " + test.get(inputKey));
+ }
+
+ }
+
+ }
+ }
+
+ }
+
+ public static void main(String[] args) {
+ CWLParser cwlParser = new CWLParser();
+
+ cwlParser.setUpFile(new File("CWLFiles/binding-test.cwl"));
+
+ try {
+ cwlParser.readKeyWords();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlActivityConfigurationBean.java b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlActivityConfigurationBean.java
new file mode 100644
index 0000000..81d6b5f
--- /dev/null
+++ b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlActivityConfigurationBean.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.
+ *******************************************************************************/
+package org.apache.taverna.cwl.ui.serviceprovider;
+
+import java.util.Map;
+
+public class CwlActivityConfigurationBean {
+//This class holds the object which is produced by the ServiceProvider and contains the configurations that are need for the CWLActivity
+
+ private Map cwlConfigurations;
+
+ public Map getCwlConfigurations() {
+ return cwlConfigurations;
+ }
+
+ public void setCwlConfigurations(Map cwlConfigurations) {
+ this.cwlConfigurations = cwlConfigurations;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceDesc.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceDesc.java b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceDesc.java
new file mode 100644
index 0000000..8759c2f
--- /dev/null
+++ b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceDesc.java
@@ -0,0 +1,60 @@
+package org.apache.taverna.cwl.ui.serviceprovider;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.Icon;
+
+import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
+import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
+
+public class CwlServiceDesc extends ServiceDescription<CwlActivityConfigurationBean> {
+
+ private Map cwlConfiguration;
+ @Override
+ public Class<? extends Activity<CwlActivityConfigurationBean>> getActivityClass() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CwlActivityConfigurationBean getActivityConfiguration() {
+ //Creating the CWL configuration bean
+ CwlActivityConfigurationBean configurationBean = new CwlActivityConfigurationBean();
+ configurationBean.setCwlConfigurations(cwlConfiguration);
+ return configurationBean;
+ }
+
+ public Map getCwlConfiguration() {
+ return cwlConfiguration;
+ }
+
+ public void setCwlConfiguration(Map cwlConfiguration) {
+ this.cwlConfiguration = cwlConfiguration;
+ }
+
+ @Override
+ public Icon getIcon() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<? extends Comparable> getPath() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected List<? extends Object> getIdentifyingData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceProvider.java b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceProvider.java
new file mode 100644
index 0000000..a6ade53
--- /dev/null
+++ b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceProvider.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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.
+ *******************************************************************************/
+package org.apache.taverna.cwl.ui.serviceprovider;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.Icon;
+
+import org.yaml.snakeyaml.Yaml;
+
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
+
+public class CwlServiceProvider implements ServiceDescriptionProvider {
+
+ private static final File cwlFilesLocation = new File("CWLFiles");
+
+ @Override
+ public void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack) {
+
+ //This is holding the CWL configuration beans
+ List<CwlServiceDesc> result = new ArrayList<CwlServiceDesc>();
+
+ File[] cwlFiles = getCwlFiles();
+
+ for (File file : cwlFiles) {
+ Map cwlFile = null;
+ // Load the CWL file using SnakeYaml lib
+ Yaml cwlReader = new Yaml();
+ try {
+ cwlFile = (Map) cwlReader.load(new FileInputStream(file));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ if (cwlFile != null) {
+ //Creating CWl service Description
+ CwlServiceDesc cwlServiceDesc = new CwlServiceDesc();
+ cwlServiceDesc.setCwlConfiguration(cwlFile);
+ //add to the result
+ result.add(cwlServiceDesc);
+ //return the service description
+ callBack.partialResults(result);
+ }
+
+ }
+ callBack.finished();
+
+
+ }
+
+ @Override
+ public Icon getIcon() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private File[] getCwlFiles() {
+ // Get the .cwl files in the directory using the FileName Filter
+ FilenameFilter fileNameFilter = new FilenameFilter() {
+
+ @Override
+ public boolean accept(File dir, String name) {
+ if (name.lastIndexOf('.') > 0) {
+ // get last index for '.' char
+ int lastIndex = name.lastIndexOf('.');
+
+ // get extension
+ String str = name.substring(lastIndex);
+
+ // match path name extension
+ if (str.equals(".cwl")) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+
+ return cwlFilesLocation.listFiles(fileNameFilter);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/Testing.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/Testing.java b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/Testing.java
new file mode 100644
index 0000000..0dfab96
--- /dev/null
+++ b/taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/Testing.java
@@ -0,0 +1,104 @@
+package org.apache.taverna.cwl.ui.serviceprovider;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.yaml.snakeyaml.Yaml;
+
+public class Testing {
+ private static final File cwlFilesLocation = new File("CWLFiles");
+ private static final String INPUTS = "inputs";
+ private static final String ID = "id";
+ private static final String TYPE = "type";
+ private static final String ARRAY = "array";
+ private static final String FILE = "File";
+
+ public static void main(String[] args) {
+ File[] cwlFiles = getCwlFiles();
+
+ for (File file : cwlFiles) {
+ Map cwlFile = null;
+ // Load the CWL file using SnakeYaml lib
+ Yaml cwlReader = new Yaml();
+ try {
+ cwlFile = (Map) cwlReader.load(new FileInputStream(file));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ if (cwlFile != null) {
+ // Creating the CWL configuration bean
+ CwlActivityConfigurationBean configurationBean = new CwlActivityConfigurationBean();
+ configurationBean.setCwlConfigurations(cwlFile);
+ getInputs(configurationBean);
+ }
+
+ }
+ }
+
+ private static void getInputs(CwlActivityConfigurationBean configurationBean) {
+
+ Map cwlFile = configurationBean.getCwlConfigurations();
+
+ for (Object mainKey : cwlFile.keySet()) {
+
+ if (mainKey.equals(INPUTS)) {
+ ArrayList<Map> arrayList = (ArrayList<Map>) cwlFile.get(mainKey);
+ processInputs(arrayList);
+ }
+ }
+
+ }
+
+ private static HashMap<String, String> processInputs(ArrayList<Map> inputs) {
+
+ HashMap<String, String> result = new HashMap<>();
+ for (Map input : inputs) {
+ String currentInputId = (String) input.get(ID);
+ System.out.println(currentInputId);
+ Map typeConfigurations;
+ String type;
+ try {
+ typeConfigurations = (Map) input.get(TYPE);
+ type = (String) typeConfigurations.get(TYPE);
+ System.out.println(type);
+ } catch (ClassCastException e) {
+ // This exception means type is described as single argument ex:
+ // type : File
+ type = (String) input.get(TYPE);
+ }
+ result.put(currentInputId, type);
+ }
+ return result;
+ }
+
+ private static File[] getCwlFiles() {
+ // Get the cwl files in the directory using the FileName Filter
+ FilenameFilter fileNameFilter = new FilenameFilter() {
+
+ @Override
+ public boolean accept(File dir, String name) {
+ if (name.lastIndexOf('.') > 0) {
+ // get last index for '.' char
+ int lastIndex = name.lastIndexOf('.');
+
+ // get extension
+ String str = name.substring(lastIndex);
+
+ // match path name extension
+ if (str.equals(".cwl")) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+
+ return cwlFilesLocation.listFiles(fileNameFilter);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/AppTest.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/AppTest.java b/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/AppTest.java
index 48d4aa1..2657181 100644
--- a/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/AppTest.java
+++ b/taverna-cwl-activity-ui/src/test/java/org/apache/taverna/cwl/ui/AppTest.java
@@ -1,3 +1,19 @@
+/*******************************************************************************
+ * 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.
+ *******************************************************************************/
package org.apache.taverna.cwl.ui;
import junit.framework.Test;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlActivityConfigurationBean.java b/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlActivityConfigurationBean.java
index 47149de..80a73c8 100644
--- a/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlActivityConfigurationBean.java
+++ b/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlActivityConfigurationBean.java
@@ -16,6 +16,18 @@
*******************************************************************************/
package org.apache.taverna.cwl;
+import java.util.Map;
+
public class CwlActivityConfigurationBean {
+//This class holds the object which is produced by the ServiceProvider and contains the configurations that are need for the CWLActivity
+
+ private Map cwlConfigurations;
+
+ public Map getCwlConfigurations() {
+ return cwlConfigurations;
+ }
+ public void setCwlConfigurations(Map cwlConfigurations) {
+ this.cwlConfigurations = cwlConfigurations;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/6f710700/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlDumyActivity.java
----------------------------------------------------------------------
diff --git a/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlDumyActivity.java b/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlDumyActivity.java
index 1fe05c7..c8e24cc 100644
--- a/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlDumyActivity.java
+++ b/taverna-cwl-activity/src/main/java/org/apache/taverna/cwl/CwlDumyActivity.java
@@ -18,32 +18,30 @@ package org.apache.taverna.cwl;
import java.util.Map;
-import org.apache.taverna.invocation.InvocationContext;
import org.apache.taverna.reference.T2Reference;
import org.apache.taverna.workflowmodel.processor.activity.AbstractAsynchronousActivity;
import org.apache.taverna.workflowmodel.processor.activity.ActivityConfigurationException;
import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivity;
import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivityCallback;
-import org.apache.taverna.workflowmodel.processor.dispatch.events.DispatchErrorType;
public class CwlDumyActivity extends AbstractAsynchronousActivity<CwlActivityConfigurationBean> implements AsynchronousActivity<CwlActivityConfigurationBean>{
@Override
public void configure(CwlActivityConfigurationBean arg0) throws ActivityConfigurationException {
- // TODO Auto-generated method stub
+ removeInputs();
+ removeOutputs();
+
}
@Override
public void executeAsynch(Map<String, T2Reference> arg0, AsynchronousActivityCallback arg1) {
- // TODO Auto-generated method stub
}
@Override
public CwlActivityConfigurationBean getConfiguration() {
- // TODO Auto-generated method stub
return null;
}