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:47 UTC
[06/15] incubator-taverna-common-activities git commit: modified CWL
Activity
modified CWL Activity
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/135c416a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/tree/135c416a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/diff/135c416a
Branch: refs/heads/cwl-browse
Commit: 135c416a2056c451e4793cd4c03beba09e725441
Parents: c00353b
Author: ThilinaManamgoda <ma...@gmail.com>
Authored: Thu Jun 2 01:23:04 2016 +0530
Committer: ThilinaManamgoda <ma...@gmail.com>
Committed: Thu Jun 2 01:23:04 2016 +0530
----------------------------------------------------------------------
.../ui/serviceprovider/CwlServiceProvider.java | 40 +----------
.../org/apache/taverna/cwl/CwlDumyActivity.java | 74 +++++++++-----------
2 files changed, 36 insertions(+), 78 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/135c416a/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
index fda4d84..45658c0 100644
--- 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
@@ -94,45 +94,7 @@ public class CwlServiceProvider extends AbstractConfigurableServiceProvider<CwlS
}
- private HashMap<String, Type> processInputs(ArrayList<Map> inputs) {
-
- HashMap<String, Type> result = new HashMap<>();
- for (Map input : inputs) {
- String currentInputId = (String) input.get(ID);
- Object typeConfigurations;
- Type type = null;// this object holds the type of the input/output
- // or if it's an array then the type of the
- // elements in the array
-
- try {
-
- typeConfigurations = input.get(TYPE);
- // if type :single argument
- if (typeConfigurations.getClass() == String.class) {
- type = new Type();
- type.setType((String) typeConfigurations);
- type.setItems(null);// set it to null so that later we can
- // figure out this a single argument
- // type
-
- // type : defined as another map which contains type:
- } else if (typeConfigurations.getClass() == LinkedHashMap.class) {
-
- type = new Type();
- type.setType((String) ((Map) typeConfigurations).get(TYPE));
- type.setItems((String) ((Map) typeConfigurations).get(ITEMS));
- }
-
- } catch (ClassCastException e) {
-
- System.out.println("Class cast exception !!!");
- }
- if (type != null)// see whether type is defined or not
- result.put(currentInputId, type);
-
- }
- return result;
- }
+
@Override
public Icon getIcon() {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/135c416a/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 03944e0..ba95d68 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,6 +18,7 @@ package org.apache.taverna.cwl;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.taverna.reference.T2Reference;
@@ -26,6 +27,7 @@ import org.apache.taverna.workflowmodel.processor.activity.ActivityConfiguration
import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivity;
import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivityCallback;
+
public class CwlDumyActivity extends AbstractAsynchronousActivity<CwlActivityConfigurationBean>
implements AsynchronousActivity<CwlActivityConfigurationBean> {
@@ -44,16 +46,9 @@ public class CwlDumyActivity extends AbstractAsynchronousActivity<CwlActivityCon
private static final String STRING="string";
@Override
- public void configure(CwlActivityConfigurationBean arg0) throws ActivityConfigurationException {
+ public void configure(CwlActivityConfigurationBean configurationBean) throws ActivityConfigurationException {
removeInputs();
removeOutputs();
-
- }
-
-
-
- private void getInputs(CwlActivityConfigurationBean configurationBean) {
-
Map cwlFile = configurationBean.getCwlConfigurations();
// Get all input objects in
@@ -66,54 +61,55 @@ public class CwlDumyActivity extends AbstractAsynchronousActivity<CwlActivityCon
for (String inputId : processedInputs.keySet()) {
if (processedInputs.get(inputId).getType().equals(FILE))
- System.out.println("ID: " + inputId + " type : File");
-
-
+ addInput(inputId, 0, true, null, String.class);
if (processedInputs.get(inputId).getType().equals(ARRAY))
- System.out.println(
- "ID :" + inputId + " type: Array items: " + processedInputs.get(inputId).getItems());
+ addInput(inputId, 1, true, null, byte[].class);
}
}
}
+
+
private HashMap<String, Type> processInputs(ArrayList<Map> inputs) {
HashMap<String, Type> result = new HashMap<>();
-
for (Map input : inputs) {
+ String currentInputId = (String) input.get(ID);
+ Object typeConfigurations;
+ Type type = null;// this object holds the type of the input/output
+ // or if it's an array then the type of the
+ // elements in the array
- String Id = (String) input.get(ID);
- // This require for nested type definitions
- Map typeConfigurations;
- // this object holds the type and if it's an array then type of the
- // elements in the array
- Type type = new Type();
try {
- /*
- * This part will go through nested type definitions
- *
- * type :
- * type : array
- * items : boolean
- *
- */
-
- typeConfigurations = (Map) input.get(TYPE);
- type.setType((String) typeConfigurations.get(TYPE));
- type.setItems((String) typeConfigurations.get(ITEMS));
+
+ typeConfigurations = input.get(TYPE);
+ // if type :single argument
+ if (typeConfigurations.getClass() == String.class) {
+ type = new Type();
+ type.setType((String) typeConfigurations);
+ type.setItems(null);// set it to null so that later we can
+ // figure out this a single argument
+ // type
+
+ // type : defined as another map which contains type:
+ } else if (typeConfigurations.getClass() == LinkedHashMap.class) {
+
+ type = new Type();
+ type.setType((String) ((Map) typeConfigurations).get(TYPE));
+ type.setItems((String) ((Map) typeConfigurations).get(ITEMS));
+ }
+
} catch (ClassCastException e) {
- /*This exception means type is described as single argument ex:
- * type : File
- */
- type.setType((String) input.get(TYPE));
- type.setItems(null);
+
+ System.out.println("Class cast exception !!!");
}
- result.put(Id, type);
+ if (type != null)// see whether type is defined or not
+ result.put(currentInputId, type);
+
}
return result;
}
-
@Override
public void executeAsynch(Map<String, T2Reference> arg0, AsynchronousActivityCallback arg1) {
}