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/05/04 10:04:24 UTC
[4/6] incubator-taverna-common-activities git commit: ToolDescription
ToolDescription
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/59a0dc12
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/tree/59a0dc12
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/diff/59a0dc12
Branch: refs/heads/master
Commit: 59a0dc12ca2e3c5fe11e0889b4b50c3aa4b57c43
Parents: b13a0fe
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Wed May 4 01:08:03 2016 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Wed May 4 01:08:03 2016 +0100
----------------------------------------------------------------------
.../externaltool/ExternalToolActivity.java | 6 +-
.../ExternalToolActivityConfigurationBean.java | 8 +-
.../externaltool/InvocationCreator.java | 4 +-
.../externaltool/desc/ToolDescription.java | 897 +++++++++++++++++++
.../externaltool/desc/UseCaseDescription.java | 897 -------------------
.../externaltool/desc/UseCaseEnumeration.java | 16 +-
.../externaltool/invocation/ToolInvocation.java | 4 +-
.../local/LocalInvocationCreator.java | 4 +-
.../externaltool/local/LocalToolInvocation.java | 4 +-
.../externaltool/ssh/SshInvocationCreator.java | 4 +-
.../externaltool/ssh/SshToolInvocation.java | 4 +-
11 files changed, 924 insertions(+), 924 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivity.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivity.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivity.java
index b2fae4e..99a3c7c 100644
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivity.java
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivity.java
@@ -27,7 +27,7 @@ import java.util.Map;
import org.apache.taverna.activities.externaltool.desc.ScriptInput;
import org.apache.taverna.activities.externaltool.desc.ScriptInputUser;
import org.apache.taverna.activities.externaltool.desc.ScriptOutput;
-import org.apache.taverna.activities.externaltool.desc.UseCaseDescription;
+import org.apache.taverna.activities.externaltool.desc.ToolDescription;
import org.apache.taverna.activities.externaltool.invocation.InvocationException;
import org.apache.taverna.activities.externaltool.invocation.ToolInvocation;
import org.apache.taverna.activities.externaltool.manager.InvocationGroup;
@@ -67,7 +67,7 @@ public class ExternalToolActivity extends AbstractAsynchronousActivity<ExternalT
private static Logger logger = Logger.getLogger(ExternalToolActivity.class);
private ExternalToolActivityConfigurationBean configurationBean;
- private UseCaseDescription mydesc;
+ private ToolDescription mydesc;
private List<InvocationCreator> invocationCreators;
@@ -280,7 +280,7 @@ public class ExternalToolActivity extends AbstractAsynchronousActivity<ExternalT
this.invocationCreators = invocationCreators;
}
- private ToolInvocation getInvocation(InvocationMechanism mechanism, UseCaseDescription description, Map<String, T2Reference> data, ReferenceService referenceService) {
+ private ToolInvocation getInvocation(InvocationMechanism mechanism, ToolDescription description, Map<String, T2Reference> data, ReferenceService referenceService) {
ToolInvocation result = null;
InvocationCreator creator = null;
for (InvocationCreator c : invocationCreators) {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivityConfigurationBean.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivityConfigurationBean.java
index 74c9070..7c4f479 100644
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivityConfigurationBean.java
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ExternalToolActivityConfigurationBean.java
@@ -21,7 +21,7 @@ package org.apache.taverna.activities.externaltool;
import java.util.List;
-import org.apache.taverna.activities.externaltool.desc.UseCaseDescription;
+import org.apache.taverna.activities.externaltool.desc.ToolDescription;
import org.apache.taverna.activities.externaltool.manager.InvocationGroup;
import org.apache.taverna.activities.externaltool.manager.InvocationMechanism;
import org.apache.taverna.activities.externaltool.manager.MechanismCreator;
@@ -43,7 +43,7 @@ public final class ExternalToolActivityConfigurationBean {
protected String repositoryUrl;
protected String externaltoolid;
- protected UseCaseDescription useCaseDescription = null;
+ protected ToolDescription useCaseDescription = null;
private boolean edited = false;
private List<MechanismCreator> mechanismCreators;
@@ -106,7 +106,7 @@ public final class ExternalToolActivityConfigurationBean {
/**
* @return the useCaseDescription
*/
- public UseCaseDescription getUseCaseDescription() {
+ public ToolDescription getUseCaseDescription() {
return useCaseDescription;
}
@@ -114,7 +114,7 @@ public final class ExternalToolActivityConfigurationBean {
* @param useCaseDescription the useCaseDescription to set
*/
@ConfigurationProperty(name = "toolDescription", label = "Tool Description")
- public void setUseCaseDescription(UseCaseDescription useCaseDescription) {
+ public void setUseCaseDescription(ToolDescription useCaseDescription) {
this.useCaseDescription = useCaseDescription;
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/InvocationCreator.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/InvocationCreator.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/InvocationCreator.java
index b5394c4..9893728 100644
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/InvocationCreator.java
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/InvocationCreator.java
@@ -21,7 +21,7 @@ package org.apache.taverna.activities.externaltool;
import java.util.Map;
-import org.apache.taverna.activities.externaltool.desc.UseCaseDescription;
+import org.apache.taverna.activities.externaltool.desc.ToolDescription;
import org.apache.taverna.activities.externaltool.invocation.ToolInvocation;
import org.apache.taverna.activities.externaltool.manager.InvocationMechanism;
import org.apache.taverna.reference.ReferenceService;
@@ -35,6 +35,6 @@ public interface InvocationCreator {
public boolean canHandle(String mechanismType);
- public ToolInvocation convert(InvocationMechanism mechanism, UseCaseDescription description, Map<String, T2Reference> data, ReferenceService referenceService);
+ public ToolInvocation convert(InvocationMechanism mechanism, ToolDescription description, Map<String, T2Reference> data, ReferenceService referenceService);
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/ToolDescription.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/ToolDescription.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/ToolDescription.java
new file mode 100644
index 0000000..5e2dde0
--- /dev/null
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/ToolDescription.java
@@ -0,0 +1,897 @@
+/*
+ * 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.activities.externaltool.desc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.workflowmodel.processor.config.ConfigurationBean;
+import org.apache.taverna.workflowmodel.processor.config.ConfigurationProperty;
+import org.apache.taverna.workflowmodel.processor.config.ConfigurationProperty.OrderPolicy;
+import org.apache.taverna.workflowmodel.serialization.DeserializationException;
+import org.apache.taverna.workflowmodel.utils.Tools;
+
+import org.apache.log4j.Logger;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Class representation of XML-description of UseCases
+ */
+@ConfigurationBean(uri = ExternalToolActivity.URI + "#ToolDescription")
+public class ToolDescription {
+
+ private static Logger logger = Logger.getLogger(ToolDescription.class);
+
+ /**
+ * Identifier for the retrieval of this UseCase in the sharedRepository
+ * database, respectively its XML export.
+ */
+ private String usecaseid = "";
+ /**
+ * Workflow Elements now can get a group identifier. There may be subgroups
+ * divided by :
+ */
+ private String group = "";
+ /**
+ * Textual description of the use case itself. This description is very
+ * short to fit on the single line that is prepared for such descriptions in
+ * the Taverna workflow element list.
+ */
+ private String description = "";
+ /**
+ * What is actually executed on the shell.
+ */
+ private String command = "";
+
+ /**
+ * Accessor function of command
+ *
+ * @return shell-executable series of commands
+ */
+ public String getCommand() {
+ if (null == command) {
+ // FIXME: Is this possible?
+ return "";
+ } else {
+ return command;
+ }
+ }
+
+ /**
+ * Routine that may be executed as a first check if the program is indeed
+ * installed.
+ */
+ private String test_local = null;
+
+ /**
+ * URL of an icon that would help users to recognise the use case
+ */
+ private String icon_url = null;
+
+ private int preparingTimeoutInSeconds = 20 * 60; // 20 minutes
+ private int executionTimeoutInSeconds = 30 * 60; // 30 minutes
+
+ private List<String> tags = new ArrayList<String>();
+ private List<RuntimeEnvironmentConstraint> REs = new ArrayList<RuntimeEnvironmentConstraint>();
+ private ArrayList<String> queue_preferred = new ArrayList<String>();
+ private ArrayList<String> queue_deny = new ArrayList<String>();
+
+ private List<ScriptInputStatic> static_inputs = new ArrayList<ScriptInputStatic>();
+ private Map<String, ScriptInput> inputs = new HashMap<String, ScriptInput>();
+ private Map<String, ScriptOutput> outputs = new HashMap<String, ScriptOutput>();
+
+ private boolean includeStdIn = false;
+ private boolean includeStdOut = true;
+ private boolean includeStdErr = true;
+
+ private List<Integer> validReturnCodes = new ArrayList<Integer>();
+
+ /**
+ * Default constructor to make xstream happy
+ */
+ public ToolDescription() {
+
+ }
+
+ /**
+ * Constructor, for special purpose usecases.
+ *
+ * @param usecaseid
+ */
+ public ToolDescription(String usecaseid) {
+ this.setUsecaseid(usecaseid);
+ }
+
+ /**
+ * Constructor, expects an input stream containing the xml. for example, use
+ * getClass().getClassLoader().getResourceAsStream("..") to load a usecase
+ * from your program jar
+ */
+ public ToolDescription(InputStream programAsStream) throws DeserializationException {
+ SAXBuilder builder = new SAXBuilder();
+ Document doc;
+ try {
+ doc = builder.build(programAsStream);
+ programAsStream.close();
+ } catch (JDOMException e) {
+ throw new DeserializationException("Error deserializing usecase", e);
+ } catch (IOException e) {
+ throw new DeserializationException("Error deserializing usecase", e);
+ }
+ readFromXmlElement(doc.getRootElement());
+ }
+
+ /**
+ * Constructor, expects an XML-root to dissect.
+ */
+ public ToolDescription(Element programNode) throws DeserializationException {
+ readFromXmlElement(programNode);
+ }
+
+/**
+ * Produce an XML description of the ToolDescription
+ */
+ public Element writeToXMLElement() {
+ Element programNode = new Element("program");
+ programNode.setAttribute("name", getUsecaseid());
+ programNode.setAttribute("description", getDescription());
+ // Always use element version of command
+// programNode.setAttribute("command", getCommand());
+ Element commandNode = new Element("command");
+ commandNode.addContent(getCommand());
+ programNode.addContent(commandNode);
+ programNode.setAttribute("timeout", Integer.toString(getExecutionTimeoutInSeconds()));
+ programNode.setAttribute("preparing_timeout", Integer.toString(getPreparingTimeoutInSeconds()));
+ programNode.setAttribute("includeStdIn", Boolean.toString(isIncludeStdIn()));
+ programNode.setAttribute("includeStdOut", Boolean.toString(isIncludeStdOut()));
+ programNode.setAttribute("includeStdErr", Boolean.toString(isIncludeStdErr()));
+ for (ScriptInputStatic si : getStatic_inputs()) {
+ Element staticNode = new Element("static");
+ if (si.isBinary()) {
+ staticNode.setAttribute("binary", "true");
+ }
+ if (si.isForceCopy()) {
+ staticNode.setAttribute("forceCopy", "true");
+ }
+ if (si.isFile()) {
+ Element fileNode = new Element("file");
+ fileNode.setAttribute("path", si.getTag());
+ staticNode.addContent(fileNode);
+ } else if (si.isTempFile()) {
+ Element tempfileNode = new Element("tempfile");
+ tempfileNode.setAttribute("tag", si.getTag());
+ staticNode.addContent(tempfileNode);
+ } else {
+ Element replaceNode = new Element("replace");
+ replaceNode.setAttribute("tag", si.getTag());
+ staticNode.addContent(replaceNode);
+ }
+ if (si.getUrl() != null) {
+ Element contentNode = new Element("content");
+ contentNode.setAttribute("url", si.getUrl());
+ staticNode.addContent(contentNode);
+ } else {
+ Element contentNode = new Element("content");
+ contentNode.addContent((String) si.getContent());
+ staticNode.addContent(contentNode);
+ }
+ programNode.addContent(staticNode);
+ }
+ for (Entry<String, ScriptInput> entry : getInputs().entrySet()) {
+ String name = entry.getKey();
+ ScriptInputUser si = (ScriptInputUser) entry.getValue();
+ Element inputNode = new Element("input");
+ inputNode.setAttribute("name", name);
+ if (si.isBinary()) {
+ inputNode.setAttribute("binary", "true");
+ }
+ if (si.isForceCopy()) {
+ inputNode.setAttribute("forceCopy", "true");
+ }
+ if (si.isConcatenate()) {
+ inputNode.setAttribute("concatenate", "true");
+ }
+ if (si.isList()) {
+ inputNode.setAttribute("list", "true");
+ }
+ if (si.isFile()) {
+ Element fileNode = new Element("file");
+ fileNode.setAttribute("path", si.getTag());
+ inputNode.addContent(fileNode);
+ } else if (si.isTempFile()) {
+ Element tempfileNode = new Element("tempfile");
+ tempfileNode.setAttribute("tag", si.getTag());
+ inputNode.addContent(tempfileNode);
+ } else {
+ Element replaceNode = new Element("replace");
+ replaceNode.setAttribute("tag", si.getTag());
+ inputNode.addContent(replaceNode);
+ }
+ for (String mime : si.getMime()) {
+ Element mimeNode = new Element("mime");
+ mimeNode.setAttribute("type", mime);
+ inputNode.addContent(mimeNode);
+ }
+ programNode.addContent(inputNode);
+ }
+ for (Entry<String, ScriptOutput> entry : getOutputs().entrySet()) {
+ String name = entry.getKey();
+ ScriptOutput so = entry.getValue();
+ Element outputNode = new Element("output");
+ outputNode.setAttribute("name", name);
+ if (so.isBinary()) {
+ outputNode.setAttribute("binary", "true");
+ }
+ Element fromfileNode = new Element("fromfile");
+ fromfileNode.setAttribute("path", so.getPath());
+ outputNode.addContent(fromfileNode);
+ for (String mime : so.getMime()) {
+ Element mimeNode = new Element("mime");
+ mimeNode.setAttribute("type", mime);
+ outputNode.addContent(mimeNode);
+ }
+ programNode.addContent(outputNode);
+ }
+ for (RuntimeEnvironmentConstraint rec : getREs()) {
+ Element rteNode = new Element("rte");
+ rteNode.setAttribute("name", rec.getID());
+ rteNode.setAttribute("relation", rec.getRelation());
+ programNode.addContent(rteNode);
+ }
+ if ((group != null) && !group.isEmpty()) {
+ Element groupNode = new Element("group");
+ groupNode.setAttribute("name", group);
+ programNode.addContent(groupNode);
+ }
+ if ((test_local != null) && !test_local.isEmpty()) {
+ Element testNode = new Element("test");
+ testNode.setAttribute("local", test_local);
+ programNode.addContent(testNode);
+ }
+ if ((icon_url != null) && !icon_url.isEmpty()) {
+ Element iconNode = new Element("icon");
+ iconNode.setAttribute("url", icon_url);
+ programNode.addContent(iconNode);
+ }
+ if (!getQueue_preferred().isEmpty() || !getQueue_deny().isEmpty()) {
+ Element queueNode = new Element("queue");
+ for (String url : getQueue_preferred()) {
+ Element preferredNode = new Element("prefer");
+ preferredNode.setAttribute("url", url);
+ queueNode.addContent(preferredNode);
+ }
+ for (String url : getQueue_deny()) {
+ Element denyNode = new Element("deny");
+ denyNode.setAttribute("url", url);
+ queueNode.addContent(denyNode);
+ }
+ programNode.addContent(queueNode);
+ }
+ Element validReturnCodesNode = new Element("validReturnCodes");
+ validReturnCodesNode.setAttribute("codes", getReturnCodesAsText());
+ programNode.addContent(validReturnCodesNode);
+
+ return programNode;
+ }
+ /**
+ * Specifies the ToolDescription from the root of an XML description
+ * which is accessible online.
+ *
+ * @param programNode
+ * @throws DeserializationException
+ */
+ private void readFromXmlElement(Element programNode) throws DeserializationException {
+ if (programNode.getName().compareToIgnoreCase("program") != 0)
+ throw new DeserializationException("Expected <program>, read '" + programNode.getName() + "'");
+
+ setUsecaseid(programNode.getAttributeValue("name"));
+ setDescription(programNode.getAttributeValue("description"));
+ setCommand(programNode.getAttributeValue("command"));
+ String timeoutStr = programNode.getAttributeValue("timeout");
+ if (timeoutStr != null)
+ setExecutionTimeoutInSeconds(Integer.parseInt(timeoutStr));
+ timeoutStr = programNode.getAttributeValue("preparing_timeout");
+ if (timeoutStr != null)
+ setPreparingTimeoutInSeconds(Integer.parseInt(timeoutStr));
+
+ String includeStdInStr = programNode.getAttributeValue("includeStdIn");
+ if (includeStdInStr != null && !includeStdInStr.isEmpty()) {
+ setIncludeStdIn(includeStdInStr.equals("true"));
+ }
+
+ String includeStdOutStr = programNode.getAttributeValue("includeStdOut");
+ if (includeStdOutStr != null && !includeStdOutStr.isEmpty()) {
+ setIncludeStdOut(includeStdOutStr.equals("true"));
+ }
+
+ String includeStdErrStr = programNode.getAttributeValue("includeStdErr");
+ if (includeStdErrStr != null && !includeStdErrStr.isEmpty()) {
+ setIncludeStdErr(includeStdErrStr.equals("true"));
+ }
+
+ for (Object cur_ob : programNode.getChildren()) {
+ Element cur = (Element) cur_ob;
+
+ String name = cur.getAttributeValue("name");
+
+ String type = cur.getName();
+ boolean binary = false;
+ if (null != cur.getAttributeValue("binary") && cur.getAttributeValue("binary").equalsIgnoreCase("true")) {
+ binary = true;
+ }
+ boolean list = false;
+ if (null != cur.getAttributeValue("list") && cur.getAttributeValue("list").equalsIgnoreCase("true")) {
+ list = true;
+ }
+ boolean concatenate = false;
+ if (null != cur.getAttributeValue("concatenate") && cur.getAttributeValue("concatenate").equalsIgnoreCase("true")) {
+ concatenate = true;
+ }
+ boolean forceCopy = false;
+ if (null != cur.getAttributeValue("forceCopy") && cur.getAttributeValue("forceCopy").equalsIgnoreCase("true")) {
+ forceCopy = true;
+ }
+
+ Element inner = null;
+ String innerType = null, tag = null, path = null;
+ if (cur.getChildren().size() > 0) {
+ inner = (Element) cur.getChildren().get(0);
+ innerType = inner.getName();
+ tag = inner.getAttributeValue("tag");
+ path = inner.getAttributeValue("path");
+ }
+ // build mime type declaration list
+ ArrayList<String> mime = new ArrayList<String>();
+ for (Object child : cur.getChildren()) {
+ Element curChild = (Element) child;
+ if (curChild.getName().equalsIgnoreCase("mime")) {
+ mime.add(curChild.getAttributeValue("type"));
+ }
+ }
+ if (type.equalsIgnoreCase("static")) {
+ ScriptInputStatic si = new ScriptInputStatic();
+ Element content = cur.getChild("content");
+ if (content == null)
+ throw new DeserializationException("FIXME: script tag without embedded content tag");
+ si.setUrl(content.getAttributeValue("url"));
+ if (si.getUrl() == null)
+ si.setContent(content.getText());
+ fillInputDescription(si, binary, forceCopy, innerType, tag, path);
+ getStatic_inputs().add(si);
+ } else if (type.equalsIgnoreCase("input")) {
+ ScriptInputUser indesc = new ScriptInputUser();
+ indesc.setList(list);
+ indesc.setMime(mime);
+ indesc.setConcatenate(concatenate);
+ fillInputDescription(indesc, binary, forceCopy, innerType, tag, path);
+ getInputs().put(Tools.sanitiseName(name), indesc);
+ } else if (type.equalsIgnoreCase("output")) {
+ ScriptOutput outdesc = new ScriptOutput();
+ outdesc.setMime(mime);
+
+ boolean ok = true;
+ if (null == innerType) {
+ // don't know what to do
+ throw new DeserializationException("FIXME: Found null == innerType for output, is this the bug?");
+ } else if (innerType.equalsIgnoreCase("fromfile")) {
+ outdesc.setPath(path);
+ outdesc.setBinary(binary);
+ } else {
+ throw new DeserializationException("Problem reading output port: unknown innerType '" + innerType + "'");
+ }
+ if (ok) {
+ getOutputs().put(Tools.sanitiseName(name), outdesc);
+ }
+ } else if (type.equalsIgnoreCase("rte") || type.equalsIgnoreCase("re")) {
+ getREs().add(new RuntimeEnvironmentConstraint(name, cur.getAttributeValue("relation")));
+ } else if (type.equalsIgnoreCase("group")) {
+ group = name;
+ } else if (type.equalsIgnoreCase("test")) {
+ test_local = cur.getAttributeValue("local");
+ } else if (type.equalsIgnoreCase("icon")) {
+ icon_url = cur.getAttributeValue("url");
+ } else if (type.equalsIgnoreCase("queue")) {
+ for (Object child_ob : cur.getChildren()) {
+ Element child = (Element) child_ob;
+ if (child.getName().equalsIgnoreCase("prefer"))
+ getQueue_preferred().add(child.getAttributeValue("url"));
+ else if (child.getName().equalsIgnoreCase("deny"))
+ getQueue_deny().add(child.getAttributeValue("url"));
+ else
+ throw new DeserializationException("Error while reading usecase " + this.getUsecaseid() + ": invalid queue entry");
+ }
+ } else if (type.equalsIgnoreCase("command")) {
+ // i like to have the ability to inject complete shell script
+ // fragments into the use case,
+ // so this should be replace and should allow multiple lines
+ if ((getCommand() != null) && !getCommand().isEmpty()) {
+ throw new DeserializationException("You have specified both command attribute and command tag.");
+ }
+ setCommand(cur.getText());
+ } else if (type.equalsIgnoreCase("validReturnCodes")) {
+ String codeString = cur.getAttributeValue("codes");
+ if (codeString != null) {
+ setReturnCodesAsText(codeString);
+ }
+ }
+ else {
+ throw new DeserializationException("Unexpected and uninterpreted attribute " + type);
+ }
+ }
+ }
+
+ private void fillInputDescription(ScriptInput fillMe, boolean binary, boolean forceCopy, String innerType, String tag, String path) throws DeserializationException {
+ fillMe.setBinary(binary);
+ fillMe.setForceCopy(forceCopy);
+ if (null == innerType) {
+ // don't know what to do
+ throw new DeserializationException("FIXME: Found null == innerType for input, is this the bug?");
+ } else if (innerType.equalsIgnoreCase("replace")) {
+ fillMe.setTag(tag);
+ fillMe.setTempFile(false);
+ fillMe.setFile(false);
+ getTags().add(tag);
+ } else if (innerType.equalsIgnoreCase("tempfile")) {
+ fillMe.setTag(tag);
+ fillMe.setTempFile(true);
+ fillMe.setFile(false);
+ getTags().add(tag);
+ } else if (innerType.equalsIgnoreCase("file")) {
+ fillMe.setTag(path);
+ fillMe.setTempFile(false);
+ fillMe.setFile(true);
+ } else {
+ throw new DeserializationException("Problem reading input port: unknown innerType '" + innerType + "'");
+ }
+ }
+
+ /**
+ * returns icon that is referenced in use case description
+ */
+ public ImageIcon getImageIcon() {
+ if (null == icon_url) return null;
+ try {
+ URL u = new URL(icon_url);
+ return new ImageIcon(u, getUsecaseid());
+ } catch (Exception e) {
+ logger.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * String representation of the use case. It also contains interesting
+ * information on the availability of resources in the grid to actually
+ * execute that workflow element.
+ *
+ * @return String
+ */
+ @Override
+ public String toString() {
+ List<String> hlp = new ArrayList<String>();
+ hlp.add("usecaseid: " + getUsecaseid());
+ hlp.add("description: " + getDescription());
+ hlp.add("group: " + group);
+ hlp.add("test: " + test_local);
+ hlp.add("tags: " + getTags());
+ for (Map.Entry<String, ScriptInput> cur : getInputs().entrySet()) {
+ hlp.add(">" + cur.getKey() + ">: " + cur.getValue().toString());
+ }
+ for (Map.Entry<String, ScriptOutput> cur : getOutputs().entrySet()) {
+ hlp.add("<" + cur.getKey() + "<: " + cur.getValue().toString());
+ }
+ hlp.add("RE: " + getREs().toString());
+ hlp.add("preferred queues: " + getQueue_preferred());
+ hlp.add("denied queues: " + getQueue_deny());
+ String tos = super.toString() + "[";
+ for (int i = 0; i < hlp.size(); i++) {
+ if (i != 0)
+ tos += ", ";
+ tos += hlp.get(i);
+ }
+ return tos + " ]";
+ }
+
+ /**
+ * hajo's test just pass an url or file url to an xml file
+ *
+ * @throws IOException
+ * @throws MalformedURLException
+ * @throws DeserializationException
+ */
+ public static void main(String[] argv) throws MalformedURLException, IOException, DeserializationException {
+ ToolDescription d = new ToolDescription(new URL(argv[0]).openStream());
+ logger.info(d.getCommand());
+ }
+
+ /**
+ * @param command the command to set
+ */
+ @ConfigurationProperty(name = "command", label = "Command", description="What is actually executed on the shell")
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ @ConfigurationProperty(name = "description", label = "Description", description="Textual description of the tool", required=false, uri="http://purl.org/dc/elements/1.1/description")
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param executionTimeoutInSeconds the executionTimeoutInSeconds to set
+ */
+ @ConfigurationProperty(name = "executionTimeoutInSeconds", label = "Execution Timeout In Seconds")
+ public void setExecutionTimeoutInSeconds(int executionTimeoutInSeconds) {
+ this.executionTimeoutInSeconds = executionTimeoutInSeconds;
+ }
+
+ /**
+ * @return the executionTimeoutInSeconds
+ */
+ public int getExecutionTimeoutInSeconds() {
+ return executionTimeoutInSeconds;
+ }
+
+ /**
+ * @param inputs the inputs to set
+ */
+ public void setInputs(Map<String, ScriptInput> inputs) {
+ this.inputs = inputs;
+ }
+
+ @ConfigurationProperty(name = "inputs", label = "Inputs", required=false)
+ public void setInputs(Set<InputMap> inputs) {
+ if (inputs != null) {
+ this.inputs = new HashMap<String, ScriptInput>();
+ for (InputMap inputMap : inputs) {
+ this.inputs.put(inputMap.getPort(), inputMap.getInput());
+ }
+ } else {
+ this.inputs = null;
+ }
+ }
+
+ /**
+ * @return the inputs
+ */
+ public Map<String, ScriptInput> getInputs() {
+ if (inputs == null) {
+ inputs = new HashMap<String, ScriptInput>();
+ }
+ return inputs;
+ }
+
+ /**
+ * @param outputs the outputs to set
+ */
+ public void setOutputs(Map<String, ScriptOutput> outputs) {
+ this.outputs = outputs;
+ }
+
+ @ConfigurationProperty(name = "outputs", label = "Outputs", required=false)
+ public void setOutputs(Set<OutputMap> outputs) {
+ if (outputs != null) {
+ this.outputs = new HashMap<String, ScriptOutput>();
+ for (OutputMap outputMap : outputs) {
+ this.outputs.put(outputMap.getPort(), outputMap.getOutput());
+ }
+ } else {
+ this.outputs = null;
+ }
+ }
+
+ /**
+ * @return the outputs
+ */
+ public Map<String, ScriptOutput> getOutputs() {
+ if (outputs == null) {
+ outputs = new HashMap<String, ScriptOutput>();
+ }
+ return outputs;
+ }
+
+ /**
+ * @param preparingTimeoutInSeconds the preparingTimeoutInSeconds to set
+ */
+ @ConfigurationProperty(name = "preparingTimeoutInSeconds", label = "Preparing Timeout In Seconds")
+ public void setPreparingTimeoutInSeconds(int preparingTimeoutInSeconds) {
+ this.preparingTimeoutInSeconds = preparingTimeoutInSeconds;
+ }
+
+ /**
+ * @return the preparingTimeoutInSeconds
+ */
+ public int getPreparingTimeoutInSeconds() {
+ return preparingTimeoutInSeconds;
+ }
+
+ /**
+ * @param queue_deny the queue_deny to set
+ */
+ public void setQueue_deny(ArrayList<String> queue_deny) {
+ this.queue_deny = queue_deny;
+ }
+
+ /**
+ * @return the queue_deny
+ */
+ public ArrayList<String> getQueue_deny() {
+ if (queue_deny == null) {
+ queue_deny = new ArrayList<String>();
+ }
+ return queue_deny;
+ }
+
+ /**
+ * @param queue_preferred the queue_preferred to set
+ */
+ public void setQueue_preferred(ArrayList<String> queue_preferred) {
+ this.queue_preferred = queue_preferred;
+ }
+
+ /**
+ * @return the queue_preferred
+ */
+ public ArrayList<String> getQueue_preferred() {
+ if (queue_preferred == null) {
+ queue_preferred = new ArrayList<String>();
+ }
+ return queue_preferred;
+ }
+
+ /**
+ * @param rEs the rEs to set
+ */
+ public void setREs(List<RuntimeEnvironmentConstraint> rEs) {
+ REs = rEs;
+ }
+
+ /**
+ * @return the rEs
+ */
+ public List<RuntimeEnvironmentConstraint> getREs() {
+ if (REs == null) {
+ REs = new ArrayList<RuntimeEnvironmentConstraint>();
+ }
+ return REs;
+ }
+
+ /**
+ * @param static_inputs the static_inputs to set
+ */
+ @ConfigurationProperty(name = "staticInputs", label = "Static Inputs", ordering=OrderPolicy.NON_ORDERED, required=false)
+ public void setStatic_inputs(List<ScriptInputStatic> static_inputs) {
+ this.static_inputs = static_inputs;
+ }
+
+ /**
+ * @return the static_inputs
+ */
+ public List<ScriptInputStatic> getStatic_inputs() {
+ if (static_inputs == null) {
+ static_inputs = new ArrayList<ScriptInputStatic>();
+ }
+ return static_inputs;
+ }
+
+ /**
+ * @param tags the tags to set
+ */
+ public void setTags(List<String> tags) {
+ this.tags = tags;
+ }
+
+ /**
+ * @return the tags
+ */
+ public List<String> getTags() {
+ if (tags == null) {
+ tags = new ArrayList<String>();
+ }
+ return tags;
+ }
+
+ /**
+ * @param usecaseid the usecaseid to set
+ */
+ @ConfigurationProperty(name = "usecaseid", label = "Title", uri="http://purl.org/dc/elements/1.1/title", required=false)
+ public void setUsecaseid(String usecaseid) {
+ this.usecaseid = usecaseid;
+ }
+
+ /**
+ * @return the usecaseid
+ */
+ public String getUsecaseid() {
+ return usecaseid;
+ }
+
+ public boolean isIncludeStdIn() {
+ return includeStdIn;
+ }
+
+ @ConfigurationProperty(name = "includeStdIn", label = "Include STDIN")
+ public void setIncludeStdIn(boolean includeStdIn) {
+ this.includeStdIn = includeStdIn;
+ }
+
+ public boolean isIncludeStdOut() {
+ return includeStdOut;
+ }
+
+ @ConfigurationProperty(name = "includeStdOut", label = "Include STDOUT")
+ public void setIncludeStdOut(boolean includeStdOut) {
+ this.includeStdOut = includeStdOut;
+ }
+
+ public boolean isIncludeStdErr() {
+ return includeStdErr;
+ }
+
+ @ConfigurationProperty(name = "includeStdErr", label = "Include STDERR")
+ public void setIncludeStdErr(boolean includeStdErr) {
+ this.includeStdErr = includeStdErr;
+ }
+
+ /**
+ * @return the validReturnCodes
+ */
+ public List<Integer> getValidReturnCodes() {
+ if (validReturnCodes == null) {
+ validReturnCodes = new ArrayList<Integer>();
+ }
+ if (validReturnCodes.isEmpty()) {
+ validReturnCodes.add(0);
+ }
+ return validReturnCodes;
+ }
+
+ /**
+ * @param validReturnCodes the validReturnCodes to set
+ */
+ public void setValidReturnCodes(List<Integer> validReturnCodes) {
+ this.validReturnCodes = validReturnCodes;
+ }
+
+ public String getReturnCodesAsText() {
+ return StringUtils.join(getValidReturnCodes(), ",");
+ }
+
+ public void setReturnCodesAsText(String text) {
+ if (getValidReturnCodes() == null) {
+ validReturnCodes = new ArrayList<Integer>();
+ }
+ validReturnCodes.clear();
+ String[] codes = text.split(",");
+ for (String code : codes) {
+ try {
+ Integer codeInt = new Integer(code);
+ if (!validReturnCodes.contains(codeInt)) {
+ validReturnCodes.add(codeInt);
+ }
+ }
+ catch (NumberFormatException e) {
+ logger.error(e);
+ }
+ }
+ if (validReturnCodes.isEmpty()) {
+ validReturnCodes.add(0);
+ }
+ Collections.sort(validReturnCodes);
+ }
+
+ /**
+ * @return the group
+ */
+ public String getGroup() {
+ return group;
+ }
+
+ /**
+ * @param group the group to set
+ */
+ public void setGroup(String group) {
+ this.group = group;
+ }
+
+ /**
+ * @return the icon_url
+ */
+ public String getIcon_url() {
+ return icon_url;
+ }
+
+ @ConfigurationBean(uri = ExternalToolActivity.URI + "#OutputMap")
+ public static class OutputMap {
+ private String port;
+
+ private ScriptOutput output;
+
+ public String getPort() {
+ return port;
+ }
+
+ @ConfigurationProperty(name = "port", label = "Port")
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public ScriptOutput getOutput() {
+ return output;
+ }
+
+ @ConfigurationProperty(name = "output", label = "Output")
+ public void setOutput(ScriptOutput output) {
+ this.output = output;
+ }
+ }
+
+ @ConfigurationBean(uri = ExternalToolActivity.URI + "#InputMap")
+ public static class InputMap {
+ private String port;
+
+ private ScriptInputUser input;
+
+ public String getPort() {
+ return port;
+ }
+
+ @ConfigurationProperty(name = "port", label = "Port")
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public ScriptInputUser getInput() {
+ return input;
+ }
+
+ @ConfigurationProperty(name = "input", label = "Input")
+ public void setInput(ScriptInputUser input) {
+ this.input = input;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/UseCaseDescription.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/UseCaseDescription.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/UseCaseDescription.java
deleted file mode 100644
index 934330f..0000000
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/UseCaseDescription.java
+++ /dev/null
@@ -1,897 +0,0 @@
-/*
- * 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.activities.externaltool.desc;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.swing.ImageIcon;
-
-import org.apache.taverna.activities.externaltool.ExternalToolActivity;
-import org.apache.taverna.workflowmodel.processor.config.ConfigurationBean;
-import org.apache.taverna.workflowmodel.processor.config.ConfigurationProperty;
-import org.apache.taverna.workflowmodel.processor.config.ConfigurationProperty.OrderPolicy;
-import org.apache.taverna.workflowmodel.serialization.DeserializationException;
-import org.apache.taverna.workflowmodel.utils.Tools;
-
-import org.apache.log4j.Logger;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-
-import org.apache.commons.lang.StringUtils;
-
-/**
- * Class representation of XML-description of UseCases
- */
-@ConfigurationBean(uri = ExternalToolActivity.URI + "#ToolDescription")
-public class UseCaseDescription {
-
- private static Logger logger = Logger.getLogger(UseCaseDescription.class);
-
- /**
- * Identifier for the retrieval of this UseCase in the sharedRepository
- * database, respectively its XML export.
- */
- private String usecaseid = "";
- /**
- * Workflow Elements now can get a group identifier. There may be subgroups
- * divided by :
- */
- private String group = "";
- /**
- * Textual description of the use case itself. This description is very
- * short to fit on the single line that is prepared for such descriptions in
- * the Taverna workflow element list.
- */
- private String description = "";
- /**
- * What is actually executed on the shell.
- */
- private String command = "";
-
- /**
- * Accessor function of command
- *
- * @return shell-executable series of commands
- */
- public String getCommand() {
- if (null == command) {
- // FIXME: Is this possible?
- return "";
- } else {
- return command;
- }
- }
-
- /**
- * Routine that may be executed as a first check if the program is indeed
- * installed.
- */
- private String test_local = null;
-
- /**
- * URL of an icon that would help users to recognise the use case
- */
- private String icon_url = null;
-
- private int preparingTimeoutInSeconds = 20 * 60; // 20 minutes
- private int executionTimeoutInSeconds = 30 * 60; // 30 minutes
-
- private List<String> tags = new ArrayList<String>();
- private List<RuntimeEnvironmentConstraint> REs = new ArrayList<RuntimeEnvironmentConstraint>();
- private ArrayList<String> queue_preferred = new ArrayList<String>();
- private ArrayList<String> queue_deny = new ArrayList<String>();
-
- private List<ScriptInputStatic> static_inputs = new ArrayList<ScriptInputStatic>();
- private Map<String, ScriptInput> inputs = new HashMap<String, ScriptInput>();
- private Map<String, ScriptOutput> outputs = new HashMap<String, ScriptOutput>();
-
- private boolean includeStdIn = false;
- private boolean includeStdOut = true;
- private boolean includeStdErr = true;
-
- private List<Integer> validReturnCodes = new ArrayList<Integer>();
-
- /**
- * Default constructor to make xstream happy
- */
- public UseCaseDescription() {
-
- }
-
- /**
- * Constructor, for special purpose usecases.
- *
- * @param usecaseid
- */
- public UseCaseDescription(String usecaseid) {
- this.setUsecaseid(usecaseid);
- }
-
- /**
- * Constructor, expects an input stream containing the xml. for example, use
- * getClass().getClassLoader().getResourceAsStream("..") to load a usecase
- * from your program jar
- */
- public UseCaseDescription(InputStream programAsStream) throws DeserializationException {
- SAXBuilder builder = new SAXBuilder();
- Document doc;
- try {
- doc = builder.build(programAsStream);
- programAsStream.close();
- } catch (JDOMException e) {
- throw new DeserializationException("Error deserializing usecase", e);
- } catch (IOException e) {
- throw new DeserializationException("Error deserializing usecase", e);
- }
- readFromXmlElement(doc.getRootElement());
- }
-
- /**
- * Constructor, expects an XML-root to dissect.
- */
- public UseCaseDescription(Element programNode) throws DeserializationException {
- readFromXmlElement(programNode);
- }
-
-/**
- * Produce an XML description of the UseCaseDescription
- */
- public Element writeToXMLElement() {
- Element programNode = new Element("program");
- programNode.setAttribute("name", getUsecaseid());
- programNode.setAttribute("description", getDescription());
- // Always use element version of command
-// programNode.setAttribute("command", getCommand());
- Element commandNode = new Element("command");
- commandNode.addContent(getCommand());
- programNode.addContent(commandNode);
- programNode.setAttribute("timeout", Integer.toString(getExecutionTimeoutInSeconds()));
- programNode.setAttribute("preparing_timeout", Integer.toString(getPreparingTimeoutInSeconds()));
- programNode.setAttribute("includeStdIn", Boolean.toString(isIncludeStdIn()));
- programNode.setAttribute("includeStdOut", Boolean.toString(isIncludeStdOut()));
- programNode.setAttribute("includeStdErr", Boolean.toString(isIncludeStdErr()));
- for (ScriptInputStatic si : getStatic_inputs()) {
- Element staticNode = new Element("static");
- if (si.isBinary()) {
- staticNode.setAttribute("binary", "true");
- }
- if (si.isForceCopy()) {
- staticNode.setAttribute("forceCopy", "true");
- }
- if (si.isFile()) {
- Element fileNode = new Element("file");
- fileNode.setAttribute("path", si.getTag());
- staticNode.addContent(fileNode);
- } else if (si.isTempFile()) {
- Element tempfileNode = new Element("tempfile");
- tempfileNode.setAttribute("tag", si.getTag());
- staticNode.addContent(tempfileNode);
- } else {
- Element replaceNode = new Element("replace");
- replaceNode.setAttribute("tag", si.getTag());
- staticNode.addContent(replaceNode);
- }
- if (si.getUrl() != null) {
- Element contentNode = new Element("content");
- contentNode.setAttribute("url", si.getUrl());
- staticNode.addContent(contentNode);
- } else {
- Element contentNode = new Element("content");
- contentNode.addContent((String) si.getContent());
- staticNode.addContent(contentNode);
- }
- programNode.addContent(staticNode);
- }
- for (Entry<String, ScriptInput> entry : getInputs().entrySet()) {
- String name = entry.getKey();
- ScriptInputUser si = (ScriptInputUser) entry.getValue();
- Element inputNode = new Element("input");
- inputNode.setAttribute("name", name);
- if (si.isBinary()) {
- inputNode.setAttribute("binary", "true");
- }
- if (si.isForceCopy()) {
- inputNode.setAttribute("forceCopy", "true");
- }
- if (si.isConcatenate()) {
- inputNode.setAttribute("concatenate", "true");
- }
- if (si.isList()) {
- inputNode.setAttribute("list", "true");
- }
- if (si.isFile()) {
- Element fileNode = new Element("file");
- fileNode.setAttribute("path", si.getTag());
- inputNode.addContent(fileNode);
- } else if (si.isTempFile()) {
- Element tempfileNode = new Element("tempfile");
- tempfileNode.setAttribute("tag", si.getTag());
- inputNode.addContent(tempfileNode);
- } else {
- Element replaceNode = new Element("replace");
- replaceNode.setAttribute("tag", si.getTag());
- inputNode.addContent(replaceNode);
- }
- for (String mime : si.getMime()) {
- Element mimeNode = new Element("mime");
- mimeNode.setAttribute("type", mime);
- inputNode.addContent(mimeNode);
- }
- programNode.addContent(inputNode);
- }
- for (Entry<String, ScriptOutput> entry : getOutputs().entrySet()) {
- String name = entry.getKey();
- ScriptOutput so = entry.getValue();
- Element outputNode = new Element("output");
- outputNode.setAttribute("name", name);
- if (so.isBinary()) {
- outputNode.setAttribute("binary", "true");
- }
- Element fromfileNode = new Element("fromfile");
- fromfileNode.setAttribute("path", so.getPath());
- outputNode.addContent(fromfileNode);
- for (String mime : so.getMime()) {
- Element mimeNode = new Element("mime");
- mimeNode.setAttribute("type", mime);
- outputNode.addContent(mimeNode);
- }
- programNode.addContent(outputNode);
- }
- for (RuntimeEnvironmentConstraint rec : getREs()) {
- Element rteNode = new Element("rte");
- rteNode.setAttribute("name", rec.getID());
- rteNode.setAttribute("relation", rec.getRelation());
- programNode.addContent(rteNode);
- }
- if ((group != null) && !group.isEmpty()) {
- Element groupNode = new Element("group");
- groupNode.setAttribute("name", group);
- programNode.addContent(groupNode);
- }
- if ((test_local != null) && !test_local.isEmpty()) {
- Element testNode = new Element("test");
- testNode.setAttribute("local", test_local);
- programNode.addContent(testNode);
- }
- if ((icon_url != null) && !icon_url.isEmpty()) {
- Element iconNode = new Element("icon");
- iconNode.setAttribute("url", icon_url);
- programNode.addContent(iconNode);
- }
- if (!getQueue_preferred().isEmpty() || !getQueue_deny().isEmpty()) {
- Element queueNode = new Element("queue");
- for (String url : getQueue_preferred()) {
- Element preferredNode = new Element("prefer");
- preferredNode.setAttribute("url", url);
- queueNode.addContent(preferredNode);
- }
- for (String url : getQueue_deny()) {
- Element denyNode = new Element("deny");
- denyNode.setAttribute("url", url);
- queueNode.addContent(denyNode);
- }
- programNode.addContent(queueNode);
- }
- Element validReturnCodesNode = new Element("validReturnCodes");
- validReturnCodesNode.setAttribute("codes", getReturnCodesAsText());
- programNode.addContent(validReturnCodesNode);
-
- return programNode;
- }
- /**
- * Specifies the UseCaseDescription from the root of an XML description
- * which is accessible online.
- *
- * @param programNode
- * @throws DeserializationException
- */
- private void readFromXmlElement(Element programNode) throws DeserializationException {
- if (programNode.getName().compareToIgnoreCase("program") != 0)
- throw new DeserializationException("Expected <program>, read '" + programNode.getName() + "'");
-
- setUsecaseid(programNode.getAttributeValue("name"));
- setDescription(programNode.getAttributeValue("description"));
- setCommand(programNode.getAttributeValue("command"));
- String timeoutStr = programNode.getAttributeValue("timeout");
- if (timeoutStr != null)
- setExecutionTimeoutInSeconds(Integer.parseInt(timeoutStr));
- timeoutStr = programNode.getAttributeValue("preparing_timeout");
- if (timeoutStr != null)
- setPreparingTimeoutInSeconds(Integer.parseInt(timeoutStr));
-
- String includeStdInStr = programNode.getAttributeValue("includeStdIn");
- if (includeStdInStr != null && !includeStdInStr.isEmpty()) {
- setIncludeStdIn(includeStdInStr.equals("true"));
- }
-
- String includeStdOutStr = programNode.getAttributeValue("includeStdOut");
- if (includeStdOutStr != null && !includeStdOutStr.isEmpty()) {
- setIncludeStdOut(includeStdOutStr.equals("true"));
- }
-
- String includeStdErrStr = programNode.getAttributeValue("includeStdErr");
- if (includeStdErrStr != null && !includeStdErrStr.isEmpty()) {
- setIncludeStdErr(includeStdErrStr.equals("true"));
- }
-
- for (Object cur_ob : programNode.getChildren()) {
- Element cur = (Element) cur_ob;
-
- String name = cur.getAttributeValue("name");
-
- String type = cur.getName();
- boolean binary = false;
- if (null != cur.getAttributeValue("binary") && cur.getAttributeValue("binary").equalsIgnoreCase("true")) {
- binary = true;
- }
- boolean list = false;
- if (null != cur.getAttributeValue("list") && cur.getAttributeValue("list").equalsIgnoreCase("true")) {
- list = true;
- }
- boolean concatenate = false;
- if (null != cur.getAttributeValue("concatenate") && cur.getAttributeValue("concatenate").equalsIgnoreCase("true")) {
- concatenate = true;
- }
- boolean forceCopy = false;
- if (null != cur.getAttributeValue("forceCopy") && cur.getAttributeValue("forceCopy").equalsIgnoreCase("true")) {
- forceCopy = true;
- }
-
- Element inner = null;
- String innerType = null, tag = null, path = null;
- if (cur.getChildren().size() > 0) {
- inner = (Element) cur.getChildren().get(0);
- innerType = inner.getName();
- tag = inner.getAttributeValue("tag");
- path = inner.getAttributeValue("path");
- }
- // build mime type declaration list
- ArrayList<String> mime = new ArrayList<String>();
- for (Object child : cur.getChildren()) {
- Element curChild = (Element) child;
- if (curChild.getName().equalsIgnoreCase("mime")) {
- mime.add(curChild.getAttributeValue("type"));
- }
- }
- if (type.equalsIgnoreCase("static")) {
- ScriptInputStatic si = new ScriptInputStatic();
- Element content = cur.getChild("content");
- if (content == null)
- throw new DeserializationException("FIXME: script tag without embedded content tag");
- si.setUrl(content.getAttributeValue("url"));
- if (si.getUrl() == null)
- si.setContent(content.getText());
- fillInputDescription(si, binary, forceCopy, innerType, tag, path);
- getStatic_inputs().add(si);
- } else if (type.equalsIgnoreCase("input")) {
- ScriptInputUser indesc = new ScriptInputUser();
- indesc.setList(list);
- indesc.setMime(mime);
- indesc.setConcatenate(concatenate);
- fillInputDescription(indesc, binary, forceCopy, innerType, tag, path);
- getInputs().put(Tools.sanitiseName(name), indesc);
- } else if (type.equalsIgnoreCase("output")) {
- ScriptOutput outdesc = new ScriptOutput();
- outdesc.setMime(mime);
-
- boolean ok = true;
- if (null == innerType) {
- // don't know what to do
- throw new DeserializationException("FIXME: Found null == innerType for output, is this the bug?");
- } else if (innerType.equalsIgnoreCase("fromfile")) {
- outdesc.setPath(path);
- outdesc.setBinary(binary);
- } else {
- throw new DeserializationException("Problem reading output port: unknown innerType '" + innerType + "'");
- }
- if (ok) {
- getOutputs().put(Tools.sanitiseName(name), outdesc);
- }
- } else if (type.equalsIgnoreCase("rte") || type.equalsIgnoreCase("re")) {
- getREs().add(new RuntimeEnvironmentConstraint(name, cur.getAttributeValue("relation")));
- } else if (type.equalsIgnoreCase("group")) {
- group = name;
- } else if (type.equalsIgnoreCase("test")) {
- test_local = cur.getAttributeValue("local");
- } else if (type.equalsIgnoreCase("icon")) {
- icon_url = cur.getAttributeValue("url");
- } else if (type.equalsIgnoreCase("queue")) {
- for (Object child_ob : cur.getChildren()) {
- Element child = (Element) child_ob;
- if (child.getName().equalsIgnoreCase("prefer"))
- getQueue_preferred().add(child.getAttributeValue("url"));
- else if (child.getName().equalsIgnoreCase("deny"))
- getQueue_deny().add(child.getAttributeValue("url"));
- else
- throw new DeserializationException("Error while reading usecase " + this.getUsecaseid() + ": invalid queue entry");
- }
- } else if (type.equalsIgnoreCase("command")) {
- // i like to have the ability to inject complete shell script
- // fragments into the use case,
- // so this should be replace and should allow multiple lines
- if ((getCommand() != null) && !getCommand().isEmpty()) {
- throw new DeserializationException("You have specified both command attribute and command tag.");
- }
- setCommand(cur.getText());
- } else if (type.equalsIgnoreCase("validReturnCodes")) {
- String codeString = cur.getAttributeValue("codes");
- if (codeString != null) {
- setReturnCodesAsText(codeString);
- }
- }
- else {
- throw new DeserializationException("Unexpected and uninterpreted attribute " + type);
- }
- }
- }
-
- private void fillInputDescription(ScriptInput fillMe, boolean binary, boolean forceCopy, String innerType, String tag, String path) throws DeserializationException {
- fillMe.setBinary(binary);
- fillMe.setForceCopy(forceCopy);
- if (null == innerType) {
- // don't know what to do
- throw new DeserializationException("FIXME: Found null == innerType for input, is this the bug?");
- } else if (innerType.equalsIgnoreCase("replace")) {
- fillMe.setTag(tag);
- fillMe.setTempFile(false);
- fillMe.setFile(false);
- getTags().add(tag);
- } else if (innerType.equalsIgnoreCase("tempfile")) {
- fillMe.setTag(tag);
- fillMe.setTempFile(true);
- fillMe.setFile(false);
- getTags().add(tag);
- } else if (innerType.equalsIgnoreCase("file")) {
- fillMe.setTag(path);
- fillMe.setTempFile(false);
- fillMe.setFile(true);
- } else {
- throw new DeserializationException("Problem reading input port: unknown innerType '" + innerType + "'");
- }
- }
-
- /**
- * returns icon that is referenced in use case description
- */
- public ImageIcon getImageIcon() {
- if (null == icon_url) return null;
- try {
- URL u = new URL(icon_url);
- return new ImageIcon(u, getUsecaseid());
- } catch (Exception e) {
- logger.error(e);
- return null;
- }
- }
-
- /**
- * String representation of the use case. It also contains interesting
- * information on the availability of resources in the grid to actually
- * execute that workflow element.
- *
- * @return String
- */
- @Override
- public String toString() {
- List<String> hlp = new ArrayList<String>();
- hlp.add("usecaseid: " + getUsecaseid());
- hlp.add("description: " + getDescription());
- hlp.add("group: " + group);
- hlp.add("test: " + test_local);
- hlp.add("tags: " + getTags());
- for (Map.Entry<String, ScriptInput> cur : getInputs().entrySet()) {
- hlp.add(">" + cur.getKey() + ">: " + cur.getValue().toString());
- }
- for (Map.Entry<String, ScriptOutput> cur : getOutputs().entrySet()) {
- hlp.add("<" + cur.getKey() + "<: " + cur.getValue().toString());
- }
- hlp.add("RE: " + getREs().toString());
- hlp.add("preferred queues: " + getQueue_preferred());
- hlp.add("denied queues: " + getQueue_deny());
- String tos = super.toString() + "[";
- for (int i = 0; i < hlp.size(); i++) {
- if (i != 0)
- tos += ", ";
- tos += hlp.get(i);
- }
- return tos + " ]";
- }
-
- /**
- * hajo's test just pass an url or file url to an xml file
- *
- * @throws IOException
- * @throws MalformedURLException
- * @throws DeserializationException
- */
- public static void main(String[] argv) throws MalformedURLException, IOException, DeserializationException {
- UseCaseDescription d = new UseCaseDescription(new URL(argv[0]).openStream());
- logger.info(d.getCommand());
- }
-
- /**
- * @param command the command to set
- */
- @ConfigurationProperty(name = "command", label = "Command", description="What is actually executed on the shell")
- public void setCommand(String command) {
- this.command = command;
- }
-
- /**
- * @param description the description to set
- */
- @ConfigurationProperty(name = "description", label = "Description", description="Textual description of the tool", required=false, uri="http://purl.org/dc/elements/1.1/description")
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param executionTimeoutInSeconds the executionTimeoutInSeconds to set
- */
- @ConfigurationProperty(name = "executionTimeoutInSeconds", label = "Execution Timeout In Seconds")
- public void setExecutionTimeoutInSeconds(int executionTimeoutInSeconds) {
- this.executionTimeoutInSeconds = executionTimeoutInSeconds;
- }
-
- /**
- * @return the executionTimeoutInSeconds
- */
- public int getExecutionTimeoutInSeconds() {
- return executionTimeoutInSeconds;
- }
-
- /**
- * @param inputs the inputs to set
- */
- public void setInputs(Map<String, ScriptInput> inputs) {
- this.inputs = inputs;
- }
-
- @ConfigurationProperty(name = "inputs", label = "Inputs", required=false)
- public void setInputs(Set<InputMap> inputs) {
- if (inputs != null) {
- this.inputs = new HashMap<String, ScriptInput>();
- for (InputMap inputMap : inputs) {
- this.inputs.put(inputMap.getPort(), inputMap.getInput());
- }
- } else {
- this.inputs = null;
- }
- }
-
- /**
- * @return the inputs
- */
- public Map<String, ScriptInput> getInputs() {
- if (inputs == null) {
- inputs = new HashMap<String, ScriptInput>();
- }
- return inputs;
- }
-
- /**
- * @param outputs the outputs to set
- */
- public void setOutputs(Map<String, ScriptOutput> outputs) {
- this.outputs = outputs;
- }
-
- @ConfigurationProperty(name = "outputs", label = "Outputs", required=false)
- public void setOutputs(Set<OutputMap> outputs) {
- if (outputs != null) {
- this.outputs = new HashMap<String, ScriptOutput>();
- for (OutputMap outputMap : outputs) {
- this.outputs.put(outputMap.getPort(), outputMap.getOutput());
- }
- } else {
- this.outputs = null;
- }
- }
-
- /**
- * @return the outputs
- */
- public Map<String, ScriptOutput> getOutputs() {
- if (outputs == null) {
- outputs = new HashMap<String, ScriptOutput>();
- }
- return outputs;
- }
-
- /**
- * @param preparingTimeoutInSeconds the preparingTimeoutInSeconds to set
- */
- @ConfigurationProperty(name = "preparingTimeoutInSeconds", label = "Preparing Timeout In Seconds")
- public void setPreparingTimeoutInSeconds(int preparingTimeoutInSeconds) {
- this.preparingTimeoutInSeconds = preparingTimeoutInSeconds;
- }
-
- /**
- * @return the preparingTimeoutInSeconds
- */
- public int getPreparingTimeoutInSeconds() {
- return preparingTimeoutInSeconds;
- }
-
- /**
- * @param queue_deny the queue_deny to set
- */
- public void setQueue_deny(ArrayList<String> queue_deny) {
- this.queue_deny = queue_deny;
- }
-
- /**
- * @return the queue_deny
- */
- public ArrayList<String> getQueue_deny() {
- if (queue_deny == null) {
- queue_deny = new ArrayList<String>();
- }
- return queue_deny;
- }
-
- /**
- * @param queue_preferred the queue_preferred to set
- */
- public void setQueue_preferred(ArrayList<String> queue_preferred) {
- this.queue_preferred = queue_preferred;
- }
-
- /**
- * @return the queue_preferred
- */
- public ArrayList<String> getQueue_preferred() {
- if (queue_preferred == null) {
- queue_preferred = new ArrayList<String>();
- }
- return queue_preferred;
- }
-
- /**
- * @param rEs the rEs to set
- */
- public void setREs(List<RuntimeEnvironmentConstraint> rEs) {
- REs = rEs;
- }
-
- /**
- * @return the rEs
- */
- public List<RuntimeEnvironmentConstraint> getREs() {
- if (REs == null) {
- REs = new ArrayList<RuntimeEnvironmentConstraint>();
- }
- return REs;
- }
-
- /**
- * @param static_inputs the static_inputs to set
- */
- @ConfigurationProperty(name = "staticInputs", label = "Static Inputs", ordering=OrderPolicy.NON_ORDERED, required=false)
- public void setStatic_inputs(List<ScriptInputStatic> static_inputs) {
- this.static_inputs = static_inputs;
- }
-
- /**
- * @return the static_inputs
- */
- public List<ScriptInputStatic> getStatic_inputs() {
- if (static_inputs == null) {
- static_inputs = new ArrayList<ScriptInputStatic>();
- }
- return static_inputs;
- }
-
- /**
- * @param tags the tags to set
- */
- public void setTags(List<String> tags) {
- this.tags = tags;
- }
-
- /**
- * @return the tags
- */
- public List<String> getTags() {
- if (tags == null) {
- tags = new ArrayList<String>();
- }
- return tags;
- }
-
- /**
- * @param usecaseid the usecaseid to set
- */
- @ConfigurationProperty(name = "usecaseid", label = "Title", uri="http://purl.org/dc/elements/1.1/title", required=false)
- public void setUsecaseid(String usecaseid) {
- this.usecaseid = usecaseid;
- }
-
- /**
- * @return the usecaseid
- */
- public String getUsecaseid() {
- return usecaseid;
- }
-
- public boolean isIncludeStdIn() {
- return includeStdIn;
- }
-
- @ConfigurationProperty(name = "includeStdIn", label = "Include STDIN")
- public void setIncludeStdIn(boolean includeStdIn) {
- this.includeStdIn = includeStdIn;
- }
-
- public boolean isIncludeStdOut() {
- return includeStdOut;
- }
-
- @ConfigurationProperty(name = "includeStdOut", label = "Include STDOUT")
- public void setIncludeStdOut(boolean includeStdOut) {
- this.includeStdOut = includeStdOut;
- }
-
- public boolean isIncludeStdErr() {
- return includeStdErr;
- }
-
- @ConfigurationProperty(name = "includeStdErr", label = "Include STDERR")
- public void setIncludeStdErr(boolean includeStdErr) {
- this.includeStdErr = includeStdErr;
- }
-
- /**
- * @return the validReturnCodes
- */
- public List<Integer> getValidReturnCodes() {
- if (validReturnCodes == null) {
- validReturnCodes = new ArrayList<Integer>();
- }
- if (validReturnCodes.isEmpty()) {
- validReturnCodes.add(0);
- }
- return validReturnCodes;
- }
-
- /**
- * @param validReturnCodes the validReturnCodes to set
- */
- public void setValidReturnCodes(List<Integer> validReturnCodes) {
- this.validReturnCodes = validReturnCodes;
- }
-
- public String getReturnCodesAsText() {
- return StringUtils.join(getValidReturnCodes(), ",");
- }
-
- public void setReturnCodesAsText(String text) {
- if (getValidReturnCodes() == null) {
- validReturnCodes = new ArrayList<Integer>();
- }
- validReturnCodes.clear();
- String[] codes = text.split(",");
- for (String code : codes) {
- try {
- Integer codeInt = new Integer(code);
- if (!validReturnCodes.contains(codeInt)) {
- validReturnCodes.add(codeInt);
- }
- }
- catch (NumberFormatException e) {
- logger.error(e);
- }
- }
- if (validReturnCodes.isEmpty()) {
- validReturnCodes.add(0);
- }
- Collections.sort(validReturnCodes);
- }
-
- /**
- * @return the group
- */
- public String getGroup() {
- return group;
- }
-
- /**
- * @param group the group to set
- */
- public void setGroup(String group) {
- this.group = group;
- }
-
- /**
- * @return the icon_url
- */
- public String getIcon_url() {
- return icon_url;
- }
-
- @ConfigurationBean(uri = ExternalToolActivity.URI + "#OutputMap")
- public static class OutputMap {
- private String port;
-
- private ScriptOutput output;
-
- public String getPort() {
- return port;
- }
-
- @ConfigurationProperty(name = "port", label = "Port")
- public void setPort(String port) {
- this.port = port;
- }
-
- public ScriptOutput getOutput() {
- return output;
- }
-
- @ConfigurationProperty(name = "output", label = "Output")
- public void setOutput(ScriptOutput output) {
- this.output = output;
- }
- }
-
- @ConfigurationBean(uri = ExternalToolActivity.URI + "#InputMap")
- public static class InputMap {
- private String port;
-
- private ScriptInputUser input;
-
- public String getPort() {
- return port;
- }
-
- @ConfigurationProperty(name = "port", label = "Port")
- public void setPort(String port) {
- this.port = port;
- }
-
- public ScriptInputUser getInput() {
- return input;
- }
-
- @ConfigurationProperty(name = "input", label = "Input")
- public void setInput(ScriptInputUser input) {
- this.input = input;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/UseCaseEnumeration.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/UseCaseEnumeration.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/UseCaseEnumeration.java
index 1a43461..949ae93 100644
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/UseCaseEnumeration.java
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/desc/UseCaseEnumeration.java
@@ -37,9 +37,9 @@ public class UseCaseEnumeration {
private static Logger logger = Logger.getLogger(UseCaseEnumeration.class);
- public static List<UseCaseDescription> readDescriptionsFromUrl(String xmlFileUrl) throws IOException {
+ public static List<ToolDescription> readDescriptionsFromUrl(String xmlFileUrl) throws IOException {
- List<UseCaseDescription> ret = new ArrayList<UseCaseDescription>();
+ List<ToolDescription> ret = new ArrayList<ToolDescription>();
URLConnection con = null;
try {
URL url = new URL(xmlFileUrl);
@@ -61,9 +61,9 @@ public class UseCaseEnumeration {
}
- public static List<UseCaseDescription> readDescriptionsFromStream(InputStream is) {
+ public static List<ToolDescription> readDescriptionsFromStream(InputStream is) {
- List<UseCaseDescription> ret = new ArrayList<UseCaseDescription>();
+ List<ToolDescription> ret = new ArrayList<ToolDescription>();
SAXBuilder builder = new SAXBuilder();
Document doc = null;
@@ -89,7 +89,7 @@ public class UseCaseEnumeration {
Element child = (Element) ochild;
if (child.getName().equalsIgnoreCase("program")) {
try {
- ret.add(new UseCaseDescription(child));
+ ret.add(new ToolDescription(child));
} catch (DeserializationException e) {
logger.error(e);
}
@@ -98,10 +98,10 @@ public class UseCaseEnumeration {
return ret;
}
- public static UseCaseDescription readDescriptionFromUrl(
+ public static ToolDescription readDescriptionFromUrl(
String repositoryUrl, String id) throws IOException {
- List<UseCaseDescription> descriptions = readDescriptionsFromUrl(repositoryUrl);
- for (UseCaseDescription usecase : descriptions) {
+ List<ToolDescription> descriptions = readDescriptionsFromUrl(repositoryUrl);
+ for (ToolDescription usecase : descriptions) {
if (usecase.getUsecaseid().equals(id)) {
return usecase;
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/invocation/ToolInvocation.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/invocation/ToolInvocation.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/invocation/ToolInvocation.java
index 485f613..2fc56a9 100644
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/invocation/ToolInvocation.java
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/invocation/ToolInvocation.java
@@ -34,7 +34,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.taverna.activities.externaltool.desc.ScriptInput;
import org.apache.taverna.activities.externaltool.desc.ScriptInputStatic;
import org.apache.taverna.activities.externaltool.desc.ScriptInputUser;
-import org.apache.taverna.activities.externaltool.desc.UseCaseDescription;
+import org.apache.taverna.activities.externaltool.desc.ToolDescription;
import org.apache.taverna.invocation.InvocationContext;
import org.apache.taverna.reference.ExternalReferenceSPI;
import org.apache.taverna.reference.Identified;
@@ -67,7 +67,7 @@ public abstract class ToolInvocation {
return actualOsCommand;
}
- protected UseCaseDescription usecase;
+ protected ToolDescription usecase;
protected final HashMap<String, String> tags = new HashMap<String, String>();
protected int nTempFiles = 0;
private static int submissionID = 0;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalInvocationCreator.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalInvocationCreator.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalInvocationCreator.java
index 13154d9..f127049 100644
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalInvocationCreator.java
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalInvocationCreator.java
@@ -23,7 +23,7 @@ import java.io.IOException;
import java.util.Map;
import org.apache.taverna.activities.externaltool.InvocationCreator;
-import org.apache.taverna.activities.externaltool.desc.UseCaseDescription;
+import org.apache.taverna.activities.externaltool.desc.ToolDescription;
import org.apache.taverna.activities.externaltool.invocation.ToolInvocation;
import org.apache.taverna.activities.externaltool.manager.InvocationMechanism;
import org.apache.taverna.reference.ReferenceService;
@@ -50,7 +50,7 @@ public final class LocalInvocationCreator implements
}
@Override
- public ToolInvocation convert(InvocationMechanism m, UseCaseDescription description, Map<String, T2Reference> data, ReferenceService referenceService) {
+ public ToolInvocation convert(InvocationMechanism m, ToolDescription description, Map<String, T2Reference> data, ReferenceService referenceService) {
ExternalToolLocalInvocationMechanism mechanism = (ExternalToolLocalInvocationMechanism) m;
ToolInvocation result = null;
try {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalToolInvocation.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalToolInvocation.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalToolInvocation.java
index c88f7c8..a6a8d47 100755
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalToolInvocation.java
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/local/LocalToolInvocation.java
@@ -49,7 +49,7 @@ import java.util.regex.Matcher;
import org.apache.taverna.activities.externaltool.desc.ScriptInput;
import org.apache.taverna.activities.externaltool.desc.ScriptOutput;
-import org.apache.taverna.activities.externaltool.desc.UseCaseDescription;
+import org.apache.taverna.activities.externaltool.desc.ToolDescription;
import org.apache.taverna.activities.externaltool.invocation.InvocationException;
import org.apache.taverna.activities.externaltool.invocation.ToolInvocation;
import org.apache.taverna.activities.externaltool.ssh.SshNode;
@@ -93,7 +93,7 @@ public class LocalToolInvocation extends ToolInvocation {
private static String LOCAL_INVOCATION_FILE = "localInvocations";
- public LocalToolInvocation(UseCaseDescription desc, boolean retrieveData, String mainTempDirectory, String shellPrefix, String linkCommand) throws IOException {
+ public LocalToolInvocation(ToolDescription desc, boolean retrieveData, String mainTempDirectory, String shellPrefix, String linkCommand) throws IOException {
usecase = desc;
setRetrieveData(retrieveData);
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshInvocationCreator.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshInvocationCreator.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshInvocationCreator.java
index 8f1950e..8ebc656 100644
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshInvocationCreator.java
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshInvocationCreator.java
@@ -25,7 +25,7 @@ import java.util.Map;
import org.apache.taverna.activities.externaltool.InvocationCreator;
import org.apache.taverna.activities.externaltool.RetrieveLoginFromTaverna;
-import org.apache.taverna.activities.externaltool.desc.UseCaseDescription;
+import org.apache.taverna.activities.externaltool.desc.ToolDescription;
import org.apache.taverna.activities.externaltool.invocation.ToolInvocation;
import org.apache.log4j.Logger;
@@ -58,7 +58,7 @@ public final class SshInvocationCreator implements InvocationCreator {
}
@Override
- public ToolInvocation convert(InvocationMechanism m, UseCaseDescription description, Map<String, T2Reference> data, ReferenceService referenceService) {
+ public ToolInvocation convert(InvocationMechanism m, ToolDescription description, Map<String, T2Reference> data, ReferenceService referenceService) {
ExternalToolSshInvocationMechanism mechanism = (ExternalToolSshInvocationMechanism) m;
SshToolInvocation result = null;
try {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/59a0dc12/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshToolInvocation.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshToolInvocation.java b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshToolInvocation.java
index edf9698..a363f8d 100755
--- a/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshToolInvocation.java
+++ b/taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshToolInvocation.java
@@ -45,7 +45,7 @@ import java.util.regex.Matcher;
import org.apache.taverna.activities.externaltool.RetrieveLoginFromTaverna;
import org.apache.taverna.activities.externaltool.desc.ScriptInput;
import org.apache.taverna.activities.externaltool.desc.ScriptOutput;
-import org.apache.taverna.activities.externaltool.desc.UseCaseDescription;
+import org.apache.taverna.activities.externaltool.desc.ToolDescription;
import org.apache.taverna.activities.externaltool.invocation.AskUserForPw;
import org.apache.taverna.activities.externaltool.invocation.InvocationException;
import org.apache.taverna.activities.externaltool.invocation.ToolInvocation;
@@ -124,7 +124,7 @@ public class SshToolInvocation extends ToolInvocation {
return null;
}
- public SshToolInvocation(UseCaseDescription desc, SshNode workerNodeA,
+ public SshToolInvocation(ToolDescription desc, SshNode workerNodeA,
AskUserForPw askUserForPwA, CredentialManager credentialManager)
throws JSchException, SftpException {
this.workerNode = workerNodeA;