You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/07/23 18:48:21 UTC
[07/20] introducing workflow support in airavata api + other related
modules
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/datadriven/WorkflowHarvester.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/datadriven/WorkflowHarvester.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/datadriven/WorkflowHarvester.java
new file mode 100644
index 0000000..d82f879
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/datadriven/WorkflowHarvester.java
@@ -0,0 +1,191 @@
+/*
+ *
+ * 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.airavata.workflow.engine.datadriven;
+
+import java.awt.Point;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.utils.Pair;
+import org.apache.airavata.workflow.model.component.system.InputComponent;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.workflow.model.graph.DataPort;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+import org.apache.airavata.workflow.model.wf.Workflow;
+
+public class WorkflowHarvester {
+
+ public WorkflowHarvester() {
+
+ }
+
+ public Workflow[] harvest(Workflow workflow, QName dataType) {
+ LinkedList<Workflow> harvest = new LinkedList<Workflow>();
+ LinkedList<Pair<String, String>> candidates = getCandidates(workflow, dataType);
+ for (Pair<String, String> pair : candidates) {
+ Workflow clone = workflow.clone();
+
+ NodeImpl node = clone.getGraph().getNode(pair.getLeft());
+ if (null == node) {
+ throw new WorkflowRuntimeException("Specified node not found:" + pair.getLeft());
+ }
+ Port candidatePort = null;
+ List<DataPort> inPorts = node.getInputPorts();
+ for (DataPort dataPort : inPorts) {
+ if (pair.getRight().equals(dataPort.getID())) {
+ candidatePort = dataPort;
+ break;
+ }
+ }
+ if (null == candidatePort) {
+ throw new WorkflowRuntimeException("Specifies Port was not found:" + pair.getRight());
+ }
+ if (!(candidatePort.getFromNode() instanceof InputNode)) {
+ removeUnnecessaryNodes(node, candidatePort, clone);
+ Node input = clone.addNode(new InputComponent());
+ input.setPosition(new Point(Math.max(0, node.getPosition().x - 150), node.getPosition().y));
+
+ // the returned workflows size should be less than that of the
+ // original
+ if (clone.getGraph().getNodes().size() < workflow.getGraph().getNodes().size()
+ // if the sizes the different its a candidate, but need
+ // to make sure
+ // its not the same as one already harvested
+ && !isWorkflowAlreadyHarvested(harvest, clone)) {
+ try {
+ clone.getGraph().addEdge(input.getOutputPort(0), candidatePort);
+ cleanLeftOverInputNodes(clone);
+ } catch (GraphException e) {
+ throw new RuntimeException(e);
+ }
+
+ harvest.add(clone);
+ }
+
+ }
+ }
+ return harvest.toArray(new Workflow[0]);
+ }
+
+ /**
+ * @param clone
+ */
+ private void cleanLeftOverInputNodes(Workflow clone) {
+
+ List<NodeImpl> nodes = clone.getGraph().getNodes();
+ LinkedList<Node> removeList = new LinkedList<Node>();
+ for (Node nodeImpl : nodes) {
+ if (nodeImpl instanceof InputNode) {
+ if (nodeImpl.getOutputPort(0).getToNodes().size() == 0) {
+ removeList.add(nodeImpl);
+ }
+ }
+ }
+ for (Node node : removeList) {
+ try {
+ clone.removeNode(node);
+ } catch (GraphException e) {
+ throw new WorkflowRuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * @param harvest
+ * @param clone
+ * @return
+ */
+ private boolean isWorkflowAlreadyHarvested(LinkedList<Workflow> harvest, Workflow clone) {
+ for (Workflow workflow : harvest) {
+ if (workflow.equals(clone)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param pair
+ * @param clone
+ */
+ private void removeUnnecessaryNodes(Node node, Port candidatePort, Workflow workflow) {
+ if (candidatePort.getFromPort().getEdges().size() == 1) {
+ Node fromNode = candidatePort.getFromNode();
+ try {
+ List<DataPort> inputPorts = fromNode.getInputPorts();
+ for (DataPort dataPort : inputPorts) {
+ removeUnnecessaryNodes(fromNode, dataPort, workflow);
+ }
+ workflow.removeNode(fromNode);
+ } catch (GraphException e) {
+ throw new WorkflowRuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * @param pair
+ * @return
+ */
+ private List<DataPort> getRemainderPorts(Pair<WSNode, DataPort> pair) {
+ LinkedList<DataPort> ret = new LinkedList<DataPort>();
+ List<DataPort> inputPorts = pair.getLeft().getInputPorts();
+ for (DataPort dataPort : inputPorts) {
+ if (pair.getRight() != dataPort) {
+ ret.add(dataPort);
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * @param workflow
+ * @param dataType
+ * @return pair of nodeid and portid
+ */
+ private LinkedList<Pair<String, String>> getCandidates(Workflow workflow, QName dataType) {
+ LinkedList<Pair<String, String>> candidates = new LinkedList<Pair<String, String>>();
+ List<NodeImpl> nodes = workflow.getGraph().getNodes();
+ for (NodeImpl node : nodes) {
+ if (node instanceof WSNode) {
+ List<DataPort> inputPorts = ((WSNode) node).getInputPorts();
+ for (DataPort dataPort : inputPorts) {
+
+ if (dataType.equals(dataPort.getType())) {
+ candidates.add(new Pair<String, String>(node.getID(), dataPort.getID()));
+ }
+
+ }
+ }
+ }
+
+ return candidates;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/file/XBayaPathConstants.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/file/XBayaPathConstants.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/file/XBayaPathConstants.java
new file mode 100644
index 0000000..d0ae0b1
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/file/XBayaPathConstants.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.airavata.workflow.engine.file;
+
+import java.io.File;
+
+public interface XBayaPathConstants {
+
+ /**
+ * Root directory of the server.
+ */
+ public static final String XBAYA_DIRECTORY = "modules" + File.separator + "xbaya-gui";
+
+ /**
+ * The path of the directory that stores component definitions.
+ */
+ public static final String WSDL_DIRECTORY = XBAYA_DIRECTORY + File.separator + "src" + File.separator + "main"
+ + File.separator + "resources" + File.separator + "wsdls";
+
+ /**
+ * The path of the directory that stores graphs.
+ */
+ public static final String WORKFLOW_DIRECTORY = XBAYA_DIRECTORY + File.separator + "workflows";
+
+ /**
+ * The path of the directory where the scripts are saved.
+ */
+ public static final String SCRIPT_DIRECTORY = XBAYA_DIRECTORY + File.separator + "scripts";
+
+ /**
+ * The path of the directory where the BPEL scripts are saved.
+ */
+ public static final String JYTHON_SCRIPT_DIRECTORY = SCRIPT_DIRECTORY + File.separator + "jython";
+
+ /**
+ * The path of the directory where the BPEL scripts are saved.
+ */
+ public static final String BPEL_SCRIPT_DIRECTORY = SCRIPT_DIRECTORY + File.separator + "bpel";
+
+ /**
+ * The path of the directory where the scufl scripts are saved.
+ */
+ public static final String SCUFL_SCRIPT_DIRECTORY = SCRIPT_DIRECTORY + File.separator + "scufl";
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/gfac/GFacRegistryClient.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/gfac/GFacRegistryClient.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/gfac/GFacRegistryClient.java
new file mode 100644
index 0000000..ab8ac4f
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/gfac/GFacRegistryClient.java
@@ -0,0 +1,169 @@
+/*
+ *
+ * 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.airavata.workflow.engine.gfac;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+import org.xmlpull.v1.builder.Iterable;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.impl.WSIFMessageElement;
+
+public class GFacRegistryClient {
+
+ /**
+ * GFAC_NAMESPACE
+ */
+ public static final String GFAC_NAMESPACE = "http://www.extreme.indiana.edu/namespaces/2004/01/gFac";
+
+ private static final String SEARCH_SERVICE_INSTANCE = "searchServiceInstance";
+
+ private static final String SEARCH_SERVIE = "searchService";
+
+ private static final String QNAME = "qname";
+
+ private static final String DESC_AS_STRING = "descAsStr";
+
+ private static final String LIFE_TIME = "lifetimeAsSeconds";
+
+ private static final String RESULTS = "results";
+
+ private static final String GET_ABSTRACT_WSDL = "getAbstractWsdl";
+
+ private String wsdlURL;
+
+ private SimpleWSClient client;
+
+ /**
+ * Constructs a GFacRegistryClient.
+ *
+ * @param wsdlURL
+ */
+ public GFacRegistryClient(URI wsdlURL) {
+ this(wsdlURL.toString());
+ }
+
+ /**
+ * Constructs a GfacRegistryClient.
+ *
+ * @param wsdlURL
+ */
+ public GFacRegistryClient(String wsdlURL) {
+ this.wsdlURL = wsdlURL;
+ this.client = new SimpleWSClient();
+ }
+
+ /**
+ * @param appDescAsStr
+ * @throws ComponentRegistryException
+ */
+ public void registerAppDesc(String appDescAsStr) throws ComponentRegistryException {
+ this.client.sendSOAPMessage(this.wsdlURL, new String[][] { { DESC_AS_STRING, appDescAsStr } },
+ "registerAppDesc");
+ }
+
+ /**
+ * @param wsdlAsStr
+ * @param lifetimeAsSeconds
+ * @throws ComponentRegistryException
+ */
+ public void registerConcreteWsdl(String wsdlAsStr, int lifetimeAsSeconds) throws ComponentRegistryException {
+ this.client.sendSOAPMessage(this.wsdlURL,
+ new String[][] { { DESC_AS_STRING, wsdlAsStr }, { LIFE_TIME, String.valueOf(lifetimeAsSeconds) } },
+ "registerConcreteWsdl");
+
+ }
+
+ /**
+ * @param wsdlQName
+ * @return The concrete WSDL
+ * @throws ComponentRegistryException
+ */
+ public String getConcreteWsdl(String wsdlQName) throws ComponentRegistryException {
+ WSIFMessage response = this.client.sendSOAPMessage(this.wsdlURL, new String[][] { { QNAME, wsdlQName } },
+ "getConcreateWsdl");
+ return (String) response.getObjectPart(DESC_AS_STRING);
+ }
+
+ /**
+ * @param wsdlQName
+ * @throws ComponentRegistryException
+ */
+ public void removeConcreteWsdl(String wsdlQName) throws ComponentRegistryException {
+ this.client.sendSOAPMessage(this.wsdlURL, new String[][] { { QNAME, wsdlQName } }, "removeConcreteWsdl");
+
+ }
+
+ /**
+ * @param serviceName
+ * @return The list of concreate WSDL QNames.
+ * @throws ComponentRegistryException
+ */
+ public String[] findService(String serviceName) throws ComponentRegistryException {
+ WSIFMessage response = this.client.sendSOAPMessage(this.wsdlURL, new String[][] { { QNAME, serviceName } },
+ SEARCH_SERVICE_INSTANCE);
+ return findArrayValue(RESULTS, (WSIFMessageElement) response).toArray(new String[] {});
+ }
+
+ /**
+ * @param serviceName
+ * @return The list of abstract WSDL QNames.
+ * @throws ComponentRegistryException
+ */
+ public String[] findServiceDesc(String serviceName) throws ComponentRegistryException {
+ WSIFMessage response = this.client.sendSOAPMessage(this.wsdlURL, new String[][] { { QNAME, serviceName } },
+ SEARCH_SERVIE);
+ return findArrayValue(RESULTS, (WSIFMessageElement) response).toArray(new String[] {});
+ }
+
+ /**
+ * @param wsdlQName
+ * @return The AWSDL.
+ * @throws ComponentRegistryException
+ */
+ public String getAbstractWsdl(String wsdlQName) throws ComponentRegistryException {
+ WSIFMessage response = this.client.sendSOAPMessage(this.wsdlURL, new String[][] { { QNAME, wsdlQName } },
+ GET_ABSTRACT_WSDL);
+ return (String) response.getObjectPart(DESC_AS_STRING);
+ }
+
+ private static ArrayList<String> findArrayValue(String name, WSIFMessageElement response) {
+ XmlElement param = response.element(null, name);
+ if (param != null) {
+ Iterable it = param.elements(null, "value");
+ if (it != null) {
+ ArrayList<String> values = new ArrayList<String>();
+
+ Iterator arrayValues = it.iterator();
+ while (arrayValues.hasNext()) {
+ values.add(((XmlElement) arrayValues.next()).requiredTextContent());
+ }
+ return values;
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/gfac/SimpleWSClient.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/gfac/SimpleWSClient.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/gfac/SimpleWSClient.java
new file mode 100644
index 0000000..fd5c049
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/gfac/SimpleWSClient.java
@@ -0,0 +1,134 @@
+/*
+ *
+ * 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.airavata.workflow.engine.gfac;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+import org.xmlpull.v1.builder.XmlInfosetBuilder;
+
+import xsul.XmlConstants;
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.WSIFOperation;
+import xsul.wsif.WSIFPort;
+import xsul.wsif.impl.WSIFMessageElement;
+import xsul.xwsif_runtime.WSIFClient;
+import xsul.xwsif_runtime.WSIFRuntime;
+
+/**
+ * This is a Simple Web Service client for easy SOAP Messages creation
+ *
+ */
+public class SimpleWSClient {
+
+ private static final Logger logger = LoggerFactory.getLogger(SimpleWSClient.class);
+
+ private static final XmlInfosetBuilder builder = XmlConstants.BUILDER;
+
+ private String requestNS = GFacRegistryClient.GFAC_NAMESPACE;
+
+ /**
+ * @param url
+ * @param args
+ * @param opName
+ * @return The output
+ * @throws ComponentRegistryException
+ */
+ public WSIFMessage sendSOAPMessage(String url, Object[][] args, String opName) throws ComponentRegistryException {
+ WSIFClient wclient = WSIFRuntime.newClient(url);
+ return sendSOAPMessage(wclient, args, opName);
+ }
+
+ /**
+ * @param wclient
+ * @param args
+ * @param opName
+ * @return The output
+ * @throws ComponentRegistryException
+ */
+ public WSIFMessage sendSOAPMessage(WSIFClient wclient, Object[][] args, String opName)
+ throws ComponentRegistryException {
+
+ WSIFPort port = wclient.getPort();
+
+ WSIFOperation operation = port.createOperation(opName);
+ WSIFMessage outputMessage = operation.createOutputMessage();
+ WSIFMessage faultMessage = operation.createFaultMessage();
+ String messageName = operation.createInputMessage().getName();
+ XmlElement inputMsgElem = builder.newFragment(this.requestNS, messageName);
+
+ for (int i = 0; i < args.length; i++) {
+ createMessage((String) args[i][0], args[i][1], inputMsgElem);
+ }
+
+ WSIFMessageElement inputMessage = new WSIFMessageElement(inputMsgElem);
+
+ boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
+ if (success) {
+ logger.debug("" + outputMessage);
+ return outputMessage;
+ } else {
+ throw new ComponentRegistryException("Excpetion at server " + faultMessage);
+ }
+ }
+
+ private void createMessage(String paramName, Object value, XmlElement inputMsgElem)
+ throws ComponentRegistryException {
+ XmlElement paramsElem = builder.newFragment(this.requestNS, paramName);
+ if (value instanceof String) {
+ paramsElem.addChild(value);
+ } else if (value instanceof Collection) {
+ Collection list = (Collection) value;
+ Iterator arrayValues = list.iterator();
+ while (arrayValues.hasNext()) {
+ XmlElement item = builder.newFragment("value");
+ item.addChild(arrayValues.next());
+ paramsElem.addChild(item);
+ }
+ } else if (value instanceof ArrayList) {
+ Collection list = (Collection) value;
+ Iterator arrayValues = list.iterator();
+ while (arrayValues.hasNext()) {
+ XmlElement item = builder.newFragment("value");
+ item.addChild(arrayValues.next());
+ paramsElem.addChild(item);
+ }
+ } else if (value instanceof String[]) {
+ String[] list = (String[]) value;
+ for (int i = 0; i < list.length; i++) {
+ XmlElement item = builder.newFragment("value");
+ item.addChild(list[i]);
+ paramsElem.addChild(item);
+ }
+ } else {
+ throw new ComponentRegistryException("Simple WS Client can not handle the value of type " + value);
+ }
+
+ inputMsgElem.addElement(paramsElem);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/globus/FileTransferConstants.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/globus/FileTransferConstants.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/globus/FileTransferConstants.java
new file mode 100644
index 0000000..2f6d3ec
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/globus/FileTransferConstants.java
@@ -0,0 +1,38 @@
+/*
+ *
+ * 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.airavata.workflow.engine.globus;
+
+public class FileTransferConstants {
+ public static final String DATA_TYPE = "DATA_TYPE";
+ public static final String TRANSFER = "transfer";
+ public static final String SUBMISSION_ID = "submission_id";
+ public static final String TRANSFER_ITEM = "transfer_item";
+ public static final String SOURCE_ENDPOINT = "source_endpoint";
+ public static final String SOURCE_PATH = "source_path";
+ public static final String DESTINATION_ENDPOINT = "destination_endpoint";
+ public static final String DESTINATION_PATH = "destination_path";
+ public static final String DATA = "DATA";
+ public static final String SUBMISSION_ID_ENDPOINT = "/transfer/submission_id";
+ public static final String VALUE = "value";
+ public static final String TRANSFER_ENDPOINT = "/transfer";
+ public static final String TASK_ID = "task_id";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/globus/GridFTPFileTransferClient.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/globus/GridFTPFileTransferClient.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/globus/GridFTPFileTransferClient.java
new file mode 100644
index 0000000..bcb3916
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/globus/GridFTPFileTransferClient.java
@@ -0,0 +1,239 @@
+package org.apache.airavata.workflow.engine.globus;
+///*
+// *
+// * 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.airavata.xbaya.globus;
+//
+//import org.globusonline.transfer.APIError;
+//import org.globusonline.transfer.BaseTransferAPIClient;
+//import org.globusonline.transfer.JSONTransferAPIClient;
+//import org.json.JSONArray;
+//import org.json.JSONException;
+//import org.json.JSONObject;
+//
+//import java.io.IOException;
+//import java.security.GeneralSecurityException;
+//import java.text.DateFormat;
+//import java.text.SimpleDateFormat;
+//import java.util.Date;
+//import java.util.HashMap;
+//import java.util.Iterator;
+//import java.util.Map;
+//
+//public class GridFTPFileTransferClient {
+// private JSONTransferAPIClient client;
+// private static DateFormat isoDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+//
+// public GridFTPFileTransferClient(JSONTransferAPIClient client) {
+// this.client = client;
+// }
+//
+// public static void main(String args[]) {
+// String username = "heshan";
+// String caFile = "/home/heshan/Dev/globusonline/transfer-api-client-java.git/trunk/ca/gd-bundle_ca.cert";
+// String certFile = "/tmp/x509up_u780936";
+// String keyFile = "/tmp/x509up_u780936";
+// String baseUrl = null;
+//
+// String sourceEndpoint = "xsede#ranger";
+// String sourceFilePath = "~/tmp.log";
+// String destEndpoint = "xsede#trestles";
+// String destFilePath = "~/tmp.log.copy";
+//
+// // String destEndpoint = "heshan#my_testEndpoint";
+// // String sourceFilePath = "~/var_tables.mod";
+// try {
+// JSONTransferAPIClient c = new JSONTransferAPIClient(username, caFile, certFile, keyFile, baseUrl);
+// System.out.println("base url: " + c.getBaseUrl());
+// GridFTPFileTransferClient e = new GridFTPFileTransferClient(c);
+// e.transfer(sourceEndpoint, sourceFilePath, destEndpoint, destFilePath);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+//
+// /**
+// * Transfers a file from source endpoint to destination endpoint.
+// *
+// * @param sourceEndpoint
+// * Source endpoint
+// * @param sourceFilePath
+// * Source file path
+// * @param destEndpoint
+// * Destination endpoint
+// * @param destFilePath
+// * Destination file path
+// * @throws IOException
+// * IOException
+// * @throws JSONException
+// * JSONException
+// * @throws GeneralSecurityException
+// * GeneralSecurityException
+// * @throws APIError
+// * APIError
+// */
+// public void transfer(String sourceEndpoint, String sourceFilePath, String destEndpoint, String destFilePath)
+// throws IOException, JSONException, GeneralSecurityException, APIError {
+// System.out.println("Starting transfer...");
+//
+// // displayTasksummary();
+// // displayTaskList(60 * 60 * 24 * 7); // tasks at most a week old
+// // displayEndpointList();
+//
+// if (!autoActivate(sourceEndpoint) || !autoActivate(destEndpoint)) {
+// System.err.println("Unable to auto activate go tutorial endpoints, " + " exiting");
+// return;
+// }
+//
+// // displayLs(sourceEndpoint, "~");
+// // displayLs(destEndpoint, "~");
+//
+// JSONTransferAPIClient.Result r = client.getResult(FileTransferConstants.SUBMISSION_ID_ENDPOINT);
+// String submissionId = r.document.getString(FileTransferConstants.VALUE);
+// JSONObject transfer = new JSONObject();
+// transfer.put(FileTransferConstants.DATA_TYPE, FileTransferConstants.TRANSFER);
+// transfer.put(FileTransferConstants.SUBMISSION_ID, submissionId);
+// JSONObject item = new JSONObject();
+// item.put(FileTransferConstants.DATA_TYPE, FileTransferConstants.TRANSFER_ITEM);
+// item.put(FileTransferConstants.SOURCE_ENDPOINT, sourceEndpoint);
+// item.put(FileTransferConstants.SOURCE_PATH, sourceFilePath);
+// item.put(FileTransferConstants.DESTINATION_ENDPOINT, destEndpoint);
+// item.put(FileTransferConstants.DESTINATION_PATH, destFilePath);
+// transfer.append(FileTransferConstants.DATA, item);
+//
+// r = client.postResult(FileTransferConstants.TRANSFER_ENDPOINT, transfer.toString(), null);
+// String taskId = r.document.getString(FileTransferConstants.TASK_ID);
+// if (!waitForTask(taskId, 120)) {
+// System.out.println("Transfer not complete after 2 minutes, exiting");
+// return;
+// }
+//
+// System.out.println("Transfer completed...");
+//
+// // displayTasksummary();
+// // displayLs(destEndpoint, "~");
+// }
+//
+// public void displayTasksummary() throws IOException, JSONException, GeneralSecurityException, APIError {
+// JSONTransferAPIClient.Result r = client.getResult("/tasksummary");
+// System.out.println("Task Summary for " + client.getUsername() + ": ");
+// Iterator keysIter = r.document.sortedKeys();
+// while (keysIter.hasNext()) {
+// String key = (String) keysIter.next();
+// if (!key.equals("DATA_TYPE"))
+// System.out.println(" " + key + ": " + r.document.getString(key));
+// }
+// }
+//
+// public void displayTaskList(long maxAge) throws IOException, JSONException, GeneralSecurityException, APIError {
+// Map<String, String> params = new HashMap<String, String>();
+// if (maxAge > 0) {
+// long minTime = System.currentTimeMillis() - 1000 * maxAge;
+// params.put("filter", "request_time:" + isoDateFormat.format(new Date(minTime)) + ",");
+// }
+// JSONTransferAPIClient.Result r = client.getResult("/task_list", params);
+//
+// int length = r.document.getInt("length");
+// if (length == 0) {
+// System.out.println("No tasks were submitted in the last " + maxAge + " seconds");
+// return;
+// }
+// JSONArray tasksArray = r.document.getJSONArray("DATA");
+// for (int i = 0; i < tasksArray.length(); i++) {
+// JSONObject taskObject = tasksArray.getJSONObject(i);
+// System.out.println("Task " + taskObject.getString("task_id") + ":");
+// displayTask(taskObject);
+// }
+// }
+//
+// private static void displayTask(JSONObject taskObject) throws JSONException {
+// Iterator keysIter = taskObject.sortedKeys();
+// while (keysIter.hasNext()) {
+// String key = (String) keysIter.next();
+// if (!key.equals("DATA_TYPE") && !key.equals("LINKS") && !key.endsWith("_link")) {
+// System.out.println(" " + key + ": " + taskObject.getString(key));
+// }
+// }
+// }
+//
+// public boolean autoActivate(String endpointName) throws IOException, JSONException, GeneralSecurityException,
+// APIError {
+// // Note: in a later release, auto-activation will be done at
+// // /autoactivate instead.
+// String resource = BaseTransferAPIClient.endpointPath(endpointName) + "/autoactivate";
+// JSONTransferAPIClient.Result r = client.postResult(resource, null, null);
+// String code = r.document.getString("code");
+// if (code.startsWith("AutoActivationFailed")) {
+// return false;
+// }
+// return true;
+// }
+//
+// public void displayLs(String endpointName, String path) throws IOException, JSONException,
+// GeneralSecurityException, APIError {
+// Map<String, String> params = new HashMap<String, String>();
+// if (path != null) {
+// params.put("path", path);
+// }
+// String resource = BaseTransferAPIClient.endpointPath(endpointName) + "/ls";
+// JSONTransferAPIClient.Result r = client.getResult(resource, params);
+// System.out.println("Contents of " + path + " on " + endpointName + ":");
+//
+// JSONArray fileArray = r.document.getJSONArray("DATA");
+// for (int i = 0; i < fileArray.length(); i++) {
+// JSONObject fileObject = fileArray.getJSONObject(i);
+// System.out.println(" " + fileObject.getString("name"));
+// Iterator keysIter = fileObject.sortedKeys();
+// while (keysIter.hasNext()) {
+// String key = (String) keysIter.next();
+// if (!key.equals("DATA_TYPE") && !key.equals("LINKS") && !key.endsWith("_link") && !key.equals("name")) {
+// System.out.println(" " + key + ": " + fileObject.getString(key));
+// }
+// }
+// }
+//
+// }
+//
+// public boolean waitForTask(String taskId, int timeout) throws IOException, JSONException, GeneralSecurityException,
+// APIError {
+// String status = "ACTIVE";
+// JSONTransferAPIClient.Result r;
+//
+// String resource = "/task/" + taskId;
+// Map<String, String> params = new HashMap<String, String>();
+// params.put("fields", "status");
+//
+// while (timeout > 0 && status.equals("ACTIVE")) {
+// r = client.getResult(resource, params);
+// status = r.document.getString("status");
+// try {
+// Thread.sleep(10000);
+// } catch (InterruptedException e) {
+// return false;
+// }
+// timeout -= 10;
+// }
+//
+// if (status.equals("ACTIVE"))
+// return false;
+// return true;
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/graph/controller/NodeController.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/graph/controller/NodeController.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/graph/controller/NodeController.java
new file mode 100644
index 0000000..5b7fd81
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/graph/controller/NodeController.java
@@ -0,0 +1,200 @@
+package org.apache.airavata.workflow.engine.graph.controller;
+///*
+// *
+// * 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.airavata.xbaya.graph.controller;
+//
+//import java.util.HashMap;
+//import java.util.Map;
+//
+//import org.apache.airavata.workflow.model.graph.Edge;
+//import org.apache.airavata.workflow.model.graph.Graph;
+//import org.apache.airavata.workflow.model.graph.GraphPiece;
+//import org.apache.airavata.workflow.model.graph.Node;
+//import org.apache.airavata.workflow.model.graph.Node.NodeExecutionState;
+//import org.apache.airavata.workflow.model.graph.Port;
+//import org.apache.airavata.workflow.model.graph.amazon.InstanceNode;
+//import org.apache.airavata.workflow.model.graph.amazon.TerminateInstanceNode;
+//import org.apache.airavata.workflow.model.graph.dynamic.DynamicNode;
+//import org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode;
+//import org.apache.airavata.workflow.model.graph.system.BlockNode;
+//import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+//import org.apache.airavata.workflow.model.graph.system.DifferedInputNode;
+//import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
+//import org.apache.airavata.workflow.model.graph.system.EndBlockNode;
+//import org.apache.airavata.workflow.model.graph.system.EndDoWhileNode;
+//import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
+//import org.apache.airavata.workflow.model.graph.system.EndifNode;
+//import org.apache.airavata.workflow.model.graph.system.ExitNode;
+//import org.apache.airavata.workflow.model.graph.system.ForEachNode;
+//import org.apache.airavata.workflow.model.graph.system.IfNode;
+//import org.apache.airavata.workflow.model.graph.system.InputNode;
+//import org.apache.airavata.workflow.model.graph.system.MemoNode;
+//import org.apache.airavata.workflow.model.graph.system.OutputNode;
+//import org.apache.airavata.workflow.model.graph.system.ReceiveNode;
+//import org.apache.airavata.workflow.model.graph.system.S3InputNode;
+//import org.apache.airavata.workflow.model.graph.system.StreamSourceNode;
+//import org.apache.airavata.workflow.model.graph.ws.WSNode;
+//import org.apache.airavata.workflow.model.graph.ws.WorkflowNode;
+//import org.apache.airavata.xbaya.ui.graph.EdgeGUI;
+//import org.apache.airavata.xbaya.ui.graph.GraphGUI;
+//import org.apache.airavata.xbaya.ui.graph.GraphPieceGUI;
+//import org.apache.airavata.xbaya.ui.graph.NodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.PortGUI;
+//import org.apache.airavata.xbaya.ui.graph.amazon.InstanceNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.amazon.TerminateInstanceNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.dynamic.DynamicNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.subworkflow.SubWorkflowNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.BlockNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.ConstantNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.DifferedInputNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.DoWhileNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.EndBlockNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.EndDoWhileNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.EndForEachNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.EndifNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.ExitNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.ForEachNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.IfNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.InputNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.MemoNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.OutputNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.ReceiveNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.S3InputNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.system.StreamSourceNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.ws.WSNodeGUI;
+//import org.apache.airavata.xbaya.ui.graph.ws.WorkflowNodeGUI;
+//
+//public class NodeController {
+// private static Map<GraphPiece,GraphPieceGUI> nodeMap=new HashMap<GraphPiece, GraphPieceGUI>();
+//// private static Map<Port,PortGUI> portMap=new HashMap<Port, PortGUI>();
+//
+// public static GraphPieceGUI getGUI(GraphPiece node){
+// if (!nodeMap.containsKey(node)){
+// nodeMap.put(node,createNodeGUI(node));
+// }
+// return nodeMap.get(node);
+// }
+//
+// public static GraphGUI getGUI(Graph node){
+// return (GraphGUI)getGUI((GraphPiece)node);
+// }
+//
+// public static NodeGUI getGUI(Node node){
+// return (NodeGUI)getGUI((GraphPiece)node);
+// }
+//
+// public static EdgeGUI getGUI(Edge port){
+// return (EdgeGUI)getGUI((GraphPiece)port);
+// }
+//
+// public static PortGUI getGUI(Port port){
+// return (PortGUI)getGUI((GraphPiece)port);
+// }
+//
+//// public static PortGUI getGUI(Port node){
+//// if (!portMap.containsKey(node)){
+//// portMap.put(node,createPortGUI(node));
+//// }
+//// return portMap.get(node);
+//// }
+////
+//// private static PortGUI createPortGUI(Port port){
+//// PortGUI portGUI=new PortGUI(port);
+//// return portGUI;
+//// }
+//
+// private static GraphPieceGUI createNodeGUI(GraphPiece node){
+// GraphPieceGUI nodeGUI=null;
+// if (node instanceof SubWorkflowNode){
+// nodeGUI=new SubWorkflowNodeGUI((SubWorkflowNode)node);
+// } else if (node instanceof DynamicNode){
+// nodeGUI=new DynamicNodeGUI((DynamicNode)node);
+// } else if (node instanceof ConstantNode){
+// nodeGUI=new ConstantNodeGUI((ConstantNode)node);
+// } else if (node instanceof IfNode){
+// nodeGUI=new IfNodeGUI((IfNode)node);
+// } else if (node instanceof ExitNode){
+// nodeGUI=new ExitNodeGUI((ExitNode)node);
+// } else if (node instanceof OutputNode){
+// nodeGUI=new OutputNodeGUI((OutputNode)node);
+// } else if (node instanceof DifferedInputNode){
+// nodeGUI=new DifferedInputNodeGUI((DifferedInputNode)node);
+// } else if (node instanceof BlockNode){
+// nodeGUI=new BlockNodeGUI((BlockNode)node);
+// } else if (node instanceof EndForEachNode){
+// nodeGUI=new EndForEachNodeGUI((EndForEachNode)node);
+// } else if (node instanceof S3InputNode){
+// nodeGUI=new S3InputNodeGUI((S3InputNode)node);
+// } else if (node instanceof ForEachNode){
+// nodeGUI=new ForEachNodeGUI((ForEachNode)node);
+// }else if (node instanceof DoWhileNode){
+// nodeGUI=new DoWhileNodeGUI((DoWhileNode)node);
+// } else if (node instanceof EndDoWhileNode){
+// nodeGUI=new EndDoWhileNodeGUI((EndDoWhileNode)node);
+// } else if (node instanceof MemoNode){
+// nodeGUI=new MemoNodeGUI((MemoNode)node);
+// } else if (node instanceof ReceiveNode){
+// nodeGUI=new ReceiveNodeGUI((ReceiveNode)node);
+// } else if (node instanceof InputNode){
+// nodeGUI=new InputNodeGUI((InputNode)node);
+// } else if (node instanceof EndifNode){
+// nodeGUI=new EndifNodeGUI((EndifNode)node);
+// } else if (node instanceof EndBlockNode){
+// nodeGUI=new EndBlockNodeGUI((EndBlockNode)node);
+// } else if (node instanceof WorkflowNode){
+// nodeGUI=new WorkflowNodeGUI((WorkflowNode)node);
+// } else if (node instanceof WSNode){
+// nodeGUI=new WSNodeGUI((WSNode)node);
+//// } else if (node instanceof Graph){
+//// nodeGUI=new GraphGUI((Graph)node);
+//// } else if (node instanceof GraphPiece){
+//// nodeGUI=new GraphPieceGUI((GraphPiece)node);
+// } else if (node instanceof Port){
+// nodeGUI=new PortGUI((Port)node);
+// } else if (node instanceof Edge){
+// nodeGUI=new EdgeGUI((Edge)node);
+// } else if (node instanceof TerminateInstanceNode){
+// nodeGUI=new TerminateInstanceNodeGUI((TerminateInstanceNode)node);
+// } else if (node instanceof InstanceNode){
+// nodeGUI=new InstanceNodeGUI((InstanceNode)node);
+// } else if (node instanceof StreamSourceNode){
+// nodeGUI=new StreamSourceNodeGUI((StreamSourceNode)node);
+// } else if (node instanceof Graph){
+// nodeGUI=new GraphGUI((Graph)node);
+// }
+//
+// return nodeGUI;
+// }
+//
+// public static boolean isFinished(Node node){
+// return node.getState() == NodeExecutionState.FINISHED;
+// }
+// public static boolean isWaiting(Node node){
+// return node.getState() == NodeExecutionState.WAITING;
+// }
+// public static boolean isRunning(Node node){
+// return node.getState() == NodeExecutionState.EXECUTING;
+// }
+// public static boolean isFailed(Node node){
+// return node.getState() == NodeExecutionState.FAILED;
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/DoWhileHandler.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/DoWhileHandler.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/DoWhileHandler.java
new file mode 100644
index 0000000..bddf9b4
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/DoWhileHandler.java
@@ -0,0 +1,249 @@
+/*
+ *
+ * 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.airavata.workflow.engine.interpretor;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.airavata.workflow.engine.invoker.Invoker;
+import org.apache.airavata.workflow.engine.util.InterpreterUtil;
+import org.apache.airavata.workflow.model.component.Component;
+import org.apache.airavata.workflow.model.component.ws.WSComponent;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.workflow.model.graph.ControlPort;
+import org.apache.airavata.workflow.model.graph.DataPort;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Node.NodeExecutionState;
+import org.apache.airavata.workflow.model.graph.impl.EdgeImpl;
+import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
+import org.apache.airavata.workflow.model.graph.system.EndDoWhileNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DoWhileHandler implements Callable<Boolean> {
+ private static Logger log = LoggerFactory.getLogger(DoWhileHandler.class);
+ private DoWhileNode dowhilenode;
+ private Map<Node, Invoker> invokerMap;
+ private ArrayList<Node> waitingNode;
+ private ArrayList<Node> finishedNodes;
+ private WorkflowInterpreter interpreter;
+ private ExecutorService threadExecutor;
+
+ /**
+ *
+ * Constructs a DoWhileHandler.
+ *
+ * @param node
+ * @param invokerMap
+ * @param waitingNode
+ * @param finishedNodes
+ * @param interpreter
+ */
+
+ public DoWhileHandler(DoWhileNode node, Map<Node, Invoker> invokerMap, ArrayList<Node> waitingNode, ArrayList<Node> finishedNodes,
+ WorkflowInterpreter interpreter, ExecutorService threadExecutor) {
+ this.dowhilenode = node;
+ this.invokerMap = invokerMap;
+ this.waitingNode = waitingNode;
+ this.finishedNodes = finishedNodes;
+ this.interpreter = interpreter;
+ this.threadExecutor = threadExecutor;
+ }
+
+ /**
+ * To evaluate dowhile condition with the input values
+ *
+ * @param doWhileNode
+ * @param inputPorts
+ * @param invokerMap
+ * @return boolean value
+ * @throws WorkFlowInterpreterException
+ * @throws XBayaException
+ */
+ private boolean evaluate(DoWhileNode doWhileNode, List<DataPort> inputPorts, Map<Node, Invoker> invokerMap) throws WorkFlowInterpreterException,
+ WorkflowException {
+ String booleanExpression = doWhileNode.getXpath();
+ if (booleanExpression == null) {
+ throw new WorkFlowInterpreterException("XPath for if cannot be null");
+ }
+
+ int i = 0;
+ for (DataPort port : inputPorts) {
+ Object inputVal1 = InterpreterUtil.findInputFromPort(port, invokerMap);
+ if (null == inputVal1) {
+ throw new WorkFlowInterpreterException("Unable to find inputs for the node:" + doWhileNode.getID());
+ }
+ booleanExpression = booleanExpression.replaceAll("\\$" + i, "'" + inputVal1 + "'");
+ i++;
+ }
+ Boolean result = new Boolean(false);
+ // Now the XPath expression
+ try {
+ XPathFactory xpathFact = XPathFactory.newInstance();
+ XPath xpath = xpathFact.newXPath();
+ result = (Boolean) xpath.evaluate(booleanExpression, booleanExpression, XPathConstants.BOOLEAN);
+ } catch (XPathExpressionException e) {
+ throw new WorkFlowInterpreterException("Cannot evaluate XPath in If Condition: " + booleanExpression);
+ }
+ return result.booleanValue();
+ }
+
+ /**
+ * To get only web service components attached to dowhile
+ *
+ * @param waitingNode
+ * @return list
+ */
+ private ArrayList<Node> handleDowhile(ArrayList<Node> waitingNode, ArrayList<Node> finishedNodes) {
+ ArrayList<Node> list = new ArrayList<Node>();
+ for (Node node : waitingNode) {
+ Component component = node.getComponent();
+ if (component instanceof WSComponent) {
+ ControlPort control = node.getControlInPort();
+ boolean controlDone = true;
+ if (control != null) {
+ for (EdgeImpl edge : control.getEdges()) {
+ controlDone = controlDone && (finishedNodes.contains(edge.getFromPort().getNode())
+ || ((ControlPort) edge.getFromPort()).isConditionMet());
+ }
+ }
+
+ /*
+ * Check for input ports
+ */
+ List<DataPort> inputPorts = node.getInputPorts();
+ boolean inputsDone = true;
+ for (DataPort dataPort : inputPorts) {
+ inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
+ }
+ if (inputsDone && controlDone) {
+ list.add(node);
+ }
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * @see java.util.concurrent.Callable#call()
+ */
+ @Override
+ public Boolean call() throws Exception {
+ log.debug("Invoked Dowhile node");
+ SystemComponentInvoker dowhileinvoker = new SystemComponentInvoker();
+ // TODO check for multiple input case
+ Object inputVal1 = InterpreterUtil.findInputFromPort(this.dowhilenode.getInputPort(0), this.invokerMap);
+ dowhileinvoker.addOutput(this.dowhilenode.getOutputPort(0).getID(), inputVal1);
+ this.invokerMap.put(this.dowhilenode, dowhileinvoker);
+ this.finishedNodes.add(this.dowhilenode);
+
+ ArrayList<Node> readyNodes = this.handleDowhile(this.waitingNode, this.finishedNodes);
+
+ // When you are starting 1st time its getting input from 1st node and
+ // invoking all the webservice components
+ if (readyNodes.size() != 1) {
+ throw new WorkflowRuntimeException("More than one dowhile execution not supported");
+ }
+ Node donode = readyNodes.get(0);
+ this.interpreter.handleWSComponent(donode);
+ log.debug("Invoked service " + donode.getName());
+
+ List<DataPort> inputPorts = this.dowhilenode.getInputPorts();
+ boolean runflag = true;
+ while (runflag) {
+// while (true) {
+// if (NodeController.isRunning(donode) || NodeController.isWaiting(donode)) {
+// Thread.sleep(500);
+// log.debug("Service " + donode.getName() + " waiting");
+// } else if (NodeController.isFinished(donode)) {
+// log.debug("Service " + donode.getName() + " Finished");
+// List<DataPort> ports = this.dowhilenode.getOutputPorts();
+// for (int outputPortIndex = 0, inputPortIndex = 1; outputPortIndex < ports.size(); outputPortIndex++) {
+// Object inputValue = InterpreterUtil.findInputFromPort(this.dowhilenode.getInputPort(inputPortIndex), this.invokerMap);
+// dowhileinvoker.addOutput(this.dowhilenode.getOutputPort(outputPortIndex).getID(), inputValue);
+// }
+// break;
+// } else if (NodeController.isFailed(donode)) {
+// log.debug("Service " + donode.getName() + " Failed");
+// runflag = false;
+// dowhilenode.setState(NodeExecutionState.FAILED);
+// this.threadExecutor.shutdown();
+// return false;
+// } else if (donode.isBreak()) {
+// log.debug("Service " + donode.getName() + " set to break");
+// runflag = false;
+// break;
+// } else {
+// log.error("Service " + donode.getName() + " have unknow status");
+// throw new WorkFlowInterpreterException("Unknow status of the node");
+// }
+// }
+
+// this.invokerMap.put(this.dowhilenode, dowhileinvoker);
+ log.debug("Going to evaluate do while expression for " + donode.getName());
+ if (!evaluate(this.dowhilenode, inputPorts, this.invokerMap)) {
+ log.debug("Expression evaluation is false so calling EndDoWhile");
+ runflag = false;
+ } else {
+ if (readyNodes.size() != 1) {
+ throw new WorkFlowInterpreterException("More than one dowhile execution not supported");
+ }
+
+ Node whileNode = readyNodes.get(0);
+ log.debug("Expression evaluation is true so invoking service again " + whileNode.getName());
+
+ this.interpreter.handleWSComponent(whileNode);
+ }
+ }
+ // WS node should be done
+ dowhilenode.setState(NodeExecutionState.FINISHED);
+ EndDoWhileNode endDoWhileNode = this.dowhilenode.getEndDoWhileNode();
+
+ // /////////////////////////////////////////////////////////
+ // // Do WHile finished execution thus we can set the //////
+ // //inputs to the EndDOWHile and resume the executions/////
+ SystemComponentInvoker invoker = new SystemComponentInvoker();
+
+ List<DataPort> inputports = endDoWhileNode.getInputPorts();
+
+ for (int inputPortIndex = 0; inputPortIndex < inputports.size(); inputPortIndex++) {
+ Object inputVal = dowhileinvoker.getOutput(inputports.get(inputPortIndex).getFromPort().getID());
+ invoker.addOutput(endDoWhileNode.getOutputPort(inputPortIndex).getID(), inputVal);
+ }
+
+ this.invokerMap.put(endDoWhileNode, invoker);
+ // TODO send mail once the iterations have converged
+
+ endDoWhileNode.setState(NodeExecutionState.FINISHED);
+ this.threadExecutor.shutdown();
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/ExperimentTemplate.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/ExperimentTemplate.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/ExperimentTemplate.java
new file mode 100644
index 0000000..3a7cb3d
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/ExperimentTemplate.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.airavata.workflow.engine.interpretor;
+
+import java.util.List;
+
+public class ExperimentTemplate {
+ private List<WorkflowExecutionTemplate> workflowExecutionTemplates;
+
+ public List<WorkflowExecutionTemplate> getWorkflowExecutionTemplates() {
+ return workflowExecutionTemplates;
+ }
+
+ public void setWorkflowExecutionTemplates(
+ List<WorkflowExecutionTemplate> workflowExecutionTemplates) {
+ this.workflowExecutionTemplates = workflowExecutionTemplates;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/HeaderConstants.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/HeaderConstants.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/HeaderConstants.java
new file mode 100644
index 0000000..c8163b3
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/HeaderConstants.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.airavata.workflow.engine.interpretor;
+
+public interface HeaderConstants {
+
+ public static final String HEADER_ELEMENT_GFAC = "gfac";
+ public static final String HEADER_ELEMENT_REGISTRY = "registry";
+ public static final String HEADER_ELEMENT_PROXYSERVER = "proxyserver";
+ public static final String HEADER_ELEMENT_MSGBOX = "msgbox";
+ public static final String HEADER_ELEMENT_DSC = "dsc";
+ public static final String HEADER_ELEMENT_BROKER = "broker";
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/SSWorkflowInterpreterInteractorImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/SSWorkflowInterpreterInteractorImpl.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/SSWorkflowInterpreterInteractorImpl.java
new file mode 100644
index 0000000..373a833
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/SSWorkflowInterpreterInteractorImpl.java
@@ -0,0 +1,115 @@
+/*
+ *
+ * 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.airavata.workflow.engine.interpretor;
+
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
+
+public class SSWorkflowInterpreterInteractorImpl implements
+ WorkflowInterpreterInteractor {
+
+ @Override
+ public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data) {
+ switch (messageType) {
+ case NODE_STATE_CHANGED:
+ break;
+ case EXECUTION_STATE_CHANGED:
+ WorkflowExecutionState state = (WorkflowExecutionState) data;
+ config.getWorkflow().setExecutionState(state);
+// if (state == WorkflowExecutionState.PAUSED
+// || state == WorkflowExecutionState.STOPPED) {
+// config.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
+// }else if (state == WorkflowExecutionState.RUNNING) {
+// config.getWorkflow().setExecutionState(WorkflowExecutionState.RUNNING);
+// }
+ break;
+ case EXECUTION_TASK_START:
+ break;
+ case EXECUTION_TASK_END:
+ break;
+ case OPEN_SUBWORKFLOW:
+ break;
+ case HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS:
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data)
+ throws Exception {
+ Object result = null;
+ switch (messageType) {
+// case INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW:
+// Workflow subWorkflow= (Workflow) data;
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(subWorkflow);
+// result = new WorkflowInterpreter(workflowInterpreterConfiguration
+// ,
+// new SSWorkflowInterpreterInteractorImpl());
+// break;
+// case INPUT_GSS_CREDENTIAL:
+// WorkflowInterpreter w = (WorkflowInterpreter) data;
+// result = SecurityUtil.getGSSCredential(w.getUsername(),
+// w.getPassword(), w.getConfig().getConfiguration().getMyProxyServer());
+// break;
+// case INPUT_LEAD_CONTEXT_HEADER:
+// Node node = (Node) data;
+// result = XBayaUtil.buildLeadContextHeader(config.getWorkflow(), config.getConfiguration(),
+// new MonitorConfiguration(config.getMessageBrokerURL(),
+// config.getTopic(), true,
+// config.getMessageBoxURL()), node.getID(),
+// null);
+// break;
+ default:
+ break;
+ }
+ return result;
+ }
+
+ @Override
+ public void pauseExecution(WorkflowInterpreterConfiguration config) {
+ notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.PAUSED);
+ }
+
+ @Override
+ public void resumeExecution(WorkflowInterpreterConfiguration config) {
+ notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.RUNNING);
+ }
+
+ @Override
+ public void terminateExecution(WorkflowInterpreterConfiguration config) {
+ notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.STOPPED);
+ }
+
+ @Override
+ public boolean isExecutionPaused(WorkflowInterpreterConfiguration config) {
+ return config.getWorkflow().getExecutionState()==WorkflowExecutionState.PAUSED;
+ }
+
+ @Override
+ public boolean isExecutionTerminated(WorkflowInterpreterConfiguration config) {
+ return config.getWorkflow().getExecutionState()==WorkflowExecutionState.STOPPED;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/SystemComponentInvoker.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/SystemComponentInvoker.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/SystemComponentInvoker.java
new file mode 100644
index 0000000..44d285d
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/SystemComponentInvoker.java
@@ -0,0 +1,114 @@
+/*
+ *
+ * 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.airavata.workflow.engine.interpretor;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.airavata.workflow.engine.invoker.Invoker;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+
+import xsul.wsif.WSIFMessage;
+import xsul.xwsif_runtime.WSIFClient;
+
+public class SystemComponentInvoker implements Invoker {
+
+ private Map<String, Object> outputs = new Hashtable<String, Object>();
+
+ /**
+ *
+ * @param key
+ * @param value
+ */
+ public void addOutput(String key, Object value) {
+ outputs.put(key, value);
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#getOutput(java.lang.String)
+ */
+ @Override
+ public Object getOutput(String name) {
+ Object out = null;
+ while (out == null) {
+ try {
+ out = this.outputs.get(name);
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ return out;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#getOutputs()
+ */
+ @Override
+ public WSIFMessage getOutputs() {
+ return null;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#invoke()
+ */
+ @Override
+ public boolean invoke() {
+ return true;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#setInput(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setInput(String name, Object value) {
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.wXPath Operatorsorkflow.Invoker#setOperation(java.lang.String)
+ */
+ @Override
+ public void setOperation(String operationName) {
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#setup()
+ */
+ @Override
+ public void setup() {
+ }
+
+ @Override
+ public WSIFClient getClient() {
+ return null;
+ }
+
+ @Override
+ public WSIFMessage getInputs() throws WorkflowException {
+ return null;
+ }
+
+ @Override
+ public WSIFMessage getFault() throws WorkflowException {
+ return null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkFlowInterpreterException.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkFlowInterpreterException.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkFlowInterpreterException.java
new file mode 100644
index 0000000..3937560
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkFlowInterpreterException.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.airavata.workflow.engine.interpretor;
+
+public class WorkFlowInterpreterException extends RuntimeException {
+
+ public WorkFlowInterpreterException() {
+ super();
+ }
+
+ public WorkFlowInterpreterException(String message) {
+ super(message);
+ }
+
+ public WorkFlowInterpreterException(Throwable e) {
+ super(e);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowExecutionMessage.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowExecutionMessage.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowExecutionMessage.java
new file mode 100644
index 0000000..193d87f
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowExecutionMessage.java
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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.airavata.workflow.engine.interpretor;
+
+public enum WorkflowExecutionMessage {
+ NODE_STATE_CHANGED,
+ //this.engine.getGUI().getGraphCanvas().repaint();
+ EXECUTION_STATE_CHANGED,
+ EXECUTION_RESUME,
+ EXECUTION_TASK_START,
+ EXECUTION_TASK_END,
+ EXECUTION_ERROR,
+ EXECUTION_CLEANUP,
+ OPEN_SUBWORKFLOW,
+ HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS,
+ INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW,
+ INPUT_GSS_CREDENTIAL,
+ INPUT_LEAD_CONTEXT_HEADER,
+ INPUT_GFAC_INVOKER,
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowExecutionTemplate.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowExecutionTemplate.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowExecutionTemplate.java
new file mode 100644
index 0000000..49af89b
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowExecutionTemplate.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * 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.airavata.workflow.engine.interpretor;
+
+import java.util.List;
+
+import org.apache.airavata.client.api.ExperimentAdvanceOptions;
+import org.apache.airavata.workflow.model.wf.WorkflowInput;
+
+public class WorkflowExecutionTemplate {
+ private String workflowTemplateName;
+ private List<WorkflowInput> input;
+ private ExperimentAdvanceOptions advanceOptions;
+ public String getWorkflowTemplateName() {
+ return workflowTemplateName;
+ }
+ public void setWorkflowTemplateName(String workflowTemplateName) {
+ this.workflowTemplateName = workflowTemplateName;
+ }
+ public List<WorkflowInput> getInput() {
+ return input;
+ }
+ public void setInput(List<WorkflowInput> input) {
+ this.input = input;
+ }
+ public ExperimentAdvanceOptions getAdvanceOptions() {
+ return advanceOptions;
+ }
+ public void setAdvanceOptions(ExperimentAdvanceOptions advanceOptions) {
+ this.advanceOptions = advanceOptions;
+ }
+}