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/12 04:34:39 UTC
[1/9] introducing workflow support in airavata api + other related
modules
Repository: airavata
Updated Branches:
refs/heads/workflow-support [created] 0095c9151
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentRegistry.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentRegistry.java
index db9f287..e9d4efd 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentRegistry.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentRegistry.java
@@ -30,7 +30,6 @@ import java.util.Map;
import org.apache.airavata.common.utils.WSDLUtil;
import org.apache.airavata.workflow.model.component.Component;
-import org.apache.airavata.workflow.model.component.ComponentException;
import org.apache.airavata.workflow.model.component.ComponentReference;
import org.apache.airavata.workflow.model.component.ComponentRegistry;
import org.apache.airavata.workflow.model.component.ComponentRegistryException;
@@ -71,8 +70,8 @@ public class WSComponentRegistry extends ComponentRegistry {
String name = urlString.substring(urlString.lastIndexOf('/') + 1);
treeLeaf = new URLComponentReference(name, components);
- } catch (ComponentException e) {
- e.printStackTrace();
+// } catch (ComponentException e) {
+// e.printStackTrace();
} catch (WsdlException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WorkflowComponent.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WorkflowComponent.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WorkflowComponent.java
index b4a1493..fd90c69 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WorkflowComponent.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WorkflowComponent.java
@@ -65,15 +65,14 @@ public class WorkflowComponent extends WSComponent {
* @throws ComponentException
*/
public WorkflowComponent(Workflow workflow) throws ComponentException {
- super(workflow.getWorkflowWSDL());
this.workflow = workflow;
this.templateID = this.workflow.getGPELTemplateID();
- // Add template ID to WSDL
- for (WsdlPortType portType : this.wsdl.portTypes()) {
- XmlElement templateIDElement = portType.xml().addElement(GPEL_NAMESPACE, WORKFLOW_TEMPLATE_ID_TAG);
- templateIDElement.setText(this.templateID.toString());
- }
+// // Add template ID to WSDL
+// for (WsdlPortType portType : this.wsdl.portTypes()) {
+// XmlElement templateIDElement = portType.xml().addElement(GPEL_NAMESPACE, WORKFLOW_TEMPLATE_ID_TAG);
+// templateIDElement.setText(this.templateID.toString());
+// }
}
/**
@@ -96,16 +95,16 @@ public class WorkflowComponent extends WSComponent {
* @throws ComponentException
*/
public WorkflowComponent(WsdlDefinitions wsdl, QName portTypeQName, String operationName) throws ComponentException {
- super(wsdl, portTypeQName, operationName);
- try {
- // Get template ID from WSDL
- WsdlPortType portType = this.wsdl.getPortType(portTypeQName.getLocalPart());
- XmlElement templateIDElement = portType.xml().element(GPEL_NAMESPACE, WORKFLOW_TEMPLATE_ID_TAG);
- String templateIDString = templateIDElement.requiredText();
- this.templateID = new URI(templateIDString);
- } catch (URISyntaxException e) {
- throw new ComponentException(e);
- }
+// super(wsdl, portTypeQName, operationName);
+// try {
+// // Get template ID from WSDL
+// WsdlPortType portType = this.wsdl.getPortType(portTypeQName.getLocalPart());
+// XmlElement templateIDElement = portType.xml().element(GPEL_NAMESPACE, WORKFLOW_TEMPLATE_ID_TAG);
+// String templateIDString = templateIDElement.requiredText();
+// this.templateID = new URI(templateIDString);
+// } catch (URISyntaxException e) {
+// throw new ComponentException(e);
+// }
}
/**
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/DSCUtil.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/DSCUtil.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/DSCUtil.java
index d4440d6..3ed669e 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/DSCUtil.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/DSCUtil.java
@@ -79,18 +79,18 @@ public class DSCUtil {
public static Map<String, WsdlDefinitions> createCWSDLs(Workflow workflow, URI dscURL) {
Map<String, WsdlDefinitions> WSDLMap = new HashMap<String, WsdlDefinitions>();
Graph graph = workflow.getGraph();
- for (WSNode node : GraphUtil.getWSNodes(graph)) {
- String partnerLinkName = BPELScript.createPartnerLinkName(node.getID());
- WsdlDefinitions wsdl = node.getComponent().getWSDL();
- if (WSDLUtil.isAWSDL(wsdl)) {
- try {
- wsdl = convertToCWSDL(WSDLUtil.deepClone(wsdl), dscURL);
- } catch (UtilsException e) {
- e.printStackTrace();
- }
- }
- WSDLMap.put(partnerLinkName, wsdl);
- }
+// for (WSNode node : GraphUtil.getWSNodes(graph)) {
+// String partnerLinkName = BPELScript.createPartnerLinkName(node.getID());
+// WsdlDefinitions wsdl = node.getComponent().getWSDL();
+// if (WSDLUtil.isAWSDL(wsdl)) {
+// try {
+// wsdl = convertToCWSDL(WSDLUtil.deepClone(wsdl), dscURL);
+// } catch (UtilsException e) {
+// e.printStackTrace();
+// }
+// }
+// WSDLMap.put(partnerLinkName, wsdl);
+// }
return WSDLMap;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/script/WorkflowWSDL.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/script/WorkflowWSDL.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/script/WorkflowWSDL.java
index 7c32a71..4fd30ad 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/script/WorkflowWSDL.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/gpel/script/WorkflowWSDL.java
@@ -417,8 +417,9 @@ public class WorkflowWSDL {
WSComponentPort componentPort = port.getWSComponentPort();
WsdlDefinitions wsdl = null;
if (componentPort != null) {
- wsdl = componentPort.getComponent().getWSDL();
- type = declareTypeIfNecessary(wsdl, type);
+ //FIXME
+// wsdl = componentPort.getComponent().getWSDL();
+// type = declareTypeIfNecessary(wsdl, type);
}
int arrayDimension = port.getArrayDimension();
if (arrayDimension == 1) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/util/GraphUtil.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/util/GraphUtil.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/util/GraphUtil.java
index 6db6efc..0dc3e2c 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/util/GraphUtil.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/util/GraphUtil.java
@@ -106,7 +106,9 @@ public class GraphUtil {
List<N> nodes = new LinkedList<N>();
for (Node node : graph.getNodes()) {
if (klass.isInstance(node)) {
- nodes.add((N) node);
+ if (!nodes.contains(node)) {
+ nodes.add((N) node);
+ }
}
}
return nodes;
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java
index 88c469a..00ded8f 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/graph/ws/WSNode.java
@@ -23,9 +23,7 @@ package org.apache.airavata.workflow.model.graph.ws;
import javax.xml.namespace.QName;
-import org.apache.airavata.workflow.model.component.ComponentException;
import org.apache.airavata.workflow.model.component.ws.WSComponent;
-import org.apache.airavata.workflow.model.component.ws.WSComponentFactory;
import org.apache.airavata.workflow.model.graph.Edge;
import org.apache.airavata.workflow.model.graph.ForEachExecutableNode;
import org.apache.airavata.workflow.model.graph.Graph;
@@ -33,7 +31,6 @@ import org.apache.airavata.workflow.model.graph.GraphException;
import org.apache.airavata.workflow.model.graph.GraphSchema;
import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
import org.apache.airavata.workflow.model.graph.util.GraphUtil;
-import org.apache.airavata.workflow.model.utils.MessageConstants;
import org.xmlpull.infoset.XmlElement;
public class WSNode extends NodeImpl implements ForEachExecutableNode{
@@ -172,16 +169,5 @@ public class WSNode extends NodeImpl implements ForEachExecutableNode{
this.operationName = operationElement.requiredText();
}
}
-
- @Override
- @Deprecated
- protected void parseComponent(XmlElement componentElement) throws GraphException {
- try {
- String componentString = componentElement.requiredText();
- WSComponent wsdlComponent = WSComponentFactory.createComponent(componentString);
- setComponent(wsdlComponent);
- } catch (ComponentException e) {
- throw new GraphException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
- }
- }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
index d708611..22bb29d 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
@@ -38,7 +38,6 @@ import javax.imageio.ImageIO;
import javax.xml.namespace.QName;
import org.apache.airavata.common.exception.UtilsException;
-import org.apache.airavata.common.utils.StringUtil;
import org.apache.airavata.common.utils.WSDLUtil;
import org.apache.airavata.common.utils.XMLUtil;
import org.apache.airavata.workflow.model.component.Component;
@@ -56,6 +55,7 @@ import org.apache.airavata.workflow.model.graph.GraphSchema;
import org.apache.airavata.workflow.model.graph.Node;
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.system.OutputNode;
import org.apache.airavata.workflow.model.graph.util.GraphUtil;
import org.apache.airavata.workflow.model.graph.ws.WSGraph;
import org.apache.airavata.workflow.model.graph.ws.WSGraphFactory;
@@ -398,27 +398,27 @@ public class Workflow implements Cloneable {
public Map<String, WsdlDefinitions> getWSDLs() {
Map<String, WsdlDefinitions> wsdls = new LinkedHashMap<String, WsdlDefinitions>();
- Map<WsdlDefinitions, String> ids = new HashMap<WsdlDefinitions, String>();
- // Use LinkedHashMap to preserve the order of WSDLs, which is useful for
- // some unit tests.
-
- for (WSNode node : GraphUtil.getNodes(this.graph, WSNode.class)) {
- WsdlDefinitions wsdl = node.getComponent().getWSDL();
- if (wsdls.containsValue(wsdl)) {
- String id = ids.get(wsdl);
- node.setWSDLID(id);
- } else {
- // Assign unique key
- String name = WSDLUtil.getWSDLName(wsdl);
- String id = StringUtil.convertToJavaIdentifier(name);
- while (wsdls.containsKey(id)) {
- id = StringUtil.incrementName(id);
- }
- wsdls.put(id, wsdl);
- ids.put(wsdl, id);
- node.setWSDLID(id);
- }
- }
+// Map<WsdlDefinitions, String> ids = new HashMap<WsdlDefinitions, String>();
+// // Use LinkedHashMap to preserve the order of WSDLs, which is useful for
+// // some unit tests.
+//
+// for (WSNode node : GraphUtil.getNodes(this.graph, WSNode.class)) {
+// WsdlDefinitions wsdl = node.getComponent().getWSDL();
+// if (wsdls.containsValue(wsdl)) {
+// String id = ids.get(wsdl);
+// node.setWSDLID(id);
+// } else {
+// // Assign unique key
+// String name = WSDLUtil.getWSDLName(wsdl);
+// String id = StringUtil.convertToJavaIdentifier(name);
+// while (wsdls.containsKey(id)) {
+// id = StringUtil.incrementName(id);
+// }
+// wsdls.put(id, wsdl);
+// ids.put(wsdl, id);
+// node.setWSDLID(id);
+// }
+// }
return wsdls;
}
@@ -474,15 +474,12 @@ public class Workflow implements Cloneable {
* @throws ComponentException
*/
public List<WSComponentPort> getInputs() throws ComponentException {
- if (this.workflowWSDL == null) {
- try {
- this.createScript();
- } catch (GraphException e) {
- throw new IllegalStateException(e.getMessage());
- }
- }
- WSComponent component = WSComponentFactory.createComponent(this.workflowWSDL);
- return component.getInputPorts();
+ List<InputNode> nodes = GraphUtil.getNodes(this.graph, InputNode.class);
+ List<WSComponentPort> ports = new ArrayList<WSComponentPort>();
+ for (InputNode inputNode : nodes) {
+ ports.add(new WSComponentPort(inputNode.getName(), inputNode.getOutputPorts().get(0).getType(), null));
+ }
+ return ports;
}
public List<WorkflowInput> getWorkflowInputs() throws Exception{
@@ -501,11 +498,12 @@ public class Workflow implements Cloneable {
* @throws ComponentException
*/
public List<WSComponentPort> getOutputs() throws ComponentException {
- if (this.workflowWSDL == null) {
- throw new IllegalStateException();
- }
- WSComponent component = WSComponentFactory.createComponent(this.workflowWSDL);
- return component.getOutputPorts();
+ List<OutputNode> nodes = GraphUtil.getNodes(this.graph, OutputNode.class);
+ List<WSComponentPort> ports = new ArrayList<WSComponentPort>();
+ for (OutputNode outputNode : nodes) {
+ ports.add(new WSComponentPort(outputNode.getName(), outputNode.getOutputPorts().get(0).getType(), null));
+ }
+ return ports;
}
/**
@@ -529,7 +527,8 @@ public class Workflow implements Cloneable {
*/
public XmlElement toXML() {
// This must be before graph.toXML() to set WSDL ID to each node.
- Map<String, WsdlDefinitions> wsdls = getWSDLs();
+ //FIXME
+// Map<String, WsdlDefinitions> wsdls = getWSDLs();
XmlElement workflowElement = XMLUtil.BUILDER.newFragment(NS_XWF, WORKFLOW_TAG);
@@ -547,12 +546,12 @@ public class Workflow implements Cloneable {
// WSDLs
XmlElement wsdlsElement = workflowElement.addElement(NS_XWF, WSDLS_TAG);
- for (String id : wsdls.keySet()) {
- WsdlDefinitions wsdl = wsdls.get(id);
- XmlElement wsdlElement = wsdlsElement.addElement(NS_XWF, WSDL_TAG);
- wsdlElement.setAttributeValue(NS_XWF, ID_ATTRIBUTE, id);
- wsdlElement.setText(XMLUtil.xmlElementToString(wsdl.xml()));
- }
+// for (String id : wsdls.keySet()) {
+// WsdlDefinitions wsdl = wsdls.get(id);
+// XmlElement wsdlElement = wsdlsElement.addElement(NS_XWF, WSDL_TAG);
+// wsdlElement.setAttributeValue(NS_XWF, ID_ATTRIBUTE, id);
+// wsdlElement.setText(XMLUtil.xmlElementToString(wsdl.xml()));
+// }
// Image
if (this.image != null) {
@@ -631,11 +630,12 @@ public class Workflow implements Cloneable {
}
WSComponentKey key = new WSComponentKey(id, portType, operation);
- WSComponent component;
+ WSComponent component = null;
if (components.containsKey(key)) {
component = components.get(key);
} else {
- component = WSComponentFactory.createComponent(wsdl, portType, operation);
+ //FIXME
+// component = WSComponentFactory.createComponent(wsdl, portType, operation);
components.put(key, component);
}
node.setComponent(component);
@@ -935,7 +935,6 @@ public class Workflow implements Cloneable {
return editable;
}
-
public void setEditable(boolean editable) {
this.editable = editable;
getGraph().setEditable(isEditable());
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/xbaya-gui/pom.xml
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/pom.xml b/modules/xbaya-gui/pom.xml
index f4e4030..e359c74 100644
--- a/modules/xbaya-gui/pom.xml
+++ b/modules/xbaya-gui/pom.xml
@@ -211,6 +211,11 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-engine</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
<artifactId>airavata-common-utils</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
index 2e1d7de..1ae1131 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
@@ -74,7 +74,7 @@ public class RegistryWindow {
private ThriftServiceType serviceType;
- private DefaultComboBoxModel<ThriftServiceType> serviceTypeModel;
+ private DefaultComboBoxModel serviceTypeModel;
/**
* @param engine
@@ -141,7 +141,7 @@ public class RegistryWindow {
XBayaLabel serverPortLabel = new XBayaLabel("Server Port", this.portTextField);
XBayaLabel gatewayNameLabel = new XBayaLabel("Gateway Name", this.gatewayNameTextField);
XBayaLabel gatewayUserLabel = new XBayaLabel("Gateway TUser", this.usernameTextField);
- serviceTypeModel = new DefaultComboBoxModel<ThriftServiceType>(ThriftServiceType.values());
+ serviceTypeModel = new DefaultComboBoxModel(ThriftServiceType.values());
serviceTypeModel.setSelectedItem(ThriftServiceType.API_SERVICE);
this.serviceTypeCombo = new XBayaComboBox(serviceTypeModel);
JLabel serviceTypeLabel = new JLabel("Airavata Service");
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
index e4bef63..2671d30 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
@@ -29,6 +29,11 @@ import java.util.List;
import java.util.UUID;
//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+
+
+
+
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JButton;
@@ -38,8 +43,18 @@ import javax.swing.JPanel;
import javax.swing.border.EtchedBorder;
import javax.xml.namespace.QName;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.common.utils.StringUtil;
import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.model.workspace.experiment.DataObjectType;
+import org.apache.airavata.model.workspace.experiment.DataType;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.orchestrator.client.OrchestratorClientFactory;
+import org.apache.airavata.orchestrator.cpi.OrchestratorService;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.workflow.engine.interpretor.WorkflowInterpreter;
+import org.apache.airavata.workflow.engine.interpretor.WorkflowInterpreterConfiguration;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
import org.apache.airavata.workflow.model.graph.system.InputNode;
import org.apache.airavata.workflow.model.graph.util.GraphUtil;
import org.apache.airavata.workflow.model.graph.ws.WSNode;
@@ -55,7 +70,6 @@ import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
import org.apache.airavata.xbaya.ui.widgets.GridPanel;
import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
-import org.apache.airavata.xbaya.util.XBayaUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmlpull.infoset.XmlElement;
@@ -276,14 +290,26 @@ public class WorkflowInterpreterLaunchWindow {
final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
builder.newFragment("inputs");
new ODEClient();
+ final Experiment experiment = new Experiment();
+ experiment.setApplicationId(workflow.getName());
+ experiment.setExperimentID("some-id");
+ experiment.setProjectID("prj1");
+ experiment.setName("some-exp");
+ experiment.setUserName("me");
for (int i = 0; i < inputNodes.size(); i++) {
InputNode inputNode = inputNodes.get(i);
XBayaTextField parameterTextField = this.parameterTextFields.get(i);
inputNode.getID();
String value = parameterTextField.getText();
- inputNode.setDefaultValue(value);
+// inputNode.setDefaultValue(value);
+ DataObjectType elem = new DataObjectType();
+ elem.setKey(inputNode.getID());
+ elem.setType(DataType.STRING);
+ elem.setValue(value);
+ experiment.addToExperimentInputs(elem );
}
-
+
+
// final String workflowInterpreterUrl = this.workflowInterpreterTextField.getText();
// if (null != workflowInterpreterUrl && !"".equals(workflowInterpreterUrl)) {
// try {
@@ -306,7 +332,15 @@ public class WorkflowInterpreterLaunchWindow {
new Thread() {
@Override
public void run() {
-
+ WorkflowInterpreter workflowInterpreter = new WorkflowInterpreter(experiment, null, new WorkflowInterpreterConfiguration(workflow),getOrchestratorClient());
+ try {
+ workflowInterpreter.scheduleDynamically();
+ } catch (WorkflowException e) {
+ e.printStackTrace();
+ } catch (RegistryException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
// try {
// List<WorkflowInput> workflowInputs=new ArrayList<WorkflowInput>();
// for (int i = 0; i < inputNodes.size(); i++) {
@@ -342,4 +376,10 @@ public class WorkflowInterpreterLaunchWindow {
hide();
}
+
+ private OrchestratorService.Client getOrchestratorClient() {
+ final int serverPort = Integer.parseInt(ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ORCHESTRATOR_SERVER_PORT,"8940"));
+ final String serverHost = ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ORCHESTRATOR_SERVER_HOST, null);
+ return OrchestratorClientFactory.createOrchestratorClient(serverHost, serverPort);
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 80e75b1..b78a396 100644
--- a/pom.xml
+++ b/pom.xml
@@ -508,6 +508,7 @@
<module>modules/distribution</module>
<module>modules/ws-messenger</module>
<module>modules/integration-tests</module>
+ <module>modules/xbaya-gui</module>
</modules>
</profile>
<profile>
[4/9] introducing workflow support in airavata api + other related
modules
Posted by sa...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/InterpreterUtil.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/InterpreterUtil.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/InterpreterUtil.java
new file mode 100644
index 0000000..38c4f6a
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/InterpreterUtil.java
@@ -0,0 +1,308 @@
+/*
+ *
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException;
+import org.apache.airavata.workflow.engine.invoker.Invoker;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+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.amazon.InstanceNode;
+import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
+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.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.ForEachNode;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.graph.system.SystemDataPort;
+import org.apache.airavata.workflow.model.graph.ws.WSGraph;
+import org.apache.airavata.workflow.model.graph.ws.WSPort;
+import org.xmlpull.infoset.XmlElement;
+
+import xsul5.XmlConstants;
+//import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler;
+//import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler.NodeState;
+
+public class InterpreterUtil {
+ /**
+ * This method returns the input values for given foreach node
+ *
+ * @param forEachNode
+ * @param listOfValues
+ * @param invokerMap
+ * @return
+ * @throws WorkflowException
+ */
+ public static Object getInputsForForEachNode(final ForEachNode forEachNode, final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap)
+ throws WorkflowException {
+ List<DataPort> inputPorts = forEachNode.getInputPorts();
+
+ Object returnValForProvenance = null;
+ for (DataPort inputPort : inputPorts) {
+
+ Node inputNode = inputPort.getFromNode();
+ // if input node for for-each is WSNode
+ if (inputNode instanceof InputNode) {
+// for (DataPort dataPort : forEachNode.getInputPorts()) {
+ returnValForProvenance = InterpreterUtil.findInputFromPort(inputPort, invokerMap);
+ if (null == returnValForProvenance) {
+ throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
+ }
+ String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
+ listOfValues.addAll(Arrays.asList(vals));
+// }
+ }
+ }
+ return returnValForProvenance;
+ }
+
+ /**
+ *
+ * @param inputPort
+ * @param invokerMap
+ * @return
+ * @throws WorkflowException
+ */
+ public static Object findInputFromPort(DataPort inputPort, Map<Node, Invoker> invokerMap) throws WorkflowException {
+ Object outputVal = null;
+ Node fromNode = inputPort.getFromNode();
+ if (fromNode instanceof InputNode) {
+ outputVal = ((InputNode) fromNode).getDefaultValue();
+ } else if (fromNode instanceof ConstantNode) {
+ outputVal = ((ConstantNode) fromNode).getValue();
+ } else if (fromNode instanceof DifferedInputNode && ((DifferedInputNode) fromNode).isConfigured()) {
+ outputVal = ((DifferedInputNode) fromNode).getDefaultValue();
+ } else if (fromNode instanceof EndifNode || fromNode instanceof DoWhileNode || fromNode instanceof EndDoWhileNode) {
+ Invoker fromInvoker = invokerMap.get(fromNode);
+ outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
+ } else if (fromNode instanceof InstanceNode) {
+ return ((InstanceNode) fromNode).getOutputInstanceId();
+ } else if (fromNode instanceof EndForEachNode) {
+ outputVal = "";
+ Invoker workflowInvoker = invokerMap.get(fromNode);
+ String outputName = "";
+ if (inputPort instanceof SystemDataPort) {
+ outputName = ((SystemDataPort) inputPort).getWSComponentPort().getName();
+
+ } else if (inputPort instanceof WSPort) {
+ outputName = ((SystemDataPort) fromNode.getInputPort(fromNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort())))
+ .getWSComponentPort().getName();
+ }
+ XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + workflowInvoker.getOutput(outputName) + "</temp>");
+ Iterator valItr = msgElmt.children().iterator();
+ while (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof XmlElement) {
+
+ if (((XmlElement) object2).children().iterator().hasNext()) {
+ outputVal = outputVal + StringUtil.DELIMETER + StringUtil.quoteString(((XmlElement) object2).children().iterator().next().toString());
+ }
+ }
+ }
+
+ if (((String) outputVal).length() == 0) {
+ throw new WorkflowException("Empty Output Generated");
+ }
+ outputVal = ((String) outputVal).substring(1, ((String) outputVal).length());
+ } else {
+ Invoker fromInvoker = invokerMap.get(fromNode);
+ try {
+ if (fromInvoker != null)
+ outputVal = fromInvoker.getOutput(inputPort.getFromPort().getName());
+
+ } catch (Exception e) {
+ // if the value is still null look it up from the inputport name
+ // because the value is set to the input port name at some point
+ // there is no harm in doing this
+ if (null == outputVal) {
+ outputVal = fromInvoker.getOutput(inputPort.getName());
+ }
+ }
+
+ }
+ return outputVal;
+
+ }
+
+ public static Object findInputFromPort(DataPort inputPort) throws WorkflowException {
+ Object outputVal = null;
+ Node fromNode = inputPort.getFromNode();
+ if (fromNode instanceof InputNode) {
+ outputVal = ((InputNode) fromNode).getDefaultValue();
+// } else if (fromNode instanceof ConstantNode) {
+// outputVal = ((ConstantNode) fromNode).getValue();
+// } else if (fromNode instanceof DifferedInputNode && ((DifferedInputNode) fromNode).isConfigured()) {
+// outputVal = ((DifferedInputNode) fromNode).getDefaultValue();
+// } else if (fromNode instanceof EndifNode || fromNode instanceof DoWhileNode || fromNode instanceof EndDoWhileNode) {
+// Invoker fromInvoker = invokerMap.get(fromNode);
+// outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
+// } else if (fromNode instanceof InstanceNode) {
+// return ((InstanceNode) fromNode).getOutputInstanceId();
+// } else if (fromNode instanceof EndForEachNode) {
+// outputVal = "";
+// Invoker workflowInvoker = invokerMap.get(fromNode);
+// String outputName = "";
+// if (inputPort instanceof SystemDataPort) {
+// outputName = ((SystemDataPort) inputPort).getWSComponentPort().getName();
+//
+// } else if (inputPort instanceof WSPort) {
+// outputName = ((SystemDataPort) fromNode.getInputPort(fromNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort())))
+// .getWSComponentPort().getName();
+// }
+// XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + workflowInvoker.getOutput(outputName) + "</temp>");
+// Iterator valItr = msgElmt.children().iterator();
+// while (valItr.hasNext()) {
+// Object object2 = valItr.next();
+// if (object2 instanceof XmlElement) {
+//
+// if (((XmlElement) object2).children().iterator().hasNext()) {
+// outputVal = outputVal + StringUtil.DELIMETER + StringUtil.quoteString(((XmlElement) object2).children().iterator().next().toString());
+// }
+// }
+// }
+//
+// if (((String) outputVal).length() == 0) {
+// throw new WorkflowException("Empty Output Generated");
+// }
+// outputVal = ((String) outputVal).substring(1, ((String) outputVal).length());
+// } else {
+// Invoker fromInvoker = invokerMap.get(fromNode);
+// try {
+// if (fromInvoker != null)
+// outputVal = fromInvoker.getOutput(inputPort.getFromPort().getName());
+//
+// } catch (Exception e) {
+// // if the value is still null look it up from the inputport name
+// // because the value is set to the input port name at some point
+// // there is no harm in doing this
+// if (null == outputVal) {
+// outputVal = fromInvoker.getOutput(inputPort.getName());
+// }
+// }
+
+ }
+ return outputVal;
+
+ }
+ /**
+ * @param node
+ * @return
+ */
+ public static Node findEndForEachFor(ForEachNode node) {
+
+ Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
+ if (toNodes.size() != 1) {
+ throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
+ }
+ Node middleNode = toNodes.iterator().next();
+ List<DataPort> outputPorts = middleNode.getOutputPorts();
+ for (DataPort dataPort : outputPorts) {
+ if (dataPort.getToNodes().size() == 1) {
+ Node possibleEndForEachNode = dataPort.getToNodes().get(0);
+ if (possibleEndForEachNode instanceof EndForEachNode) {
+ return possibleEndForEachNode;
+ }
+ }
+ }
+ throw new WorkflowRuntimeException("EndForEachNode not found");
+ }
+
+ public static Integer[] getNumberOfInputsForForEachNode(final ForEachNode forEachNode, Map<Node, Invoker> invokerMap) throws WorkflowException {
+ List<DataPort> inputPorts = forEachNode.getInputPorts();
+ Integer[] inputNumbers = new Integer[inputPorts.size()];
+ for (DataPort forEachInputPort : inputPorts) {
+ // if input node for for-each is WSNode
+ Node forEachInputNode = forEachInputPort.getFromNode();
+ int index = 0;
+ Object returnValForProvenance = null;
+ if (forEachInputNode instanceof InputNode) {
+ returnValForProvenance = InterpreterUtil.findInputFromPort(forEachInputPort, invokerMap);
+ if (null == returnValForProvenance) {
+ throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
+ }
+ String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
+ inputNumbers[inputPorts.indexOf(forEachInputPort)] = vals.length;
+ }
+ }
+ return inputNumbers;
+ }
+
+ public static ArrayList<Node> getFinishedNodesDynamically(WSGraph graph) {
+ return getNodesWithBodyColor(NodeExecutionState.FINISHED, graph);
+ }
+
+ public static ArrayList<Node> getFailedNodesDynamically(WSGraph graph) {
+ return getNodesWithBodyColor(NodeExecutionState.FAILED, graph);
+ }
+
+ public static ArrayList<Node> getWaitingNodesDynamically(WSGraph graph) {
+ return getNodesWithBodyColor(NodeExecutionState.WAITING, graph);
+ }
+
+ public static ArrayList<Node> getNodesWithBodyColor(NodeExecutionState state, WSGraph graph) {
+ ArrayList<Node> list = new ArrayList<Node>();
+ List<NodeImpl> nodes = graph.getNodes();
+ for (Node node : nodes) {
+ if (node.getState()==state) {
+ list.add(node);
+ }
+ }
+ return list;
+ }
+
+ public static int getRunningNodeCountDynamically(WSGraph graph) {
+ return getNodeCountWithBodyColor(NodeExecutionState.EXECUTING, graph);
+ }
+
+ public static int getFailedNodeCountDynamically(WSGraph graph) {
+ return getFailedNodesDynamically(graph).size();
+ }
+
+ public static int getWaitingNodeCountDynamically(WSGraph graph) {
+ return getNodeCountWithBodyColor(NodeExecutionState.WAITING, graph);
+ }
+
+ public static int getNodeCountWithBodyColor(NodeExecutionState state, WSGraph graph) {
+ int sum = 0;
+ List<NodeImpl> nodes = graph.getNodes();
+ for (Node node : nodes) {
+ if (node.getState()==state) {
+ ++sum;
+ }
+ }
+ return sum;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/RegistryConstants.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/RegistryConstants.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/RegistryConstants.java
new file mode 100644
index 0000000..51db345
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/RegistryConstants.java
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.util;
+
+public class RegistryConstants {
+ public static final String REGISTRY_TYPE_JCR="registry.type.jcr";
+ public static final String REGISTRY_TYPE_LOCAL="registry.type.local";
+ public static final String REGISTRY_TYPE_URL="registry.type.url";
+ public static final String REGISTRY_TYPE_GPEL="registry.type.gpel";
+ public static final String REGISTRY_TYPE_WEB="registry.type.web";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/TransferFile.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/TransferFile.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/TransferFile.java
new file mode 100644
index 0000000..a63884d
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/TransferFile.java
@@ -0,0 +1,170 @@
+/*
+ *
+ * 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.util;
+
+
+public class TransferFile {
+ private String submission_id;
+ private boolean preserve_timestamp;
+ private String DATA_TYPE;
+ private boolean encrypt_data;
+ private String sync_level;
+ private String source_endpoint;
+ private String label;
+ private String destination_endpoint;
+ private int length;
+ private String deadline;
+ private boolean notify_on_succeeded;
+ private boolean notify_on_failed;
+ private boolean verify_checksum;
+ private boolean notify_on_inactive;
+ private boolean delete_destination_extra;
+ private Data[] DATA;
+
+ public String getSubmission_id() {
+ return submission_id;
+ }
+
+ public void setSubmission_id(String submission_id) {
+ this.submission_id = submission_id;
+ }
+
+ public boolean getPreserve_timestamp() {
+ return preserve_timestamp;
+ }
+
+ public void setPreserve_timestamp(boolean preserve_timestamp) {
+ this.preserve_timestamp = preserve_timestamp;
+ }
+
+ public String getDATA_TYPE() {
+ return DATA_TYPE;
+ }
+
+ public void setDATA_TYPE(String DATA_TYPE) {
+ this.DATA_TYPE = DATA_TYPE;
+ }
+
+ public boolean getEncrypt_data() {
+ return encrypt_data;
+ }
+
+ public void setEncrypt_data(boolean encrypt_data) {
+ this.encrypt_data = encrypt_data;
+ }
+
+ public String getSync_level() {
+ return sync_level;
+ }
+
+ public void setSync_level(String sync_level) {
+ this.sync_level = sync_level;
+ }
+
+ public String getSource_endpoint() {
+ return source_endpoint;
+ }
+
+ public void setSource_endpoint(String source_endpoint) {
+ this.source_endpoint = source_endpoint;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDestination_endpoint() {
+ return destination_endpoint;
+ }
+
+ public void setDestination_endpoint(String destination_endpoint) {
+ this.destination_endpoint = destination_endpoint;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ public String getDeadline() {
+ return deadline;
+ }
+
+ public void setDeadline(String deadline) {
+ this.deadline = deadline;
+ }
+
+ public boolean getNotify_on_succeeded() {
+ return notify_on_succeeded;
+ }
+
+ public void setNotify_on_succeeded(boolean notify_on_succeeded) {
+ this.notify_on_succeeded = notify_on_succeeded;
+ }
+
+ public boolean getNotify_on_failed() {
+ return notify_on_failed;
+ }
+
+ public void setNotify_on_failed(boolean notify_on_failed) {
+ this.notify_on_failed = notify_on_failed;
+ }
+
+ public boolean getVerify_checksum() {
+ return verify_checksum;
+ }
+
+ public void setVerify_checksum(boolean verify_checksum) {
+ this.verify_checksum = verify_checksum;
+ }
+
+ public boolean getNotify_on_inactive() {
+ return notify_on_inactive;
+ }
+
+ public void setNotify_on_inactive(boolean notify_on_inactive) {
+ this.notify_on_inactive = notify_on_inactive;
+ }
+
+ public boolean getDelete_destination_extra() {
+ return delete_destination_extra;
+ }
+
+ public void setDelete_destination_extra(boolean delete_destination_extra) {
+ this.delete_destination_extra = delete_destination_extra;
+ }
+
+ public Data[] getDATA() {
+ return DATA;
+ }
+
+ public void setDATA(Data[] DATA) {
+ this.DATA = DATA;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/XBayaUtil.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/XBayaUtil.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/XBayaUtil.java
new file mode 100644
index 0000000..9735c52
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/XBayaUtil.java
@@ -0,0 +1,218 @@
+/*
+ *
+ * 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.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.SocketTimeoutException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.airavata.client.stub.interpretor.NameValue;
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.workflow.engine.interpretor.WorkFlowInterpreterException;
+import org.apache.airavata.workflow.engine.invoker.Invoker;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.workflow.model.graph.DataPort;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.amazon.InstanceNode;
+import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+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.ForEachNode;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.axis2.util.XMLUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.xmlpull.infoset.XmlElement;
+
+import xsul5.XmlConstants;
+
+public class XBayaUtil {
+
+ private static final Logger logger = LoggerFactory.getLogger(XBayaUtil.class);
+ public static final String JCR_USER = "jcr.username";
+ public static final String JCR_PASS = "jcr.password";
+ public static final String JCR_URL = "jcr.url";
+
+
+ public static boolean isURLExists(String URLName) {
+ try {
+ if (!URLName.toUpperCase().contains("HTTP"))
+ URLName = "http://" + URLName;
+ URL url = new URL(URLName);
+ System.setProperty("java.net.useSystemProxies", "true");
+ HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
+ urlConn.setConnectTimeout(9000);
+ urlConn.setReadTimeout(9000);
+ urlConn.connect();
+ if (HttpURLConnection.HTTP_OK == urlConn.getResponseCode())
+ return true;
+ else
+ return false;
+ } catch (SocketTimeoutException e) {
+ return false;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ public static Object getInputsForForEachNode(final ForEachNode forEachNode,
+ final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap) throws WorkflowException {
+ Node forEachInputNode = forEachNode.getInputPort(0).getFromNode();
+ // if input node for for-each is WSNode
+ Object returnValForProvenance = null;
+ if (forEachInputNode instanceof InputNode) {
+ for (DataPort dataPort : forEachNode.getInputPorts()) {
+ returnValForProvenance = XBayaUtil
+ .findInputFromPort(dataPort, invokerMap);
+ if (null == returnValForProvenance) {
+ throw new WorkFlowInterpreterException(
+ "Unable to find input for the node:"
+ + forEachNode.getID());
+ }
+ String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
+ listOfValues.addAll(Arrays.asList(vals));
+ }
+ }
+ return returnValForProvenance;
+ }
+
+ /**
+ *
+ * @param inputPort
+ * @param invokerMap
+ * @return
+ * @throws WorkflowException
+ */
+ public static Object findInputFromPort(DataPort inputPort, Map<Node, Invoker> invokerMap) throws WorkflowException {
+ Object outputVal = null;
+ Node fromNode = inputPort.getFromNode();
+ if (fromNode instanceof InputNode) {
+ outputVal = ((InputNode) fromNode).getDefaultValue();
+ } else if (fromNode instanceof ConstantNode) {
+ outputVal = ((ConstantNode) fromNode).getValue();
+ } else if (fromNode instanceof EndifNode) {
+ Invoker fromInvoker = invokerMap.get(fromNode);
+ outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
+ } else if (fromNode instanceof InstanceNode) {
+ return ((InstanceNode) fromNode).getOutputInstanceId();
+ } else if (fromNode instanceof EndForEachNode) {
+ outputVal = "";
+ Invoker workflowInvoker = invokerMap.get(fromNode);
+ String outputName = fromNode.getOutputPort(0).getName();
+ XmlElement msgElmt = XmlConstants.BUILDER
+ .parseFragmentFromString("<temp>"
+ + workflowInvoker.getOutput(outputName) + "</temp>");
+ Iterator valItr = msgElmt.children().iterator();
+ while (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof XmlElement) {
+ outputVal = outputVal
+ + StringUtil.DELIMETER
+ + StringUtil.quoteString(((XmlElement) object2).children().iterator()
+ .next().toString());
+ }
+ }
+ outputVal = ((String) outputVal).substring(1,
+ ((String) outputVal).length());
+ } else {
+ Invoker fromInvoker = invokerMap.get(fromNode);
+ try {
+ if (fromInvoker != null)
+ outputVal = fromInvoker.getOutput(inputPort.getFromPort()
+ .getName());
+
+ } catch (Exception e) {
+ // if the value is still null look it up from the inputport name
+ // because the value is set to the input port name at some point
+ // there is no harm in doing this
+ if (null == outputVal) {
+ outputVal = fromInvoker.getOutput(inputPort.getName());
+ }
+ }
+
+ }
+ return outputVal;
+
+ }
+
+ /**
+ * @param node
+ * @return
+ */
+ public static Node findEndForEachFor(ForEachNode node) {
+
+ Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
+ if(toNodes.size() != 1){
+ throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
+ }
+ Node middleNode = toNodes.iterator().next();
+ List<DataPort> outputPorts = middleNode.getOutputPorts();
+ for (DataPort dataPort : outputPorts) {
+ if(dataPort.getToNodes().size() == 1){
+ Node possibleEndForEachNode = dataPort.getToNodes().get(0);
+ if(possibleEndForEachNode instanceof EndForEachNode){
+ return possibleEndForEachNode;
+ }
+ }
+ }
+ throw new WorkflowRuntimeException("EndForEachNode not found");
+ }
+
+
+ public static List<NameValue> getIOParameterData(String xml) throws ParserConfigurationException, SAXException, IOException{
+ List<NameValue> parameters=new ArrayList<NameValue>();
+ Document parameterDocument = XMLUtils.newDocument(new ByteArrayInputStream(xml.getBytes()));
+ org.w3c.dom.NodeList childNodes = parameterDocument.getDocumentElement().getChildNodes();
+ for(int i=0;i<childNodes.getLength();i++){
+ org.w3c.dom.Node parameterNode = childNodes.item(i);
+ NameValue pair = new NameValue();
+ pair.setName(parameterNode.getLocalName());
+ pair.setValue(parameterNode.getTextContent());
+ parameters.add(pair);
+ }
+ return parameters;
+ }
+
+// public static AiravataRegistry2 getRegistry(URL url) throws IOException, RepositoryException, URISyntaxException {
+// Properties properties = new Properties();
+// properties.load(url.openStream());
+// JCRComponentRegistry jcrComponentRegistry = new JCRComponentRegistry(new URI((String) properties.get(JCR_URL)),
+// (String) properties.get(JCR_USER),(String) properties.get(JCR_PASS));
+// return jcrComponentRegistry.getRegistry();
+// }
+
+}
\ 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/workflow/WorkflowEngineException.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/WorkflowEngineException.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/WorkflowEngineException.java
new file mode 100644
index 0000000..46f5fe8
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/WorkflowEngineException.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.workflow;
+
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+
+public class WorkflowEngineException extends WorkflowException {
+ public WorkflowEngineException() {
+ super(); // To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public WorkflowEngineException(String message) {
+ super(message); // To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public WorkflowEngineException(Throwable cause) {
+ super(cause); // To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public WorkflowEngineException(String message, Throwable cause) {
+ super(message, cause); // To change body of overridden methods use File | Settings | File Templates.
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/ProxyWSDL.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/ProxyWSDL.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/ProxyWSDL.java
new file mode 100644
index 0000000..f9ad6a9
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/ProxyWSDL.java
@@ -0,0 +1,87 @@
+/*
+ *
+ * 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.workflow.proxy;
+
+public class ProxyWSDL {
+ // FIXME Remove this once the duel network problem is solved
+ public static String WSDL = "<wsdl:definitions targetNamespace='http://extreme.indiana.edu/weps' "
+ + "xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' "
+ + "xmlns:tns='http://extreme.indiana.edu/weps' xmlns:http='http://schemas.xmlsoap.org/wsdl/http/' "
+ + "xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' "
+ + "xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/'> " + "<wsdl:types> "
+ + "<xs:schema elementFormDefault='qualified' " + "targetNamespace='http://extreme.indiana.edu/weps'> "
+ + "<xs:element name='DeploymentInformation'> " + "<xs:complexType> " + "<xs:sequence> "
+ + "<xs:element name='ProcessName' type='xs:string' /> "
+ + "<xs:element maxOccurs='1' minOccurs='0' name='TemplateId' " + "type='xs:string' /> "
+ + "<xs:element name='DeploymentDocuments' type='tns:DeploymentDocumentsType'> " +
+
+ "</xs:element> " + "</xs:sequence> " + "</xs:complexType> " + "</xs:element> "
+ + "<xs:complexType name='DeploymentDocumentsType'> " + "<xs:sequence> "
+ + "<xs:element name='BPEL' type='xs:anyType' /> "
+ + "<xs:element name='DeploymentDescriptor' type='xs:anyType' /> "
+ + "<xs:element name='ProcessWSDL' type='tns:XMLFile' /> " +
+
+ "<xs:element maxOccurs='unbounded' minOccurs='1' " + "name='ServiceWSDLs' type='tns:XMLFile' /> "
+ + "<xs:element maxOccurs='unbounded' minOccurs='0' name='Other' " + "type='xs:anyType' /> "
+ + "</xs:sequence> " + "</xs:complexType> " + "<xs:complexType name='XMLFile'> " + "<xs:sequence> "
+ + "<xs:element name='FileName' type='xs:string' /> " + "<xs:element name='Content' type='xs:anyType'> "
+ + "</xs:element> " +
+
+ "</xs:sequence> " + "</xs:complexType> " + "<xs:element name='Result' type='xs:string' /> "
+ + "<xs:element name='ProcessName' type='xs:string' /> " + "<xs:element name='CreateInstanceResponse'> "
+ + "<xs:complexType> " + "<xs:sequence> " + "<xs:element name='ProcessName' type='xs:string' /> "
+ + "<xs:element name='ProcessWSDL' type='xs:anyType'> " +
+
+ "</xs:element> " + "</xs:sequence> " + "</xs:complexType> " + "</xs:element> " + "</xs:schema> "
+ + "</wsdl:types> " + "<wsdl:message name='DeployRequest'> "
+ + "<wsdl:part name='DeploymentInformation' element='tns:DeploymentInformation'> " + "</wsdl:part> " +
+
+ "</wsdl:message> " + "<wsdl:message name='CreateInstanceResponse'> "
+ + "<wsdl:part name='Response' element='tns:CreateInstanceResponse'> " + "</wsdl:part> "
+ + "</wsdl:message> " + "<wsdl:message name='CreateInstanceRequest'> "
+ + "<wsdl:part name='ProcessName' element='tns:ProcessName'> " + "</wsdl:part> " + "</wsdl:message> " +
+
+ "<wsdl:message name='DeployResponse'> " + "<wsdl:part name='Response' element='tns:Result'> "
+ + "</wsdl:part> " + "</wsdl:message> " + "<wsdl:portType name='WEPSPortType'> "
+ + "<wsdl:operation name='deploy'> " + "<wsdl:input message='tns:DeployRequest'> " + "</wsdl:input> "
+ + "<wsdl:output message='tns:DeployResponse'> " +
+
+ "</wsdl:output> " + "</wsdl:operation> " + "<wsdl:operation name='createInstance'> "
+ + "<wsdl:input message='tns:CreateInstanceRequest'> " + "</wsdl:input> "
+ + "<wsdl:output message='tns:CreateInstanceResponse'> " + "</wsdl:output> " + "</wsdl:operation> "
+ + "</wsdl:portType> " +
+
+ "<wsdl:binding name='WEPSBinding' type='tns:WEPSPortType'> " + "<soap:binding style='document' "
+ + "transport='http://schemas.xmlsoap.org/soap/http' /> " + "<wsdl:operation name='deploy'> "
+ + "<soap:operation soapAction='urn:deploy' /> " + "<wsdl:input> " + "<soap:body use='literal' /> "
+ + "</wsdl:input> " + "<wsdl:output> " + "<soap:body use='literal' /> " +
+
+ "</wsdl:output> " + "</wsdl:operation> " + "<wsdl:operation name='createInstance'> "
+ + "<soap:operation soapAction='urn:createInstance' /> " + "<wsdl:input> " + "<soap:body use='literal' /> "
+ + "</wsdl:input> " + "<wsdl:output> " + "<soap:body use='literal' /> " +
+
+ "</wsdl:output> " + "</wsdl:operation> " + "</wsdl:binding> " + "<wsdl:service name='WEPSService'> "
+ + "<wsdl:port name='WEPS' binding='tns:WEPSBinding'> " + "<soap:address "
+ + "location='http://silktree.cs.indiana.edu:18080/axis2/services/WEPSService' /> " + "</wsdl:port> "
+ + "</wsdl:service> " + "</wsdl:definitions> ";
+
+}
\ 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/workflow/proxy/WorkflowClient.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowClient.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowClient.java
new file mode 100644
index 0000000..bd67fb1
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowClient.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.workflow.proxy;
+
+import org.apache.airavata.common.utils.Pair;
+import org.ietf.jgss.GSSException;
+
+public interface WorkflowClient {
+
+ public Pair<String, String> invoke(Pair<String, String>[] inputs) throws GSSException;
+
+ public void init();
+
+ public String getInstanceID();
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowContext.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowContext.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowContext.java
new file mode 100644
index 0000000..a5ab394
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowContext.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.workflow.proxy;
+
+import java.net.URISyntaxException;
+
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSException;
+
+import xsul.lead.LeadContextHeader;
+
+public interface WorkflowContext {
+
+ public void prepare(WorkflowClient client, Workflow workflow) throws GSSException, URISyntaxException;
+
+ public LeadContextHeader getHeader();
+
+ public GSSCredential getCredentials();
+
+ public String getTopic();
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowProxyException.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowProxyException.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowProxyException.java
new file mode 100644
index 0000000..7a87d9a
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/workflow/proxy/WorkflowProxyException.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.workflow.proxy;
+
+import org.apache.airavata.workflow.engine.workflow.WorkflowEngineException;
+
+public class WorkflowProxyException extends WorkflowEngineException {
+
+ /**
+ * Constructs a WorkflowProxyException.
+ *
+ */
+ public WorkflowProxyException() {
+ super();
+ }
+
+ /**
+ * Constructs a WorkflowProxyException.
+ *
+ * @param message
+ */
+ public WorkflowProxyException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a WorkflowProxyException.
+ *
+ * @param cause
+ */
+ public WorkflowProxyException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a WorkflowProxyException.
+ *
+ * @param message
+ * @param cause
+ */
+ public WorkflowProxyException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/WorkflowInterpretor.wsdl
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/WorkflowInterpretor.wsdl b/modules/workflow-model/workflow-engine/src/main/resources/WorkflowInterpretor.wsdl
new file mode 100644
index 0000000..a46d107
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/resources/WorkflowInterpretor.wsdl
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<wsdl:definitions targetNamespace="http://xbaya.extreme.indiana.edu" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://xbaya.extreme.indiana.edu" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax21="http://xbaya.extreme.indiana.edu/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
+ <wsdl:types>
+ <xs:schema targetNamespace="http://gui.component.xbaya.airavata.apache.org/xsd">
+ <xs:import namespace="http://registry.component.xbaya.airavata.apache.org/xsd"/>
+ <xs:element name="launchWorkflow">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="workflowAsString" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="topic" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="inputs" nillable="true" type="ns:NameValue"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="launchWorkflowResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="NameValue">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="value" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="launchWorkflowRequest">
+ <wsdl:part name="parameters" element="ns:launchWorkflow">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="launchWorkflowResponse">
+ <wsdl:part name="parameters" element="ns:launchWorkflowResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="WorkflowInterpretorPortType">
+ <wsdl:operation name="launchWorkflow">
+ <wsdl:input message="ns:launchWorkflowRequest" wsaw:Action="urn:launchWorkflow">
+ </wsdl:input>
+ <wsdl:output message="ns:launchWorkflowResponse" wsaw:Action="urn:launchWorkflowResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="WorkflowInterpretorSoap11Binding" type="ns:WorkflowInterpretorPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="launchWorkflow">
+ <soap:operation soapAction="urn:launchWorkflow" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="WorkflowInterpretor">
+ <wsdl:port name="WorkflowInterpretorHttpSoap11Endpoint" binding="ns:WorkflowInterpretorSoap11Binding">
+ <soap:address location="http://ogceportal.iu.teragrid.org:19444/axis2/services/WorkflowInterpretor"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-2.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-2.png b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-2.png
new file mode 100644
index 0000000..28bca82
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-2.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-config.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-config.png b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-config.png
new file mode 100644
index 0000000..2b42807
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-config.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-icon.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-icon.png b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-icon.png
new file mode 100644
index 0000000..28cf91a
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-icon.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-icon2.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-icon2.png b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-icon2.png
new file mode 100644
index 0000000..d00e112
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-icon2.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-name.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-name.png b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-name.png
new file mode 100644
index 0000000..5c29ec9
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-name.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-title-text.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-title-text.png b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-title-text.png
new file mode 100644
index 0000000..3b737f4
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata-title-text.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/airavata.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/airavata.png b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata.png
new file mode 100644
index 0000000..7713189
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/airavata.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/application.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/application.png b/modules/workflow-model/workflow-engine/src/main/resources/images/application.png
new file mode 100644
index 0000000..66ae19c
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/application.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/applications.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/applications.png b/modules/workflow-model/workflow-engine/src/main/resources/images/applications.png
new file mode 100644
index 0000000..f40985e
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/applications.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/closed.gif
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/closed.gif b/modules/workflow-model/workflow-engine/src/main/resources/images/closed.gif
new file mode 100644
index 0000000..83ee32c
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/closed.gif differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/cloud.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/cloud.png b/modules/workflow-model/workflow-engine/src/main/resources/images/cloud.png
new file mode 100644
index 0000000..ac7284f
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/cloud.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/experiment.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/experiment.png b/modules/workflow-model/workflow-engine/src/main/resources/images/experiment.png
new file mode 100644
index 0000000..48fe90b
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/experiment.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/experiments.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/experiments.png b/modules/workflow-model/workflow-engine/src/main/resources/images/experiments.png
new file mode 100644
index 0000000..ed993e0
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/experiments.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/gfac_url.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/gfac_url.png b/modules/workflow-model/workflow-engine/src/main/resources/images/gfac_url.png
new file mode 100644
index 0000000..f4c1b7a
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/gfac_url.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/gfac_urls.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/gfac_urls.png b/modules/workflow-model/workflow-engine/src/main/resources/images/gfac_urls.png
new file mode 100644
index 0000000..9245910
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/gfac_urls.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/host.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/host.png b/modules/workflow-model/workflow-engine/src/main/resources/images/host.png
new file mode 100644
index 0000000..e76e671
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/host.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/hosts.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/hosts.png b/modules/workflow-model/workflow-engine/src/main/resources/images/hosts.png
new file mode 100644
index 0000000..cf0356d
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/hosts.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/input_para.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/input_para.png b/modules/workflow-model/workflow-engine/src/main/resources/images/input_para.png
new file mode 100644
index 0000000..d20c003
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/input_para.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/jcr-repo.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/jcr-repo.png b/modules/workflow-model/workflow-engine/src/main/resources/images/jcr-repo.png
new file mode 100644
index 0000000..6aa8545
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/jcr-repo.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/leaf.gif
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/leaf.gif b/modules/workflow-model/workflow-engine/src/main/resources/images/leaf.gif
new file mode 100644
index 0000000..b18a22f
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/leaf.gif differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/jcr.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/jcr.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/jcr.png
new file mode 100644
index 0000000..ba6e116
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/jcr.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/new2.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/new2.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/new2.png
new file mode 100644
index 0000000..2e56f58
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/new2.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open1.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open1.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open1.png
new file mode 100644
index 0000000..c706198
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open1.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open2.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open2.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open2.png
new file mode 100644
index 0000000..d2ce8de
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open2.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open_dir.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open_dir.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open_dir.png
new file mode 100644
index 0000000..936737e
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/open_dir.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/pause1.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/pause1.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/pause1.png
new file mode 100644
index 0000000..254767a
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/pause1.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/pause_monitor1.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/pause_monitor1.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/pause_monitor1.png
new file mode 100644
index 0000000..dfe320d
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/pause_monitor1.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/play3.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/play3.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/play3.png
new file mode 100644
index 0000000..88aee76
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/play3.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/play4.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/play4.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/play4.png
new file mode 100644
index 0000000..084250c
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/play4.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/resume_monitoring1.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/resume_monitoring1.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/resume_monitoring1.png
new file mode 100644
index 0000000..84be025
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/resume_monitoring1.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/save1.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/save1.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/save1.png
new file mode 100644
index 0000000..bf46fd1
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/save1.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/menu/stop.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/menu/stop.png b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/stop.png
new file mode 100644
index 0000000..60eb108
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/menu/stop.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/opened.gif
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/opened.gif b/modules/workflow-model/workflow-engine/src/main/resources/images/opened.gif
new file mode 100644
index 0000000..2d06b25
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/opened.gif differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/output_para.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/output_para.png b/modules/workflow-model/workflow-engine/src/main/resources/images/output_para.png
new file mode 100644
index 0000000..d09a694
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/output_para.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/parameter.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/parameter.png b/modules/workflow-model/workflow-engine/src/main/resources/images/parameter.png
new file mode 100644
index 0000000..8f9b90a
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/parameter.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/pause.jpeg
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/pause.jpeg b/modules/workflow-model/workflow-engine/src/main/resources/images/pause.jpeg
new file mode 100644
index 0000000..0c04b2f
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/pause.jpeg differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/play.jpeg
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/play.jpeg b/modules/workflow-model/workflow-engine/src/main/resources/images/play.jpeg
new file mode 100644
index 0000000..db2dd7e
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/play.jpeg differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/registry.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/registry.png b/modules/workflow-model/workflow-engine/src/main/resources/images/registry.png
new file mode 100644
index 0000000..168dec6
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/registry.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/service.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/service.png b/modules/workflow-model/workflow-engine/src/main/resources/images/service.png
new file mode 100644
index 0000000..2c02fa7
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/service.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/services.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/services.png b/modules/workflow-model/workflow-engine/src/main/resources/images/services.png
new file mode 100644
index 0000000..762544c
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/services.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/step.gif
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/step.gif b/modules/workflow-model/workflow-engine/src/main/resources/images/step.gif
new file mode 100644
index 0000000..1ec36ae
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/step.gif differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/stop.jpeg
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/stop.jpeg b/modules/workflow-model/workflow-engine/src/main/resources/images/stop.jpeg
new file mode 100644
index 0000000..57e8693
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/stop.jpeg differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/workflow.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/workflow.png b/modules/workflow-model/workflow-engine/src/main/resources/images/workflow.png
new file mode 100644
index 0000000..0efcc44
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/workflow.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/workflow_templates.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/workflow_templates.png b/modules/workflow-model/workflow-engine/src/main/resources/images/workflow_templates.png
new file mode 100644
index 0000000..53bd023
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/workflow_templates.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/images/workflows.png
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/images/workflows.png b/modules/workflow-model/workflow-engine/src/main/resources/images/workflows.png
new file mode 100644
index 0000000..16fa3f1
Binary files /dev/null and b/modules/workflow-model/workflow-engine/src/main/resources/images/workflows.png differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/services.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/services.xml b/modules/workflow-model/workflow-engine/src/main/resources/services.xml
new file mode 100644
index 0000000..429b159
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/resources/services.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you under the Apache License, Version 2.0 (theÏ "License"); you may not use
+ this file except in compliance with the License. You may obtain a copy of
+ the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY ~ KIND, either express or implied. See the License for the specific
+ language governing permissions and limitations under the License. -->
+
+
+<!-- This file was auto-generated from WSDL -->
+<!-- by the Apache Axis2 version: 1.4 Built on : Apr 26, 2008 (06:24:30 EDT) -->
+<serviceGroup>
+ <service name="WorkflowInterpretor" class="org.apache.airavata.xbaya.interpretor.WorkflowInterpretorSkeleton">
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.airavata.xbaya.interpretor.WorkflowInterpretorMessageReceiverInOut"/>
+ </messageReceivers>
+ <parameter name="ServiceClass">org.apache.airavata.xbaya.interpretor.WorkflowInterpretorSkeleton</parameter>
+ <parameter name="useOriginalwsdl">true</parameter>
+ <parameter name="modifyUserWSDLPortAddress">true</parameter>
+ <operation name="launchWorkflow" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://xbaya.extreme.indiana.edu">
+ <actionMapping>urn:launchWorkflow</actionMapping>
+ <outputActionMapping>urn:launchWorkflowResponse</outputActionMapping>
+ </operation>
+ </service>
+</serviceGroup>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/wsdls/TestCMD_Example1_AWSDL.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/wsdls/TestCMD_Example1_AWSDL.xml b/modules/workflow-model/workflow-engine/src/main/resources/wsdls/TestCMD_Example1_AWSDL.xml
new file mode 100644
index 0000000..0964447
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/resources/wsdls/TestCMD_Example1_AWSDL.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<wsdl:definitions name="TestCMD_Example1" targetNamespace="http://www.extreme.indiana.edu/lead"
+ xmlns:typens="http://www.extreme.indiana.edu/lead/TestCMD_Example1/xsd" xmlns:wsdlns="http://www.extreme.indiana.edu/lead"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <schema elementFormDefault="unqualified" targetNamespace="http://www.extreme.indiana.edu/lead/TestCMD_Example1/xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="Run_InputParams" type="typens:Run_InputParamsType" />
+ <complexType name="Run_InputParamsType">
+ <sequence>
+ <element name="InputParam1" type="xsd:int">
+ <annotation>
+ <documentation>An input parameter</documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+ <element name="Run_OutputParams" type="typens:Run_OutputParamsType" />
+ <complexType name="Run_OutputParamsType">
+ <sequence>
+ <element name="OutputParam1" type="xsd:string">
+ <annotation>
+ <documentation>An output parameter</documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="Run_RequestMessage">
+ <wsdl:part name="parameters" element="typens:Run_InputParams" />
+ </wsdl:message>
+ <wsdl:message name="Run_ResponseMessage">
+ <wsdl:part name="parameters" element="typens:Run_OutputParams" />
+ </wsdl:message>
+ <wsdl:portType name="TestCMD_Example1">
+ <wsdl:documentation />
+ <wsdl:operation name="Run">
+ <wsdl:documentation>Run the service</wsdl:documentation>
+ <wsdl:input name="Run_RequestMessage" message="wsdlns:Run_RequestMessage" />
+ <wsdl:output name="Run_ResponseMessage" message="wsdlns:Run_ResponseMessage" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <n:factoryServices xmlns:n="http://www.extreme.indiana.edu/namespaces/2004/01/gFac">
+ <n:factoryService location="http://rainier.extreme.indiana.edu:12345" operation="n:CreateService"
+ portType="n:GenericFactory" />
+ </n:factoryServices>
+</wsdl:definitions>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/wsdls/adder-awsdl.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/wsdls/adder-awsdl.xml b/modules/workflow-model/workflow-engine/src/main/resources/wsdls/adder-awsdl.xml
new file mode 100644
index 0000000..08e3577
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/resources/wsdls/adder-awsdl.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<definitions name="Adder" targetNamespace="http://www.extreme.indiana.edu/math/" xmlns:tns="http://www.extreme.indiana.edu/math/"
+ xmlns:typens="http://www.extreme.indiana.edu/math/adder/xsd/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <documentation xml:lang="en">A service for adding two numbers</documentation>
+
+ <types>
+ <schema elementFormDefault="unqualified" targetNamespace="http://www.extreme.indiana.edu/math/adder/xsd/"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="AddInput" type="typens:AddInputType" />
+ <complexType name="AddInputType">
+ <sequence>
+ <element name="x" type="xsd:int">
+ <annotation>
+ <documentation xml:lang="en">This is the first input</documentation>
+ </annotation>
+ </element>
+ <element name="y" type="xsd:int">
+ <annotation>
+ <documentation xml:lang="en">This is the second input</documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+ <element name="AddOutput" type="typens:AddOutputType" />
+ <complexType name="AddOutputType">
+ <sequence>
+ <element name="z" type="xsd:int">
+ <annotation>
+ <documentation xml:lang="en">This is the result</documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+ </schema>
+ </types>
+
+ <message name="AddInputMessage">
+ <part name="AddInputMessagePart" element="typens:AddInput" />
+ </message>
+ <message name="AddOutputMessage">
+ <part name="AddOutputMessagePart" element="typens:AddOutput" />
+ </message>
+
+ <portType name="Adder">
+ <documentation xml:lang="en" />
+ <operation name="add">
+ <documentation = en ">Run the adder</documentation>
+ <input name="AddInput" message="tns:AddInputMessage" />
+ <output name="AddOutput" message="tns:AddOutputMessage" />
+ </operation>
+ </portType>
+</definitions>
\ No newline at end of file
[6/9] introducing workflow support in airavata api + other related
modules
Posted by sa...@apache.org.
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/WorkflowInterpreter.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
new file mode 100644
index 0000000..3fe82f0
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
@@ -0,0 +1,1408 @@
+/*
+ *
+ * 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.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.model.util.ExperimentModelUtil;
+import org.apache.airavata.model.workspace.experiment.DataObjectType;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus;
+import org.apache.airavata.orchestrator.cpi.OrchestratorService;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.ParentDataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.airavata.workflow.engine.invoker.DynamicInvoker;
+import org.apache.airavata.workflow.engine.invoker.Invoker;
+import org.apache.airavata.workflow.engine.util.AmazonUtil;
+import org.apache.airavata.workflow.engine.util.InterpreterUtil;
+import org.apache.airavata.workflow.model.component.Component;
+import org.apache.airavata.workflow.model.component.amazon.InstanceComponent;
+import org.apache.airavata.workflow.model.component.amazon.TerminateInstanceComponent;
+import org.apache.airavata.workflow.model.component.dynamic.DynamicComponent;
+import org.apache.airavata.workflow.model.component.system.ConstantComponent;
+import org.apache.airavata.workflow.model.component.system.DifferedInputComponent;
+import org.apache.airavata.workflow.model.component.system.DoWhileComponent;
+import org.apache.airavata.workflow.model.component.system.EndDoWhileComponent;
+import org.apache.airavata.workflow.model.component.system.EndForEachComponent;
+import org.apache.airavata.workflow.model.component.system.EndifComponent;
+import org.apache.airavata.workflow.model.component.system.ForEachComponent;
+import org.apache.airavata.workflow.model.component.system.IfComponent;
+import org.apache.airavata.workflow.model.component.system.InputComponent;
+import org.apache.airavata.workflow.model.component.system.MemoComponent;
+import org.apache.airavata.workflow.model.component.system.OutputComponent;
+import org.apache.airavata.workflow.model.component.system.S3InputComponent;
+import org.apache.airavata.workflow.model.component.system.SubWorkflowComponent;
+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.dynamic.BasicTypeMapping;
+import org.apache.airavata.workflow.model.graph.dynamic.DynamicNode;
+import org.apache.airavata.workflow.model.graph.impl.EdgeImpl;
+import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
+import org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode;
+import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
+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.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.OutputNode;
+import org.apache.airavata.workflow.model.graph.ws.WSGraph;
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+import org.apache.airavata.workflow.model.graph.ws.WSPort;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
+import org.apache.airavata.ws.monitor.MonitorException;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.infoset.XmlElement;
+
+import xsul5.XmlConstants;
+
+public class WorkflowInterpreter {
+ private static final Logger log = LoggerFactory.getLogger(WorkflowInterpreter.class);
+
+ public static final String WORKFLOW_STARTED = "Workflow Running";
+ public static final String WORKFLOW_FINISHED = "Workflow Finished";
+
+ private WorkflowInterpreterConfiguration config;
+
+ private Map<Node, Invoker> invokerMap = new HashMap<Node, Invoker>();
+
+ private List<Node> invokedNode = new ArrayList<Node>();
+
+ private WorkflowInterpreterInteractor interactor;
+
+ private Map<Node,WorkflowNodeDetails> nodeInstanceList;
+
+ private Experiment experiment;
+ private Registry registry;
+
+ private OrchestratorService.Client orchestratorClient;
+
+ public static ThreadLocal<WorkflowInterpreterConfiguration> workflowInterpreterConfigurationThreadLocal =
+ new ThreadLocal<WorkflowInterpreterConfiguration>();
+
+ private String credentialStoreToken;
+ /**
+ *
+ * @param config
+ * @param interactor
+ */
+ public WorkflowInterpreter(Experiment experiment, String credentialStoreToken, WorkflowInterpreterConfiguration config, OrchestratorService.Client orchestratorClient) {
+ this.setConfig(config);
+ this.setExperiment(experiment);
+ this.setCredentialStoreToken(credentialStoreToken);
+ this.interactor = new SSWorkflowInterpreterInteractorImpl();
+ this.orchestratorClient = orchestratorClient;
+ //TODO set act of provenance
+ nodeInstanceList=new HashMap<Node, WorkflowNodeDetails>();
+ setWorkflowInterpreterConfigurationThreadLocal(config);
+ }
+
+ public WorkflowInterpreterInteractor getInteractor(){
+ return this.interactor;
+ }
+
+ private void notifyViaInteractor(WorkflowExecutionMessage messageType, Object data) {
+ interactor.notify(messageType, config, data);
+ }
+
+ private Object getInputViaInteractor(WorkflowExecutionMessage messageType, Object data) throws Exception {
+ return interactor.retrieveData(messageType, config, data);
+ }
+
+ private Registry getRegistry() throws RegistryException{
+ if (registry==null){
+ registry = RegistryFactory.getDefaultRegistry();
+ }
+ return registry;
+// return new TmpRegistry();
+ }
+
+ private void updateWorkflowNodeStatus(WorkflowNodeDetails node, WorkflowNodeState state) throws RegistryException{
+ WorkflowNodeStatus status = ExperimentModelUtil.createWorkflowNodeStatus(state);
+ node.setWorkflowNodeStatus(status);
+ getRegistry().update(RegistryModelType.WORKFLOW_NODE_STATUS, status, node.getNodeInstanceId());
+ }
+
+ private void updateExperimentStatus(ExperimentState state){
+// node.setWorkflowNodeStatus(ExperimentModelUtil.createWorkflowNodeStatus(state));
+ //TODO trigger node status update
+ }
+
+ /**
+ * @throws WorkflowException
+ * @throws RegistryException
+ */
+ public void scheduleDynamically() throws WorkflowException, RegistryException {
+ try {
+ this.getWorkflow().setExecutionState(WorkflowExecutionState.RUNNING);
+ ArrayList<Node> inputNodes = this.getInputNodesDynamically();
+ List<DataObjectType> experimentOutputs = experiment.getExperimentInputs();
+ Map<String,String> inputDataStrings=new HashMap<String, String>();
+ for (DataObjectType dataObjectType : experimentOutputs) {
+ inputDataStrings.put(dataObjectType.getKey(), dataObjectType.getValue());
+ }
+ for (Node node : inputNodes) {
+ if (inputDataStrings.containsKey(node.getName())){
+ ((InputNode)node).setDefaultValue(inputDataStrings.get(node.getName()));
+ } else {
+ log.warn("value for node not found "+node.getName());
+ }
+ }
+ for (int i = 0; i < inputNodes.size(); ++i) {
+ Node node = inputNodes.get(i);
+ invokedNode.add(node);
+ node.setState(NodeExecutionState.FINISHED);
+ notifyViaInteractor(WorkflowExecutionMessage.NODE_STATE_CHANGED, null);
+ String portName = ((InputNode) node).getName();
+ Object portValue = ((InputNode) node).getDefaultValue();
+ //Saving workflow input Node data before running the workflow
+ WorkflowNodeDetails workflowNode = createWorkflowNodeDetails(node);
+ DataObjectType elem = new DataObjectType();
+ elem.setKey(portName);
+ elem.setValue(portValue==null?null:portValue.toString());
+ workflowNode.addToNodeInputs(elem);
+ workflowNode.setNodeInstanceId((String) getRegistry().add(ChildDataType.WORKFLOW_NODE_DETAIL, workflowNode, getExperiment().getExperimentID()));
+ updateWorkflowNodeStatus(workflowNode, WorkflowNodeState.COMPLETED);
+ }
+
+ while (this.getWorkflow().getExecutionState() != WorkflowExecutionState.STOPPED) {
+ ArrayList<Node> readyNodes = this.getReadyNodesDynamically();
+ ArrayList<Thread> threadList = new ArrayList<Thread>();
+ if (getRemainNodesDynamically() == 0) {
+ notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.STOPPED);
+ }
+ // ok we have paused sleep
+ if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED) {
+ log.info("Workflow execution "+experiment.getExperimentID()+" is paused.");
+ while (this.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED) {
+ try {
+ Thread.sleep(400);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.STOPPED) {
+ continue;
+ }
+ log.info("Workflow execution "+experiment.getExperimentID()+" is resumed.");
+ }
+ // get task list and execute them
+ for (final Node node : readyNodes) {
+ if (node.isBreak()) {
+ this.notifyPause();
+ break;
+ }
+ if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED
+ || this.getWorkflow().getExecutionState() == WorkflowExecutionState.STOPPED) {
+ break;
+ }
+ WorkflowNodeDetails workflowNodeDetails = createWorkflowNodeDetails(node);
+ // Since this is an independent node execution we can run these nodes in separate threads.
+ Thread th = new Thread() {
+ public synchronized void run() {
+ try {
+ executeDynamically(node);
+ } catch (WorkflowException e) {
+ log.error("Error execution workflow Node : " + node.getID());
+ return;
+ } catch (TException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (RegistryException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ };
+ updateWorkflowNodeStatus(workflowNodeDetails, WorkflowNodeState.INVOKED);
+ threadList.add(th);
+ th.start();
+ if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.STEP) {
+ this.getWorkflow().setExecutionState(WorkflowExecutionState.PAUSED);
+ //TODO update experiment state to suspend
+ break;
+ }
+ }
+ //This thread waits until parallel nodes get finished to send the outputs dynamically.
+ for(Thread th:threadList){
+ try {
+ th.join();
+ } catch (InterruptedException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+ // Above statement set the nodeCount back to 0.
+
+ // TODO commented this for foreach, fix this.
+ sendOutputsDynamically();
+ // Dry run sleep a lil bit to release load
+ if (readyNodes.size() == 0) {
+ // when there are no ready nodes and no running nodes
+ // and there are failed nodes then workflow is stuck because
+ // of failure
+ // so we should pause the execution
+ if (InterpreterUtil.getRunningNodeCountDynamically(this.getGraph()) == 0
+ /**&& InterpreterUtil.getFailedNodeCountDynamically(this.getGraph()) != 0**/) {
+ //Since airavata only support workflow interpreter server mode we do not want to keep thread in sleep mode
+ // continuously, so we make the workflow stop when there's nothing to do.
+ this.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
+ }
+
+ try {
+ Thread.sleep(400);
+ } catch (InterruptedException e) {
+ log.error("Workflow Excecution is interrupted !");
+ return;
+ }
+ }
+ }
+
+ if (InterpreterUtil.getFailedNodeCountDynamically(this.getGraph()) == 0) {
+ if (this.config.isActOnProvenance()) {
+
+ try {
+// this.getConfig().getConfiguration().getAiravataAPI().getProvenanceManager().setWorkflowInstanceStatus(
+// this.config.getTopic(), this.config.getTopic(), State.FINISHED);
+ updateExperimentStatus(ExperimentState.COMPLETED);
+ } catch (Exception e) {
+ throw new WorkflowException(e);
+ }
+
+ // System.out.println(this.config.getConfiguration().getJcrComponentRegistry().getRegistry().getWorkflowStatus(this.topic));
+ }
+ } else {
+ if (this.config.isActOnProvenance()) {
+ // this.getConfig().getConfiguration().getAiravataAPI().getProvenanceManager().
+// setWorkflowInstanceStatus(this.config.getTopic(),this.config.getTopic(), State.FAILED);
+ updateExperimentStatus(ExperimentState.FAILED);
+ }
+ }
+
+ UUID uuid = UUID.randomUUID();
+ notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_TASK_START, new WorkflowInterpreterInteractor.TaskNotification("Stop Workflow",
+ "Cleaning up resources for Workflow", uuid.toString()));
+ // Send Notification for output values
+ finish();
+ // Sleep to provide for notification delay
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_TASK_END, new WorkflowInterpreterInteractor.TaskNotification("Stop Workflow",
+ "Cleaning up resources for Workflow", uuid.toString()));
+
+ } catch (RuntimeException e) {
+ // we reset all the state
+ cleanup();
+ raiseException(e);
+ } catch (AiravataAPIInvocationException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }finally{
+ cleanup();
+ this.getWorkflow().setExecutionState(WorkflowExecutionState.NONE);
+ }
+ }
+
+ private WorkflowNodeDetails createWorkflowNodeDetails(Node node) {
+ WorkflowNodeDetails workflowNode = ExperimentModelUtil.createWorkflowNode(node.getName(), null);
+ nodeInstanceList.put(node, workflowNode);
+ return workflowNode;
+ }
+
+ /**
+ * @param e
+ */
+ public void raiseException(Throwable e) {
+ notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_ERROR, e);
+ }
+
+ /**
+ *
+ */
+ private void notifyPause() {
+ if (this.getWorkflow().getExecutionState() != WorkflowExecutionState.RUNNING && this.getWorkflow().getExecutionState() != WorkflowExecutionState.STEP) {
+ throw new WorkflowRuntimeException("Cannot pause when not running");
+ }
+ notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
+ }
+
+ /**
+ * @throws MonitorException
+ */
+ public void cleanup() throws MonitorException {
+ this.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
+ notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_CLEANUP, null);
+ }
+
+ private void sendOutputsDynamically() throws WorkflowException, AiravataAPIInvocationException, RegistryException {
+ ArrayList<Node> outputNodes = getReadyOutputNodesDynamically();
+ if (outputNodes.size() != 0) {
+ LinkedList<Object> outputValues = new LinkedList<Object>();
+ LinkedList<String> outputKeywords = new LinkedList<String>();
+ for (Node node : outputNodes) {
+ // Change it to processing state so we will not pic it up in the
+ // next run
+ // even if the next run runs before the notification arrives
+ WorkflowNodeDetails workflowNodeDetails = createWorkflowNodeDetails(node);
+ getRegistry().update(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeDetails, getExperiment().getExperimentID());
+ node.setState(NodeExecutionState.EXECUTING);
+ updateWorkflowNodeStatus(workflowNodeDetails, WorkflowNodeState.EXECUTING);
+ // OutputNode node = (OutputNode) outputNode;
+ List<DataPort> inputPorts = node.getInputPorts();
+
+ for (DataPort dataPort : inputPorts) {
+ Object val = InterpreterUtil.findInputFromPort(dataPort);
+ if (null == val) {
+ throw new WorkFlowInterpreterException("Unable to find output for the node:" + node.getID());
+ }
+ // This is ok because the outputnodes always got only one
+ // input
+ if (val instanceof org.xmlpull.v1.builder.XmlElement) {
+ ((OutputNode) node).setDescription(XMLUtil.xmlElementToString((org.xmlpull.v1.builder.XmlElement) val));
+ } else {
+ ((OutputNode) node).setDescription(val.toString());
+ }
+ // Saving output Node data in to database
+// WorkflowNodeType workflowNodeType = new WorkflowNodeType();
+// workflowNodeType.setNodeType(WorkflowNodeType.WorkflowNode.OUTPUTNODE);
+// WorkflowInstanceNode workflowInstanceNode = new WorkflowInstanceNode(new WorkflowExecution(config.getTopic(), config.getTopic()), node.getID());
+ String portname = node.getName();
+ String portValue = ((OutputNode) node).getDescription();
+// this.getConfig().getConfiguration().getAiravataAPI().getProvenanceManager().setWorkflowInstanceNodeOutput(workflowInstanceNode, portname + "=" + portValue);
+// this.getConfig().getConfiguration().getAiravataAPI().getProvenanceManager().setWorkflowNodeType(workflowInstanceNode, workflowNodeType);
+ DataObjectType elem = new DataObjectType();
+ elem.setKey(portname);
+ elem.setValue(portValue);
+ workflowNodeDetails.addToNodeOutputs(elem);
+ getRegistry().update(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeDetails, workflowNodeDetails.getNodeInstanceId());
+ if (this.config.isActOnProvenance()) {
+ //TODO do provanence thing
+// try {
+// if (val instanceof String) {
+// this.getConfig().getConfiguration().getAiravataAPI().getProvenanceManager()
+// .saveWorkflowExecutionOutput(this.config.getTopic(), node.getName(), val.toString());
+// } else if (val instanceof org.xmlpull.v1.builder.XmlElement) {
+// this.getConfig()
+// .getConfiguration()
+// .getAiravataAPI().getProvenanceManager()
+// .saveWorkflowExecutionOutput(this.config.getTopic(), node.getName(),
+// XMLUtil.xmlElementToString((org.xmlpull.v1.builder.XmlElement) val));
+// }
+// outputValues.add(val);
+// outputKeywords.add(dataPort.getID());
+// } catch (AiravataAPIInvocationException e) {
+// e.printStackTrace(); // To change body of catch
+// // statement use File |
+// // Settings | File
+// // Templates.
+// }
+ }
+ }
+ node.setState(NodeExecutionState.FINISHED);
+ updateWorkflowNodeStatus(workflowNodeDetails, WorkflowNodeState.COMPLETED);
+ notifyViaInteractor(WorkflowExecutionMessage.NODE_STATE_CHANGED, null);
+ }
+
+ }
+ }
+
+ private void finish() throws WorkflowException, RegistryException {
+ ArrayList<Node> outoutNodes = new ArrayList<Node>();
+ List<NodeImpl> nodes = this.getGraph().getNodes();
+ for (Node node : nodes) {
+ if (node instanceof OutputNode) {
+ if (node.getInputPort(0).getFromNode().getState()== NodeExecutionState.FINISHED) {
+ outoutNodes.add(node);
+ } else {
+ // The workflow is incomplete so return without sending
+ // workflowFinished
+ return;
+ }
+ }
+ }
+ LinkedList<Object> outputValues = new LinkedList<Object>();
+ LinkedList<String> outputKeywords = new LinkedList<String>();
+ for (Node outputNode : outoutNodes) {
+ OutputNode node = (OutputNode) outputNode;
+ List<DataPort> inputPorts = node.getInputPorts();
+ for (DataPort dataPort : inputPorts) {
+ Object val = InterpreterUtil.findInputFromPort(dataPort, this.invokerMap);
+ ;
+
+ if (null == val) {
+ throw new WorkFlowInterpreterException("Unable to find output for the node:" + node.getID());
+ }
+ WorkflowNodeDetails workflowNodeDetails = nodeInstanceList.get(node);
+ DataObjectType elem = new DataObjectType();
+ elem.setKey(node.getName());
+ elem.setValue(val.toString());
+ workflowNodeDetails.addToNodeOutputs(elem);
+ try {
+ getRegistry().update(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeDetails, workflowNodeDetails.getNodeInstanceId());
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ }
+ updateWorkflowNodeStatus(workflowNodeDetails, WorkflowNodeState.COMPLETED);
+ }
+
+ }
+ }
+
+ private void executeDynamically(final Node node) throws WorkflowException, TException, RegistryException {
+ node.setState(NodeExecutionState.EXECUTING);
+ invokedNode.add(node);
+ updateWorkflowNodeStatus(nodeInstanceList.get(node), WorkflowNodeState.EXECUTING);
+ Component component = node.getComponent();
+ if (component instanceof SubWorkflowComponent) {
+ handleSubWorkComponent(node);
+ } else if (component instanceof WSComponent) {
+ handleWSComponent(node);
+ } else if (component instanceof DynamicComponent) {
+ handleDynamicComponent(node);
+ } else if (component instanceof ForEachComponent) {
+ handleForEach(node);
+ } else if (component instanceof IfComponent) {
+ handleIf(node);
+ } else if (component instanceof EndifComponent) {
+ handleEndIf(node);
+ } else if (component instanceof DoWhileComponent) {
+ handleDoWhile(node);
+ }else if (component instanceof EndDoWhileComponent) {
+ // Component is handled in DoWhileHandler after eval condition
+ }
+ else if (component instanceof InstanceComponent) {
+ handleAmazonInstance(node);
+ } else if (component instanceof TerminateInstanceComponent) {
+ handleAmazonTerminateInstance(node);
+ } else {
+ throw new WorkFlowInterpreterException("Encountered Node that cannot be executed:" + node);
+ }
+ }
+
+ private void handleAmazonTerminateInstance(final Node node)
+ throws WorkflowException {
+ Object inputVal = InterpreterUtil.findInputFromPort(node.getInputPort(0), this.invokerMap);
+ String instanceId = inputVal.toString();
+ /*
+ * Terminate instance
+ */
+ AmazonUtil.terminateInstances(instanceId);
+
+ // set color to done
+ node.setState(NodeExecutionState.FINISHED);
+ }
+
+ private void handleAmazonInstance(final Node node) {
+ //TODO
+ for (ControlPort ports : node.getControlOutPorts()) {
+ ports.setConditionMet(true);
+ }
+ }
+
+ private void handleDoWhile(final Node node) {
+ // Executor thread is shutdown inside as thread gets killed when you
+ // shutdown
+ ExecutorService threadExecutor = Executors.newSingleThreadExecutor();
+ DoWhileHandler doWhileHandler = new DoWhileHandler((DoWhileNode) node, this.invokerMap, getWaitingNodesDynamically(),
+ getFinishedNodesDynamically(), this, threadExecutor);
+ threadExecutor.submit(doWhileHandler);
+ }
+
+ private void handleSubWorkComponent(Node node) throws WorkflowException {
+ //TODO we will not support this in 0.13
+ notifyViaInteractor(WorkflowExecutionMessage.OPEN_SUBWORKFLOW, node);
+ // setting the inputs
+ Workflow subWorkflow = ((SubWorkflowNode) node).getWorkflow();
+ ArrayList<Node> subWorkflowInputNodes = getInputNodes(subWorkflow);
+
+ List<DataPort> inputPorts = node.getInputPorts();
+ for (DataPort port : inputPorts) {
+ Object inputVal = InterpreterUtil.findInputFromPort(port, this.invokerMap);
+ if (null == inputVal) {
+ throw new WorkFlowInterpreterException("Unable to find inputs for the subworkflow node node:" + node.getID());
+ }
+
+ for (Iterator<Node> iterator = subWorkflowInputNodes.iterator(); iterator.hasNext();) {
+ InputNode inputNode = (InputNode) iterator.next();
+ if (inputNode.getName().equals(port.getName())) {
+ inputNode.setDefaultValue(inputVal);
+ }
+ }
+ }
+ for (Iterator<Node> iterator = subWorkflowInputNodes.iterator(); iterator.hasNext();) {
+ InputNode inputNode = (InputNode) iterator.next();
+ if (inputNode.getDefaultValue() == null) {
+ throw new WorkFlowInterpreterException("Input not set for :" + inputNode.getID());
+ }
+ }
+ try {
+ WorkflowInterpreter subworkflowInterpreter = (WorkflowInterpreter) getInputViaInteractor(
+ WorkflowExecutionMessage.INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW, subWorkflow);
+ subworkflowInterpreter.scheduleDynamically();
+ } catch (Exception e) {
+ throw new WorkflowException(e);
+ }
+ }
+
+ private OrchestratorService.Client getOrchestratorClient(){
+ return orchestratorClient;
+ }
+
+ protected void handleWSComponent(Node node) throws WorkflowException, TException, RegistryException {
+ TaskDetails taskDetails = ExperimentModelUtil.cloneTaskFromWorkflowNodeDetails(experiment, nodeInstanceList.get(node));
+ taskDetails.setTaskID(getRegistry().add(ChildDataType.TASK_DETAIL, taskDetails,nodeInstanceList.get(node).getNodeInstanceId()).toString());
+ getOrchestratorClient().launchTask(taskDetails.getTaskID(), getCredentialStoreToken());
+ }
+
+ private void handleDynamicComponent(Node node) throws WorkflowException {
+ DynamicComponent dynamicComponent = (DynamicComponent) node.getComponent();
+ String className = dynamicComponent.getClassName();
+ String operationName = dynamicComponent.getOperationName();
+ URL implJarLocation = dynamicComponent.getImplJarLocation();
+ DynamicNode dynamicNode = (DynamicNode) node;
+ LinkedList<Object> inputs = new LinkedList<Object>();
+ List<DataPort> inputPorts = dynamicNode.getInputPorts();
+ for (DataPort dataPort : inputPorts) {
+ Object inputVal = InterpreterUtil.findInputFromPort(dataPort, this.invokerMap);
+
+ /*
+ * Set type after get input value, and override inputValue if output
+ * type is array
+ */
+ Node fromNode = dataPort.getFromNode();
+ QName type = null;
+ if (fromNode instanceof InputNode) {
+ type = BasicTypeMapping.STRING_QNAME;
+ } else if (fromNode instanceof ConstantNode) {
+ type = ((ConstantNode) fromNode).getType();
+ } else if ((dataPort.getFromPort() instanceof WSPort)
+ && BasicTypeMapping.isArrayType(((WSPort) dataPort.getFromPort()).getComponentPort().getElement())) {
+ Invoker fromInvoker = this.invokerMap.get(fromNode);
+ inputVal = BasicTypeMapping.getOutputArray(XmlConstants.BUILDER.parseFragmentFromString(fromInvoker.getOutputs().toString()), dataPort
+ .getFromPort().getName(), BasicTypeMapping.getSimpleTypeIndex(((DataPort) dataPort.getFromPort()).getType()));
+ type = ((DataPort) dataPort.getFromPort()).getType();
+ } else {
+ type = ((DataPort) dataPort.getFromPort()).getType();
+ }
+
+ if (null == inputVal) {
+ throw new WorkFlowInterpreterException("Unable to find inputs for the node:" + node.getID());
+ }
+ inputs.add(BasicTypeMapping.getObjectOfType(type, inputVal));
+
+ }
+
+ DynamicInvoker dynamicInvoker = new DynamicInvoker(className, implJarLocation, operationName, inputs.toArray());
+ this.invokerMap.put(node, dynamicInvoker);
+ dynamicInvoker.setup();
+ dynamicInvoker.invoke();
+ node.setState(NodeExecutionState.FINISHED);
+ }
+
+ private void handleForEach(Node node) throws WorkflowException {
+ final ForEachNode forEachNode = (ForEachNode) node;
+ EndForEachNode endForEachNode = null;
+ Collection<Node> repeatNodes = node.getOutputPort(0).getToNodes();
+ // we will support only one for now
+ if (repeatNodes.size() != 1) {
+ throw new WorkFlowInterpreterException("Only one node allowed inside foreach");
+ }
+ Iterator<Node> iterator = repeatNodes.iterator();
+ if (iterator.hasNext()) {
+
+ Node middleNode = iterator.next();
+
+ // forEachNode should point to a WSNode and should have only one
+ // output
+ if ((!(middleNode instanceof WSNode)) && (!(middleNode instanceof SubWorkflowNode))) {
+ throw new WorkFlowInterpreterException("Encountered Node inside foreach that is not a WSNode" + middleNode);
+ } else if (middleNode instanceof SubWorkflowNode) {
+ /* Get the EndforEach Node of the Subworkflow */
+ Iterator<Node> subWorkflowOut = middleNode.getOutputPort(0).getToNodes().iterator();
+ while (subWorkflowOut.hasNext()) {
+ Node node2 = subWorkflowOut.next();
+ if (node2 instanceof EndForEachNode) {
+ endForEachNode = (EndForEachNode) node2;
+ }
+ }
+
+ final LinkedList<String> listOfValues = new LinkedList<String>();
+ InterpreterUtil.getInputsForForEachNode(forEachNode, listOfValues, this.invokerMap);
+ final Integer[] inputNumbers = InterpreterUtil.getNumberOfInputsForForEachNode(forEachNode, this.invokerMap);
+ Workflow workflow1 = ((SubWorkflowNode) middleNode).getWorkflow();
+ List<NodeImpl> nodes = workflow1.getGraph().getNodes();
+ List<Node> wsNodes = new ArrayList<Node>();
+ /* Take the List of WSNodes in the subworkflow */
+ for (NodeImpl subWorkflowNode : nodes) {
+ if (subWorkflowNode instanceof WSNode) {
+ wsNodes.add(subWorkflowNode);
+ }
+ }
+
+ for (int i = 0; i < wsNodes.size(); i++) {
+ final WSNode node1 = (WSNode) wsNodes.get(i);
+ SystemComponentInvoker systemInvoker = null;
+ List<DataPort> outputPorts1 = node1.getOutputPorts();
+ List<Node> endForEachNodes = new ArrayList<Node>();
+ for (DataPort port : outputPorts1) {
+ Iterator<Node> endForEachNodeItr1 = port.getToNodes().iterator();
+ while (endForEachNodeItr1.hasNext()) {
+ Node node2 = endForEachNodeItr1.next();
+ if (node2 instanceof EndForEachNode) {
+ endForEachNodes.add(node2);
+ } else if (node2 instanceof OutputNode) {
+ // intentionally left noop
+ } else {
+ throw new WorkFlowInterpreterException("Found More than one node inside foreach");
+ }
+
+ }
+ }
+ final List<Node> finalEndForEachNodes = endForEachNodes;
+
+ Iterator<Node> endForEachNodeItr1 = node1.getOutputPort(0).getToNodes().iterator();
+ while (endForEachNodeItr1.hasNext()) {
+ Node node2 = endForEachNodeItr1.next();
+ // Start reading input came for foreach node
+ int parallelRuns = listOfValues.size() * node1.getOutputPorts().size();
+ if (listOfValues.size() > 0) {
+ forEachNode.setState(NodeExecutionState.EXECUTING);
+ node1.setState(NodeExecutionState.EXECUTING);
+ List<DataPort> outputPorts = node1.getOutputPorts();
+ final AtomicInteger counter = new AtomicInteger();
+ for (Node endFor : endForEachNodes) {
+ systemInvoker = new SystemComponentInvoker();
+ this.invokerMap.put(endFor, systemInvoker);
+ }
+ final Map<Node, Invoker> finalMap = this.invokerMap;
+ new Thread() {
+ @Override
+ public void run() {
+ try {
+ runInThread(listOfValues, forEachNode, node1, finalEndForEachNodes, finalMap, counter, inputNumbers);
+ } catch (WorkflowException e) {
+ log.error(e.getLocalizedMessage(), e);
+ } catch (RegistryException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (TException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ }.start();
+
+ while (counter.intValue() < parallelRuns) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+
+ }
+ if (!(node2 instanceof OutputNode)) {
+ listOfValues.removeAll(listOfValues);
+ String output = (String) systemInvoker.getOutput(node1.getOutputPort(0).getName());
+ XmlElement xmlElement = XMLUtil.stringToXmlElement("<result>" + output + "</result>");
+ Iterator iterator1 = xmlElement.children().iterator();
+ while (iterator1.hasNext()) {
+ Object next1 = iterator1.next();
+ if (next1 instanceof XmlElement) {
+ listOfValues.add((String) ((XmlElement) next1).children().iterator().next());
+ }
+ }
+ }
+ }
+ }
+ }
+ // we have finished execution so end foreach is finished
+ // todo this has to be done in a separate thread
+ endForEachNode.setState(NodeExecutionState.FINISHED);
+ middleNode.setState(NodeExecutionState.FINISHED);
+ node.setState(NodeExecutionState.FINISHED);
+
+ } else {
+
+ // First node after foreach should end with EndForEachNode
+ List<DataPort> outputPorts1 = middleNode.getOutputPorts();
+ List<Node> endForEachNodes = new ArrayList<Node>();
+ for (DataPort port : outputPorts1) {
+ Iterator<Node> endForEachNodeItr1 = port.getToNodes().iterator();
+ while (endForEachNodeItr1.hasNext()) {
+ Node node2 = endForEachNodeItr1.next();
+ if (node2 instanceof EndForEachNode) {
+ endForEachNodes.add(node2);
+ } else if (node2 instanceof OutputNode) {
+ // intentionally left noop
+ } else {
+ throw new WorkFlowInterpreterException("Found More than one node inside foreach");
+ }
+
+ }
+ }
+ final List<Node> finalEndForEachNodes = endForEachNodes;
+ final Node foreachWSNode = middleNode;
+ final LinkedList<String> listOfValues = new LinkedList<String>();
+
+ // Start reading input came for foreach node
+ InterpreterUtil.getInputsForForEachNode(forEachNode, listOfValues, this.invokerMap);
+ final Integer[] inputNumbers = InterpreterUtil.getNumberOfInputsForForEachNode(forEachNode, this.invokerMap);
+
+ int parallelRuns = createInputValues(listOfValues, inputNumbers).size() * outputPorts1.size();
+ if (listOfValues.size() > 0) {
+
+ forEachNode.setState(NodeExecutionState.EXECUTING);
+ foreachWSNode.setState(NodeExecutionState.EXECUTING);
+ List<DataPort> outputPorts = middleNode.getOutputPorts();
+ final AtomicInteger counter = new AtomicInteger();
+ for (Node endFor : endForEachNodes) {
+ final SystemComponentInvoker systemInvoker = new SystemComponentInvoker();
+ this.invokerMap.put(endFor, systemInvoker);
+ }
+ final Map<Node, Invoker> finalInvokerMap = this.invokerMap;
+
+ new Thread() {
+ @Override
+ public void run() {
+ try {
+ runInThread(listOfValues, forEachNode, foreachWSNode, finalEndForEachNodes, finalInvokerMap, counter, inputNumbers);
+ } catch (WorkflowException e) {
+ log.error(e.getLocalizedMessage(), e);
+ } catch (RegistryException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (TException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ }.start();
+ while (counter.intValue() < parallelRuns) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+
+ }
+ // we have finished execution so end foreach is finished
+ // todo this has to be done in a separate thread
+ middleNode.setState(NodeExecutionState.FINISHED);
+ for (Node endForEach : endForEachNodes) {
+ endForEach.setState(NodeExecutionState.FINISHED);
+ }
+ } else {
+ throw new WorkFlowInterpreterException("No array values found for foreach");
+ }
+
+ }
+ }
+ }
+
+ private void handleIf(Node node) throws WorkflowException {
+ IfNode ifNode = (IfNode) node;
+
+ /*
+ * Get all input to check condition
+ */
+ String booleanExpression = ifNode.getXPath();
+ if (booleanExpression == null) {
+ throw new WorkFlowInterpreterException("XPath for if cannot be null");
+ }
+
+ List<DataPort> inputPorts = node.getInputPorts();
+ int i = 0;
+ for (DataPort port : inputPorts) {
+ Object inputVal = InterpreterUtil.findInputFromPort(port, this.invokerMap);
+
+ if (null == inputVal) {
+ throw new WorkFlowInterpreterException("Unable to find inputs for the node:" + node.getID());
+ }
+
+ booleanExpression = booleanExpression.replaceAll("\\$" + i, "'" + inputVal + "'");
+ }
+
+ // Now the XPath expression
+ try {
+ XPathFactory xpathFact = XPathFactory.newInstance();
+ XPath xpath = xpathFact.newXPath();
+ Boolean result = (Boolean) xpath.evaluate(booleanExpression, booleanExpression, XPathConstants.BOOLEAN);
+
+ /*
+ * Set control port to make execution flow continue according to
+ * condition
+ */
+ for (ControlPort controlPort : node.getControlOutPorts()) {
+ if (controlPort.getName().equals(IfComponent.TRUE_PORT_NAME)) {
+ controlPort.setConditionMet(result.booleanValue());
+ } else if (controlPort.getName().equals(IfComponent.FALSE_PORT_NAME)) {
+ controlPort.setConditionMet(!result.booleanValue());
+ }
+ }
+
+ node.setState(NodeExecutionState.FINISHED);
+
+ } catch (XPathExpressionException e) {
+ throw new WorkFlowInterpreterException("Cannot evaluate XPath in If Condition: " + booleanExpression);
+ }
+ }
+
+ private void handleEndIf(Node node) throws WorkflowException {
+ EndifNode endIfNode = (EndifNode) node;
+ SystemComponentInvoker invoker = new SystemComponentInvoker();
+
+ List<DataPort> ports = endIfNode.getOutputPorts();
+ for (int outputPortIndex = 0, inputPortIndex = 0; outputPortIndex < ports.size(); outputPortIndex++, inputPortIndex = inputPortIndex + 2) {
+
+ Object inputVal = InterpreterUtil.findInputFromPort(endIfNode.getInputPort(inputPortIndex), this.invokerMap);
+
+ Object inputVal2 = InterpreterUtil.findInputFromPort(endIfNode.getInputPort(inputPortIndex + 1), this.invokerMap);
+
+ if ((inputVal == null && inputVal2 == null) || (inputVal != null && inputVal2 != null)) {
+ throw new WorkFlowInterpreterException("EndIf gets wrong input number" + "Port:" + inputPortIndex + " and " + (inputPortIndex + 1));
+ }
+
+ Object value = inputVal != null ? inputVal : inputVal2;
+ invoker.addOutput(endIfNode.getOutputPort(outputPortIndex).getID(), value);
+ }
+
+ this.invokerMap.put(node, invoker);
+
+ node.setState(NodeExecutionState.FINISHED);
+ }
+
+ private String createInvokerForEachSingleWSNode(Node foreachWSNode, WSComponent wsComponent) throws WorkflowException, RegistryException, TException {
+ TaskDetails taskDetails = ExperimentModelUtil.cloneTaskFromWorkflowNodeDetails(experiment, nodeInstanceList.get(foreachWSNode));
+ taskDetails.setTaskID(getRegistry().add(ChildDataType.TASK_DETAIL, taskDetails,nodeInstanceList.get(foreachWSNode).getNodeInstanceId()).toString());
+ getOrchestratorClient().launchTask(taskDetails.getTaskID(), getCredentialStoreToken());
+
+// if (null == wsdlLocation) {
+ // WorkflowInterpreter is no longer using gfac in service mode. we only support embedded mode.
+// if (gfacURLString.startsWith("https")) {
+// LeadContextHeader leadCtxHeader = null;
+// try {
+// leadCtxHeader = XBayaUtil.buildLeadContextHeader(this.getWorkflow(), this.getConfig().getConfiguration(), new MonitorConfiguration(this
+// .getConfig().getConfiguration().getBrokerURL(), this.config.getTopic(), true, this.getConfig().getConfiguration()
+// .getMessageBoxURL()), foreachWSNode.getID(), null);
+// } catch (URISyntaxException e) {
+// throw new WorkflowException(e);
+// }
+// invoker = new WorkflowInvokerWrapperForGFacInvoker(portTypeQName, gfacURLString, this.getConfig().getConfiguration().getMessageBoxURL()
+// .toString(), leadCtxHeader, this.config.getNotifier().createServiceNotificationSender(foreachWSNode.getID()));
+// } else {
+
+// if (this.config.isGfacEmbeddedMode()) {
+// invoker = new EmbeddedGFacInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(((WSNode)foreachWSNode).getComponent().getWSDL()), foreachWSNode.getID(),
+// this.config.getMessageBoxURL().toASCIIString(), this.config.getMessageBrokerURL().toASCIIString(), this.config.getNotifier(),
+// this.config.getTopic(), this.config.getAiravataAPI(), portTypeQName.getLocalPart(), this.config.getConfiguration());
+// } else {
+// invoker = new GenericInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(((WSNode)foreachWSNode).getComponent().getWSDL()), foreachWSNode.getID(),
+// this.config.getMessageBoxURL().toASCIIString(), gfacURLString, this.config.getNotifier());
+// }
+// }
+
+// } else {
+// if (wsdlLocation.endsWith("/")) {
+// wsdlLocation = wsdlLocation.substring(0, wsdlLocation.length() - 1);
+// }
+// if (!wsdlLocation.endsWith("?wsdl")) {
+// wsdlLocation += "?wsdl";
+// }
+// invoker = new GenericInvoker(portTypeQName, wsdlLocation, foreachWSNode.getID(), this.getConfig().getConfiguration().getMessageBoxURL().toString(),
+// gfacURLString, this.config.getNotifier());
+// }
+ return taskDetails.getTaskID();
+ }
+
+ private void runInThread(final LinkedList<String> listOfValues, ForEachNode forEachNode, final Node middleNode, List<Node> endForEachNodes,
+ Map<Node, Invoker> tempInvoker, AtomicInteger counter, final Integer[] inputNumber) throws WorkflowException, RegistryException, TException {
+
+ final LinkedList<String> taskIdList = new LinkedList<String>();
+
+ if (inputNumber.length > 1) {
+ List<String> inputValues = createInputValues(listOfValues, inputNumber);
+ for (final Iterator<String> iterator = inputValues.iterator(); iterator.hasNext();) {
+ final String input = iterator.next();
+ WSComponent wsComponent = (WSComponent) middleNode.getComponent();
+ final String invoker2 = createInvokerForEachSingleWSNode(middleNode, wsComponent);
+ taskIdList.add(invoker2);
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ log.error(e.getLocalizedMessage(), e);
+ }
+ }
+ } else {
+ String invoker = null;
+ for (Iterator<String> iterator = listOfValues.iterator(); iterator.hasNext();) {
+ String input = iterator.next();
+ WSComponent wsComponent = (WSComponent) middleNode.getComponent();
+ taskIdList.add(invoker);
+
+ // find inputs
+ List<DataPort> inputPorts = middleNode.getInputPorts();
+// for (DataPort port : inputPorts) {
+// Object inputVal = InterpreterUtil.findInputFromPort(port, this.invokerMap);
+// /*
+// * Handle ForEachNode
+// */
+// Node fromNode = port.getFromNode();
+// // if (fromNode instanceof ForEachNode) {
+// inputVal = WorkflowInputUtil.parseValue((WSComponentPort) port.getComponentPort(), input);
+// // }
+//
+// if (null == inputVal) {
+// throw new WorkFlowInterpreterException("Unable to find inputs for the node:" + middleNode.getID());
+// }
+// }
+ invoker = createInvokerForEachSingleWSNode(middleNode, wsComponent);
+ }
+ }
+
+ // String arrayElementName = foreachWSNode.getOperationName() +
+ // "ArrayResponse";
+ // String outputStr = "<" + arrayElementName + ">";
+ // invokerMap size and endForEachNodes size can be difference
+ // because we can create endForEachNode with n number of input/output
+ // ports so always have to use
+ // middleNode.getOutputPorts when iterate
+ String[] outputStr = new String[middleNode.getOutputPorts().size()];
+ int i = 0;
+ for (DataPort port : middleNode.getOutputPorts()) {
+ String outputString = "";
+// for (Iterator<Invoker> iterator = taskIdList.iterator(); iterator.hasNext();) {
+// Invoker workflowInvoker = iterator.next();
+//
+// // /
+// Object output = workflowInvoker.getOutput(port.getName());
+// if (output instanceof org.xmlpull.v1.builder.XmlElement) {
+// org.xmlpull.v1.builder.XmlElement element = (org.xmlpull.v1.builder.XmlElement) ((org.xmlpull.v1.builder.XmlElement) output).children()
+// .next();
+// outputString += "\n" + XMLUtil.xmlElementToString(element);
+// } else {
+// outputString += "\n<value>" + output + "</value>";
+// }
+// counter.incrementAndGet();
+// }
+ outputStr[i] = outputString;
+ System.out.println(outputStr[i]);
+ i++;
+ }
+ i = 0;
+ // outputStr += "\n</" + arrayElementName + ">";
+ int outputPortIndex = 0;
+ for (DataPort port : middleNode.getOutputPorts()) {
+ for (Node endForEachNode : endForEachNodes) {
+ if (tempInvoker.get(endForEachNode) != null) {
+ if (!(endForEachNode instanceof OutputNode)) {
+ ((SystemComponentInvoker) tempInvoker.get(endForEachNode)).addOutput(port.getName(), outputStr[i]);
+ }
+ }
+ outputPortIndex++;
+ }
+ i++;
+ }
+ forEachNode.setState(NodeExecutionState.FINISHED);
+ }
+
+ private List<String> createInputValues(LinkedList<String> listOfValues, Integer[] inputNumbers) throws WorkflowException {
+ List<String> inputValues = null;
+ try {
+ inputValues = new ArrayList<String>();
+ if (inputNumbers.length == 1) {
+ return listOfValues;
+ }
+ if (this.config.isRunWithCrossProduct()) {
+ for (int i = 0; i < inputNumbers[0]; i++) {
+ for (int j = 0; j < inputNumbers[1]; j++) {
+ inputValues.add(listOfValues.get(i) + StringUtil.DELIMETER + listOfValues.get(inputNumbers[0] + j));
+ }
+ }
+
+ } else {
+ List<String[]> inputList = new ArrayList<String[]>();
+ int startIndex = 0;
+ for (int input = 0; input < inputNumbers.length; input++) {
+ String[] inputArray = new String[inputNumbers[input]];
+ for (int travers = 0; travers < inputNumbers[input]; travers++) {
+ inputArray[travers] = listOfValues.get(startIndex++);
+ }
+ inputList.add(inputArray);
+ }
+ int inputSize = 1;
+ for (String[] inputArrays : inputList) {
+ if (inputArrays.length != 1) {
+ inputSize = inputArrays.length;
+ }
+ }
+ List<String[]> finalInputList = new ArrayList<String[]>();
+ for (String[] inputArrays : inputList) {
+ if (inputArrays.length == 1) {
+ String[] fullArray = new String[inputSize];
+ for (int i = 0; i < fullArray.length; i++) {
+ fullArray[i] = inputArrays[0];
+ }
+ finalInputList.add(fullArray);
+ } else {
+ finalInputList.add(inputArrays);
+ }
+ }
+ for (int i = 0; i < inputSize; i++) {
+ String inputValue = "";
+ for (String[] array : finalInputList) {
+ inputValue = inputValue + StringUtil.DELIMETER + StringUtil.quoteString(array[i]);
+ }
+ inputValue = inputValue.replaceFirst(StringUtil.DELIMETER , "");
+ inputValues.add(inputValue);
+ }
+
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new WorkflowException("Wrong number of Inputs to For EachNode");
+ }
+ return inputValues;
+ }
+
+ private ArrayList<Node> getReadyOutputNodesDynamically() {
+ ArrayList<Node> list = new ArrayList<Node>();
+ List<NodeImpl> nodes = this.getGraph().getNodes();
+ for (Node node : nodes) {
+ if (node instanceof OutputNode && node.getState()==NodeExecutionState.WAITING
+ && node.getInputPort(0).getFromNode().getState()== NodeExecutionState.FINISHED) {
+
+ list.add(node);
+ }
+ }
+ return list;
+ }
+
+ private int getRemainNodesDynamically() {
+ return InterpreterUtil.getWaitingNodeCountDynamically(this.getGraph()) + InterpreterUtil.getRunningNodeCountDynamically(this.getGraph());
+ }
+
+ private ArrayList<Node> getInputNodesDynamically() {
+ return getInputNodes(this.getWorkflow());
+ }
+
+ private ArrayList<Node> getInputNodes(Workflow wf) {
+ ArrayList<Node> list = new ArrayList<Node>();
+ List<NodeImpl> nodes = wf.getGraph().getNodes();
+ for (Node node : nodes) {
+ String name = node.getComponent().getName();
+ if (InputComponent.NAME.equals(name) || ConstantComponent.NAME.equals(name) || S3InputComponent.NAME.equals(name)) {
+ list.add(node);
+ }
+ }
+ return list;
+ }
+
+ private ArrayList<Node> getReadyNodesDynamically() {
+ ArrayList<Node> list = new ArrayList<Node>();
+ ArrayList<Node> waiting = InterpreterUtil.getWaitingNodesDynamically(this.getGraph());
+ ArrayList<Node> finishedNodes = InterpreterUtil.getFinishedNodesDynamically(this.getGraph());
+ for (Node node : waiting) {
+ Component component = node.getComponent();
+ if (component instanceof WSComponent
+ || component instanceof DynamicComponent
+ || component instanceof SubWorkflowComponent
+ || component instanceof ForEachComponent
+ || component instanceof EndForEachComponent
+ || component instanceof IfComponent
+ || component instanceof InstanceComponent) {
+
+ /*
+ * Check for control ports from other node
+ */
+ ControlPort control = node.getControlInPort();
+ boolean controlDone = true;
+ if (control != null) {
+ for (EdgeImpl edge : control.getEdges()) {
+ controlDone = controlDone && (finishedNodes.contains(edge.getFromPort().getNode())
+ // amazon component use condition met to check
+ // whether the control port is done
+ // FIXME I changed the "||" to a "&&" in the following since thats the only this
+ // that makes sense and if anyone found a scenario it should be otherwise pls fix
+ || ((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);
+ }
+ } else if (component instanceof EndifComponent) {
+ /*
+ * EndIfComponent can run if number of input equals to number of
+ * output that it expects
+ */
+ int expectedOutput = node.getOutputPorts().size();
+ int actualInput = 0;
+ List<DataPort> inputPorts = node.getInputPorts();
+ for (DataPort dataPort : inputPorts) {
+ if (finishedNodes.contains(dataPort.getFromNode()))
+ actualInput++;
+ }
+
+ if (expectedOutput == actualInput) {
+ list.add(node);
+ }
+ } else if (component instanceof TerminateInstanceComponent) {
+ /*
+ * All node connected to controlIn port must be done
+ */
+ ControlPort control = node.getControlInPort();
+ boolean controlDone = true;
+ if (control != null) {
+ for (EdgeImpl edge : control.getEdges()) {
+ controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
+ }
+ }
+
+ /*
+ * 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);
+ }
+
+ } else if (InputComponent.NAME.equals(component.getName())
+ || DifferedInputComponent.NAME.equals(component.getName())
+ || S3InputComponent.NAME.equals(component.getName())
+ || OutputComponent.NAME.equals(component.getName())
+ || MemoComponent.NAME.equals(component.getName())
+ || component instanceof EndDoWhileComponent) {
+ // no op
+ } else if (component instanceof DoWhileComponent) {
+ ControlPort control = node.getControlInPort();
+ boolean controlDone = true;
+ if (control != null) {
+ for (EdgeImpl edge : control.getEdges()) {
+ controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
+ }
+ }
+
+ if (controlDone) {
+ list.add(node);
+ }
+ } else {
+ throw new WorkFlowInterpreterException("Component Not handled :" + component.getName());
+ }
+ }
+
+ notifyViaInteractor(WorkflowExecutionMessage.HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS, this.getGraph());
+
+ return list;
+
+ }
+
+ public Workflow getWorkflow() {
+ return this.config.getWorkflow();
+ }
+
+ public WorkflowInterpreterConfiguration getConfig() {
+ return config;
+ }
+
+ public void setConfig(WorkflowInterpreterConfiguration config) {
+ this.config = config;
+ }
+
+ private WSGraph getGraph() {
+ return this.getWorkflow().getGraph();
+ }
+
+ private ArrayList<Node> getFinishedNodesDynamically() {
+ return this.getNodesWithState(NodeExecutionState.FINISHED);
+ }
+
+ private ArrayList<Node> getWaitingNodesDynamically() {
+ return this.getNodesWithState(NodeExecutionState.WAITING);
+ }
+
+ private ArrayList<Node> getNodesWithState(NodeExecutionState state) {
+ ArrayList<Node> list = new ArrayList<Node>();
+ List<NodeImpl> nodes = getGraph().getNodes();
+ for (Node node : nodes) {
+ if (state==node.getState()) {
+ list.add(node);
+ }
+ }
+ return list;
+ }
+
+ public static void setWorkflowInterpreterConfigurationThreadLocal(WorkflowInterpreterConfiguration workflowInterpreterConfiguration) {
+ WorkflowInterpreter.workflowInterpreterConfigurationThreadLocal.set(workflowInterpreterConfiguration);
+ }
+
+ public static WorkflowInterpreterConfiguration getWorkflowInterpreterConfiguration() {
+ return workflowInterpreterConfigurationThreadLocal.get();
+ }
+
+ public Experiment getExperiment() {
+ return experiment;
+ }
+
+ public void setExperiment(Experiment experiment) {
+ this.experiment = experiment;
+ }
+
+ public String getCredentialStoreToken() {
+ return credentialStoreToken;
+ }
+
+ public void setCredentialStoreToken(String credentialStoreToken) {
+ this.credentialStoreToken = credentialStoreToken;
+ }
+
+ public static class TmpRegistry implements Registry{
+ public TmpRegistry() throws RegistryException {
+ }
+
+ @Override
+ public Object add(ChildDataType dataType, Object newObjectToAdd,
+ Object dependentIdentifier) throws RegistryException {
+ return UUID.randomUUID().toString();
+ }
+
+ @Override
+ public void update(RegistryModelType dataType, Object identifier,
+ String fieldName, Object value) throws RegistryException {
+ }
+
+ @Override
+ public Object add(ParentDataType dataType, Object newObjectToAdd)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void update(RegistryModelType dataType,
+ Object newObjectToUpdate, Object identifier)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Object get(RegistryModelType dataType, Object identifier)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<Object> get(RegistryModelType dataType, String fieldName,
+ Object value) throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<Object> search(RegistryModelType dataType,
+ Map<String, String> filters) throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getValue(RegistryModelType dataType, Object identifier,
+ String field) throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<String> getIds(RegistryModelType dataType,
+ String fieldName, Object value) throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void remove(RegistryModelType dataType, Object identifier)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isExist(RegistryModelType dataType, Object identifier)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ }
+}
\ 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/WorkflowInterpreterConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterConfiguration.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterConfiguration.java
new file mode 100644
index 0000000..ed963a1
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterConfiguration.java
@@ -0,0 +1,78 @@
+/*
+ *
+ * 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.registry.api.AiravataRegistry2;
+
+public class WorkflowInterpreterConfiguration {
+// public static final int GUI_MODE = 1;
+// public static final int SERVER_MODE = 2;
+//
+ private boolean offline=false;
+ private boolean runWithCrossProduct=false;
+ private Workflow workflow;
+ private Boolean actOnProvenance = null;
+
+ public WorkflowInterpreterConfiguration(Workflow workflow) {
+ this(workflow,true);
+ }
+
+ public WorkflowInterpreterConfiguration(Workflow workflow,
+ boolean offline) {
+ this.offline = offline;
+ this.workflow = workflow;
+ }
+
+ public boolean isOffline() {
+ return offline;
+ }
+
+ public void setOffline(boolean offline) {
+ this.offline = offline;
+ }
+
+ public boolean isRunWithCrossProduct() {
+ return runWithCrossProduct;
+ }
+
+ public void setRunWithCrossProduct(boolean runWithCrossProduct) {
+ this.runWithCrossProduct = runWithCrossProduct;
+ }
+
+ public Workflow getWorkflow() {
+ return workflow;
+ }
+
+ public void setWorkflow(Workflow workflow) {
+ this.workflow = workflow;
+ }
+
+ public Boolean isActOnProvenance() {
+ return actOnProvenance;
+ }
+
+ public void setActOnProvenance(Boolean actOnProvenance) {
+ this.actOnProvenance = actOnProvenance;
+ }
+}
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/WorkflowInterpreterInteractor.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterInteractor.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterInteractor.java
new file mode 100644
index 0000000..da41544
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterInteractor.java
@@ -0,0 +1,94 @@
+/*
+ *
+ * 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 WorkflowInterpreterInteractor {
+ public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data);
+ public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data) throws Exception;
+ public void pauseExecution(WorkflowInterpreterConfiguration config);
+ public void resumeExecution(WorkflowInterpreterConfiguration config);
+ public void terminateExecution(WorkflowInterpreterConfiguration config);
+
+ public boolean isExecutionPaused(WorkflowInterpreterConfiguration config);
+ public boolean isExecutionTerminated(WorkflowInterpreterConfiguration config);
+
+ public static class TaskNotification{
+ String messageTitle;
+ String message;
+ String messageId;
+ public TaskNotification(String messageTitle, String message, String messageId) {
+ this.messageTitle=messageTitle;
+ this.message=message;
+ this.messageId=messageId;
+ }
+ }
+
+// public static class WorkflowExecutionData{
+// Workflow workflow;
+// String topic;
+// WorkflowInterpreter currentInterpreter;
+// public WorkflowExecutionData(Workflow workflow,String topic, WorkflowInterpreter currentInterpreter) {
+// this.workflow=workflow;
+// this.topic=topic;
+// this.currentInterpreter=currentInterpreter;
+// }
+// }
+//
+// public static class WSNodeData{
+// WSNode wsNode;
+// WorkflowInterpreter currentInterpreter;
+// public WSNodeData(WSNode wsNode, WorkflowInterpreter currentInterpreter) {
+// this.wsNode=wsNode;
+// this.currentInterpreter=currentInterpreter;
+// }
+// }
+//
+// public static class GFacInvokerData{
+// QName portTypeQName;
+// WsdlDefinitions wsdl;
+// String nodeID;
+// String messageBoxURL;
+// String gfacURL;
+// WorkflowNotifiable notifier;
+// String topic;
+// AiravataRegistry2 registry;
+// String serviceName;
+// XBayaConfiguration config;
+// boolean embeddedMode;
+//
+// public GFacInvokerData(boolean embeddedMode, QName portTypeQName, WsdlDefinitions wsdl, String nodeID, String messageBoxURL,
+// String gfacURL, WorkflowNotifiable notifier,String topic,AiravataRegistry2 registry,String serviceName,XBayaConfiguration config) {
+// this.embeddedMode=embeddedMode;
+// this.portTypeQName = portTypeQName;
+// this.wsdl = wsdl;
+// this.nodeID = nodeID;
+// this.messageBoxURL = messageBoxURL;
+// this.gfacURL = gfacURL;
+// this.notifier = notifier;
+// this.topic = topic;
+// this.registry = registry;
+// this.serviceName = serviceName;
+// this.config = config;
+// }
+// }
+}
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/WorkflowInterpreterInvoker.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterInvoker.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterInvoker.java
new file mode 100644
index 0000000..61a0f37
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterInvoker.java
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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 WorkflowInterpreterInvoker {
+ // implements HeaderConstants {
+ //
+ // public void invoke(Workflow workflow, String serverURL, String userName, String password, String topic)
+ // throws AxisFault, RemoteException, ComponentException {
+ //
+ // String workflowAsString = workflow.toXMLText();
+ // NameValue[] configurations = new NameValue[6];
+ // configurations[0] = new NameValue();
+ // configurations[0].setName(HEADER_ELEMENT_GFAC);
+ // configurations[0].setValue(XBayaConstants.DEFAULT_GFAC_URL.toString());
+ // configurations[1] = new NameValue();
+ // configurations[1].setName(HEADER_ELEMENT_REGISTRY);
+ // configurations[2] = new NameValue();
+ // configurations[2].setName(HEADER_ELEMENT_PROXYSERVER);
+ // configurations[2].setValue(XBayaConstants.DEFAULT_MYPROXY_SERVER);
+ //
+ // configurations[3] = new NameValue();
+ // configurations[3].setName(HEADER_ELEMENT_MSGBOX);
+ // configurations[3].setValue(XBayaConstants.DEFAULT_MESSAGE_BOX_URL.toString());
+ //
+ // configurations[4] = new NameValue();
+ // configurations[4].setName(HEADER_ELEMENT_DSC);
+ // configurations[4].setValue(XBayaConstants.DEFAULT_DSC_URL.toString());
+ //
+ // configurations[5] = new NameValue();
+ // configurations[5].setName(HEADER_ELEMENT_BROKER);
+ // configurations[5].setValue(XBayaConstants.DEFAULT_BROKER_URL.toString());
+ //
+ // LinkedList<NameValue> nameValPairsList = new LinkedList<NameValue>();
+ // List<InputNode> wfInputs = new ODEClient().getInputNodes(workflow);
+ // for (InputNode node : wfInputs) {
+ // NameValue nameValue = new NameValue();
+ // nameValue.setName(node.getName());
+ // nameValue.setValue(node.getDefaultValue().toString());
+ // }
+ //
+ // new WorkflowInterpretorStub(serverURL).launchWorkflow(workflowAsString, topic, password, userName,
+ // nameValPairsList.toArray(new NameValue[0]), configurations);
+ //
+ // }
+
+}
\ No newline at end of file
[2/9] introducing workflow support in airavata api + other related
modules
Posted by sa...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/TestUtilServer.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/TestUtilServer.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/TestUtilServer.java
new file mode 100644
index 0000000..3f31a6b
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/TestUtilServer.java
@@ -0,0 +1,243 @@
+///*
+// *
+// * 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.interpreter.utils;
+//
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+//*/
+//
+//import org.apache.airavata.wsmg.broker.BrokerServiceLifeCycle;
+//import org.apache.axis2.AxisFault;
+//import org.apache.axis2.context.ConfigurationContext;
+//import org.apache.axis2.context.ConfigurationContextFactory;
+//import org.apache.axis2.description.AxisService;
+//import org.apache.axis2.description.InOutAxisOperation;
+//import org.apache.axis2.engine.MessageReceiver;
+//import org.apache.axis2.engine.ServiceLifeCycle;
+//import org.apache.axis2.transport.http.SimpleHTTPServer;
+//
+//import javax.xml.namespace.QName;
+//import java.io.IOException;
+//import java.net.ServerSocket;
+//
+//public class TestUtilServer {
+// private static int count = 0;
+//
+// private static SimpleHTTPServer receiver;
+//
+// public static int TESTING_PORT = 5555;
+//
+// public static final String FAILURE_MESSAGE = "Intentional Failure";
+//
+// public static synchronized void deployService(AxisService service) throws AxisFault {
+// receiver.getConfigurationContext().getAxisConfiguration().addService(service);
+// }
+//
+// public static synchronized void unDeployService(QName service) throws AxisFault {
+// receiver.getConfigurationContext().getAxisConfiguration().removeService(service.getLocalPart());
+// }
+//
+// public static synchronized void unDeployClientService() throws AxisFault {
+// if (receiver.getConfigurationContext().getAxisConfiguration() != null) {
+// receiver.getConfigurationContext().getAxisConfiguration().removeService("AnonymousService");
+// }
+// }
+//
+// public static synchronized void start(String repository, String axis2xml) throws Exception {
+// if (count == 0) {
+// ConfigurationContext er = getNewConfigurationContext(repository, axis2xml);
+// TESTING_PORT = getAvailablePort();
+// receiver = new SimpleHTTPServer(er, TESTING_PORT);
+//
+// try {
+// receiver.start();
+// System.out.print("Server started on port " + TESTING_PORT + ".....");
+// } catch (Exception e) {
+// throw AxisFault.makeFault(e);
+// }
+//
+// try {
+// Thread.sleep(2000);
+// } catch (InterruptedException e1) {
+// throw new AxisFault("Thread interuptted", e1);
+// }
+// startBroker();
+// }
+// count++;
+// }
+//
+// public static void startBroker() throws Exception {
+//
+// ServiceLifeCycle brokerLifeCycle = new BrokerServiceLifeCycle();
+//
+// final String configFileParam = "configuration.file.name";
+// final String configFileValue = "airavata-server.properties";
+//
+// AxisService notificationService = getNotificationService();
+// notificationService.addParameter(configFileParam, configFileValue);
+// notificationService.setServiceLifeCycle(brokerLifeCycle);
+// TestUtilServer.deployService(notificationService);
+// brokerLifeCycle.startUp(TestUtilServer.getConfigurationContext(), notificationService);
+//
+// AxisService eventingService = getEventingService();
+// eventingService.addParameter(configFileParam, configFileValue);
+// eventingService.setServiceLifeCycle(brokerLifeCycle);
+// TestUtilServer.deployService(eventingService);
+// brokerLifeCycle.startUp(TestUtilServer.getConfigurationContext(), eventingService);
+//
+// }
+//
+// public static AxisService getEventingService() {
+//
+// AxisService eventingService = new AxisService("EventingService");
+//
+// createOperation(eventingService, "renew",
+// new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+// "http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew",
+// "http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse");
+// createOperation(eventingService, "getCurrentStatus",
+// new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+// "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus",
+// "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse");
+//
+// createOperation(eventingService, "subscriptionEnd",
+// new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+// "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscriptionEnd", null);
+//
+// createOperation(eventingService, "subscribe",
+// new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+// "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe",
+// "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse");
+// createOperation(eventingService, "unsubscribe",
+// new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+// "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe",
+// "http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse");
+// createOperation(eventingService, "publish",
+// new org.apache.airavata.wsmg.broker.wseventing.WSEventingPublishMsgReceiver(),
+// "http://org.apache.airavata/WseNotification", null);
+//
+// return eventingService;
+// }
+//
+// public static AxisService getNotificationService() {
+//
+// AxisService notificationService = new AxisService("NotificationService");
+//
+// createOperation(notificationService, "notify",
+// new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/Notify",
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/NotifyResponse");
+//
+// createOperation(notificationService, "subscribe",
+// new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/SubscribeRequest",
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/SubscribeRequestResponse");
+//
+// createOperation(notificationService, "getCurrentMessage",
+// new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/GetCurrentMessageRequest",
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/GetCurrentMessageResponse");
+//
+// createOperation(notificationService, "pauseSubscription",
+// new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/PauseSubsriptionRequest",
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/PauseSubscriptionResponse");
+//
+// createOperation(notificationService, "resumeSubscription",
+// new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/ResumeSubsriptionRequest",
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/ResumeSubscriptionResponse");
+//
+// createOperation(notificationService, "unsubscribe",
+// new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/UnsubsribeRequest",
+// "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/UnsubscribeResponse");
+//
+// return notificationService;
+//
+// }
+//
+// public static void createOperation(AxisService axisService, String name, MessageReceiver messageReceiver,
+// String inputAction, String outputAction) {
+// InOutAxisOperation operation1 = new InOutAxisOperation(new QName(name));
+// operation1.setMessageReceiver(messageReceiver);
+// operation1.setOutputAction(outputAction);
+// axisService.addOperation(operation1);
+// if (inputAction != null) {
+// axisService.mapActionToOperation(inputAction, operation1);
+// }
+// }
+//
+// public static ConfigurationContext getNewConfigurationContext(String repository, String axis2xml) throws Exception {
+// return ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository, axis2xml);
+// }
+//
+// public static synchronized void stop() throws AxisFault {
+// if (count == 1) {
+// receiver.stop();
+// while (receiver.isRunning()) {
+// try {
+// Thread.sleep(1000);
+// } catch (InterruptedException e1) {
+// // nothing to do here
+// }
+// }
+// count = 0;
+// // tp.doStop();
+// System.out.print("Server stopped .....");
+// } else {
+// count--;
+// }
+// receiver.getConfigurationContext().terminate();
+// }
+//
+// public static ConfigurationContext getConfigurationContext() {
+// return receiver.getConfigurationContext();
+// }
+//
+// public static int getAvailablePort(){
+// ServerSocket serverSocket = null;
+// try {
+// serverSocket = new ServerSocket(0);
+// serverSocket.close();
+// } catch (IOException e) {
+// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+// }
+// return serverSocket.getLocalPort();
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/WorkflowTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/WorkflowTestUtils.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/WorkflowTestUtils.java
new file mode 100644
index 0000000..cde34ef
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/WorkflowTestUtils.java
@@ -0,0 +1,97 @@
+///*
+// *
+// * 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.interpreter.utils;
+//
+//import org.apache.airavata.client.stub.interpretor.NameValue;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.XBayaConstants;
+//import org.apache.airavata.xbaya.interpreter.EchoService;
+//import org.apache.airavata.xbaya.interpreter.LevenshteinDistanceService;
+//import org.apache.airavata.xbaya.interpreter.ComplexMathService;
+//import org.apache.airavata.xbaya.interpretor.HeaderConstants;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpretorSkeleton;
+//import org.apache.axis2.AxisFault;
+//import org.apache.axis2.context.ConfigurationContext;
+//import org.apache.axis2.context.ConfigurationContextFactory;
+//import org.apache.axis2.description.AxisService;
+//import org.apache.axis2.engine.ListenerManager;
+//
+//import java.io.File;
+//import java.io.FileInputStream;
+//import java.io.IOException;
+//import java.net.URISyntaxException;
+//import java.net.URL;
+//import java.nio.MappedByteBuffer;
+//import java.nio.channels.FileChannel;
+//import java.nio.charset.Charset;
+//import java.util.HashMap;
+//import java.util.Map;
+//
+//
+//public class WorkflowTestUtils implements HeaderConstants{
+//
+// public static XBayaConfiguration getConfiguration() throws URISyntaxException {
+// Map<String, String> configuration = new HashMap<String, String>();
+// configuration.put(HEADER_ELEMENT_GFAC,XBayaConstants.DEFAULT_GFAC_URL.toString());
+// configuration.put(HEADER_ELEMENT_REGISTRY,XBayaConstants.REGISTRY_URL.toASCIIString());
+// configuration.put(HEADER_ELEMENT_PROXYSERVER,XBayaConstants.DEFAULT_MYPROXY_SERVER);
+// configuration.put(HEADER_ELEMENT_MSGBOX,XBayaConstants.DEFAULT_MESSAGE_BOX_URL.toString());
+// configuration.put(HEADER_ELEMENT_DSC,XBayaConstants.DEFAULT_DSC_URL.toString());
+// configuration.put(HEADER_ELEMENT_BROKER,XBayaConstants.DEFAULT_BROKER_URL.toString());
+// return (new WorkflowInterpretorSkeleton()).getConfiguration(configuration);
+// }
+//
+// public static String readWorkflow(URL url) throws IOException, URISyntaxException {
+// FileInputStream stream = new FileInputStream(new File(url.toURI()));
+// try {
+// FileChannel fc = stream.getChannel();
+// MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+// /* Instead of using default, pass in a decoder. */
+// return Charset.defaultCharset().decode(bb).toString();
+// } finally {
+// stream.close();
+// }
+// }
+//
+// public static ListenerManager axis2ServiceStarter() throws AxisFault {
+// try {
+// ConfigurationContext configContext = ConfigurationContextFactory
+// .createBasicConfigurationContext("axis2_default.xml");
+//
+// AxisService echoService = AxisService.createService(EchoService.class.getName(),
+// configContext.getAxisConfiguration());
+// configContext.deployService(echoService);
+// AxisService distanceService = AxisService.createService(LevenshteinDistanceService.class.getName(),
+// configContext.getAxisConfiguration());
+// configContext.deployService(distanceService);
+// AxisService mathService = AxisService.createService(ComplexMathService.class.getName(),
+// configContext.getAxisConfiguration());
+// configContext.deployService(mathService);
+//
+// ListenerManager manager = new ListenerManager();
+// manager.init(configContext);
+// manager.start();
+// return manager;
+// } catch (Exception e) {
+// throw AxisFault.makeFault(e);
+// }
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/test.xwf
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/test.xwf b/modules/workflow-model/workflow-engine/src/test/java/test.xwf
new file mode 100644
index 0000000..96eda29
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/test.xwf
@@ -0,0 +1,251 @@
+<?xml version="1.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. -->
+
+<xwf:workflow xwf:version="3.8.8" xmlns:xwf="http://www.extreme.indiana.edu/xbaya/xwf">
+ <xgr:graph xgr:version="3.8.8" xgr:type="ws"
+ xmlns:xgr="http://www.extreme.indiana.edu/xbaya/graph">
+ <xgr:id>test3</xgr:id>
+ <xgr:name>test3</xgr:name>
+ <xgr:description></xgr:description>
+ <xgr:metadata>
+ <appinfo xmlns="http://www.w3.org/2001/XMLSchema">
+
+</appinfo>
+ </xgr:metadata>
+ <xgr:node xgr:type="ws">
+ <xgr:id>TimestampServicePortType_appendTimeStamp</xgr:id>
+ <xgr:name>TimestampServicePortType:appendTimeStamp</xgr:name>
+ <xgr:outputPort>TimestampServicePortType_appendTimeStamp_out_0</xgr:outputPort>
+ <xgr:inputPort>TimestampServicePortType_appendTimeStamp_in_0</xgr:inputPort>
+ <xgr:controlInPort>TimestampServicePortType_appendTimeStamp_ctrl_in_0</xgr:controlInPort>
+ <xgr:controlOutPort>TimestampServicePortType_appendTimeStamp_ctrl_out_0</xgr:controlOutPort>
+ <xgr:x>35</xgr:x>
+ <xgr:y>122</xgr:y>
+ <xgr:wsdl>_</xgr:wsdl>
+ <xgr:portType>{http://indiana.edu}TimestampServicePortType</xgr:portType>
+ <xgr:operation>appendTimeStamp</xgr:operation>
+ </xgr:node>
+ <xgr:node xgr:type="ws">
+ <xgr:id>TimestampServicePortType_appendTimeStamp_2</xgr:id>
+ <xgr:name>TimestampServicePortType:appendTimeStamp</xgr:name>
+ <xgr:outputPort>TimestampServicePortType_appendTimeStamp_2_out_0</xgr:outputPort>
+ <xgr:inputPort>TimestampServicePortType_appendTimeStamp_2_in_0</xgr:inputPort>
+ <xgr:controlInPort>TimestampServicePortType_appendTimeStamp_2_ctrl_in_0</xgr:controlInPort>
+ <xgr:controlOutPort>TimestampServicePortType_appendTimeStamp_2_ctrl_out_0</xgr:controlOutPort>
+ <xgr:x>179</xgr:x>
+ <xgr:y>228</xgr:y>
+ <xgr:wsdl>_</xgr:wsdl>
+ <xgr:portType>{http://indiana.edu}TimestampServicePortType</xgr:portType>
+ <xgr:operation>appendTimeStamp</xgr:operation>
+ </xgr:node>
+ <xgr:node xgr:type="input">
+ <xgr:id>before</xgr:id>
+ <xgr:name>before</xgr:name>
+ <xgr:outputPort>before_out_0</xgr:outputPort>
+ <xgr:x>24</xgr:x>
+ <xgr:y>47</xgr:y>
+ <xgr:config>
+ <xgr:description></xgr:description>
+ <xgr:dataType>{http://www.w3.org/2001/XMLSchema}string</xgr:dataType>
+ </xgr:config>
+ </xgr:node>
+ <xgr:node xgr:type="output">
+ <xgr:id>return</xgr:id>
+ <xgr:name>return</xgr:name>
+ <xgr:inputPort>return_in_0</xgr:inputPort>
+ <xgr:x>552</xgr:x>
+ <xgr:y>216</xgr:y>
+ <xgr:config>
+ <xgr:description></xgr:description>
+ <xgr:dataType>{http://www.w3.org/2001/XMLSchema}string</xgr:dataType>
+ </xgr:config>
+ </xgr:node>
+ <xgr:port xgr:type="ws">
+ <xgr:id>TimestampServicePortType_appendTimeStamp_in_0</xgr:id>
+ <xgr:name>before</xgr:name>
+ <xgr:node>TimestampServicePortType_appendTimeStamp</xgr:node>
+ </xgr:port>
+ <xgr:port xgr:type="ws">
+ <xgr:id>TimestampServicePortType_appendTimeStamp_out_0</xgr:id>
+ <xgr:name>return</xgr:name>
+ <xgr:node>TimestampServicePortType_appendTimeStamp</xgr:node>
+ </xgr:port>
+ <xgr:port xgr:type="control">
+ <xgr:id>TimestampServicePortType_appendTimeStamp_ctrl_in_0</xgr:id>
+ <xgr:name>control</xgr:name>
+ <xgr:node>TimestampServicePortType_appendTimeStamp</xgr:node>
+ </xgr:port>
+ <xgr:port xgr:type="control">
+ <xgr:id>TimestampServicePortType_appendTimeStamp_ctrl_out_0</xgr:id>
+ <xgr:name>control</xgr:name>
+ <xgr:node>TimestampServicePortType_appendTimeStamp</xgr:node>
+ </xgr:port>
+ <xgr:port xgr:type="ws">
+ <xgr:id>TimestampServicePortType_appendTimeStamp_2_in_0</xgr:id>
+ <xgr:name>before</xgr:name>
+ <xgr:node>TimestampServicePortType_appendTimeStamp_2</xgr:node>
+ </xgr:port>
+ <xgr:port xgr:type="ws">
+ <xgr:id>TimestampServicePortType_appendTimeStamp_2_out_0</xgr:id>
+ <xgr:name>return</xgr:name>
+ <xgr:node>TimestampServicePortType_appendTimeStamp_2</xgr:node>
+ </xgr:port>
+ <xgr:port xgr:type="control">
+ <xgr:id>TimestampServicePortType_appendTimeStamp_2_ctrl_in_0</xgr:id>
+ <xgr:name>control</xgr:name>
+ <xgr:node>TimestampServicePortType_appendTimeStamp_2</xgr:node>
+ </xgr:port>
+ <xgr:port xgr:type="control">
+ <xgr:id>TimestampServicePortType_appendTimeStamp_2_ctrl_out_0</xgr:id>
+ <xgr:name>control</xgr:name>
+ <xgr:node>TimestampServicePortType_appendTimeStamp_2</xgr:node>
+ </xgr:port>
+ <xgr:port xgr:type="systemData">
+ <xgr:id>before_out_0</xgr:id>
+ <xgr:name>Parameter</xgr:name>
+ <xgr:node>before</xgr:node>
+ </xgr:port>
+ <xgr:port xgr:type="systemData">
+ <xgr:id>return_in_0</xgr:id>
+ <xgr:name>Parameter</xgr:name>
+ <xgr:node>return</xgr:node>
+ </xgr:port>
+ <xgr:edge xgr:type="data">
+ <xgr:fromPort>before_out_0</xgr:fromPort>
+ <xgr:toPort>TimestampServicePortType_appendTimeStamp_in_0</xgr:toPort>
+ </xgr:edge>
+ <xgr:edge xgr:type="data">
+ <xgr:fromPort>TimestampServicePortType_appendTimeStamp_out_0</xgr:fromPort>
+ <xgr:toPort>TimestampServicePortType_appendTimeStamp_2_in_0</xgr:toPort>
+ </xgr:edge>
+ <xgr:edge xgr:type="data">
+ <xgr:fromPort>TimestampServicePortType_appendTimeStamp_2_out_0</xgr:fromPort>
+ <xgr:toPort>return_in_0</xgr:toPort>
+ </xgr:edge>
+ </xgr:graph>
+ <xwf:wsdls>
+ <xwf:wsdl xwf:id="_"><wsdl:definitions targetNamespace="http://indiana.edu" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://indiana.edu"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xs:schema targetNamespace="http://indiana.edu">
+ <xs:element name="appendTimeStamp">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="before" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="appendTimeStampResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="appendTimeStampResponse">
+ <wsdl:part name="parameters" element="ns:appendTimeStampResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="appendTimeStampRequest">
+ <wsdl:part name="parameters" element="ns:appendTimeStamp">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="TimestampServicePortType">
+ <wsdl:operation name="appendTimeStamp">
+ <wsdl:input wsaw:Action="urn:appendTimeStamp" message="ns:appendTimeStampRequest">
+ </wsdl:input>
+ <wsdl:output wsaw:Action="urn:appendTimeStampResponse" message="ns:appendTimeStampResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="TimestampServiceSoap11Binding" type="ns:TimestampServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="appendTimeStamp">
+ <soap:operation soapAction="urn:appendTimeStamp" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="TimestampService">
+ <wsdl:port name="TimestampServiceHttpSoap11Endpoint" binding="ns:TimestampServiceSoap11Binding">
+ <soap:address location="http://pagodatree.cs.indiana.edu:8081/axis2/services/TimestampService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions></xwf:wsdl>
+ </xwf:wsdls>
+ <xwf:image>iVBORw0KGgoAAAANSUhEUgAAApYAAAEYCAYAAADmoLY/AAANdklEQVR42u3dy3XbRhiAUfWS1rxL
+L9mnCjeSEniycBneMLZj+dAQBpjHD2BmcMfnLiRKJAS+Pg8efPvy5d8nAAC0erMSAAAQlgAACEsA
+AIQlAAAISwAAhCUAAMISAABhCQAAwhIAAGEJAICwBABAWAIAgLAEAEBYAgAgLAEAQFgCACAsAQAQ
+lgAACEsAABCWAAAISwAAhCUAAMISAACEJQAAwhIAAGEJAICwBAAAYQkAgLAEAEBYAgCAsAQAQFgC
+ACAsAQAQlgAAICwBABCWAAAISwAAhCUAAAhLAACEJQAAwhIAAGEJAADCEgAAYQkAgLAEAABhCQDA
+WGH59vZGZzzwAYBhw/Lvf550QlgCAMISYQkACEtBJywBAGEpLIUlAICwRFgCAMISYQkACEthKSwB
+AGF5Yli2Buf7ORnForAEAIRlUxyJRGEJAAjL3+Lw9RNhUrOSr5elfn7r+2sznFu3KywBAAYLy1QE
+rs1K5l629rMlPy8sAQAm2BR+VFju3bawBACYPCyXIsMydd3CEgBg8hnLkhnH0hlL+1gCANxoH0th
+KSwBAGEZclR4yebtnIi0KRwAYJKwRFgCAMJSWApLAIBrwvLr4xOdEJYAgLBEWAIAwjIyjB6Px60I
+SwBAWApLYQkACEthKSwBAISlsBSWAICwFJb1Yfn285+wBACEpbAMCcu9wBSWAICwFJZFYZkKTGEJ
+AAhLYVkVlsvAFJYAgLDMDMvvt/cqIu5eryvqOs8Oy1//3tI8IQAAYfkSgNFhd3ZIXjljKTgBAGGZ
+GYCpmczX2cjXy9Z+fu13o2dIe9vHUmQCAMJy4/K1gExdtvV7R89u9nZUuLgEAIRlZSCOFpZnnMdS
+XAIAwnLisDzzk3eEJQAgLIWlTeEAgLBsPSr86LC8+uAdYQkACMsTz2O5d1R4zazk0ee47CksRSUA
+cKuwvNLMYSkqAQBheXBIHnkOy17CUlQCAFOGJeeGpagEAIQlzWEpKgGA7sKSvuTeZ54gAEBXYclA
+DwZBCQAISwQlACAsEZQAgLBEUAIACEtBCQAgLBGUAICwRFACAMISQQkAICwFJQCAsERQAgDCEkEJ
+AAhLBCUAgLAUlAAAwhJBCQAIS4JDUlACAMISM5MAgLBEUAIACEtBCQAgLAUlAICwxME4AADCssa3
+OvzAzCQAICythOaofI1LM5MAgLCkOSzFJAAgLGmOyqeoBACEpZUQuSkcAEBYIiwBAITlwStpcUCO
+qAQAEJZVQWldAAAIy+qZSUEJACAszUwCANw1LK/aZ1FQAgAIS0EJACAs96PyudjXESCaNwCAG81Y
+GoZhHDWEJYCwNAzDEJYAwjJ/30fDMAxhCSAshaVhGMISQFgKS8MwhCUAwtIwDENYAghLYWkYhrAE
+EJYnheXWeehef+YOb4Rrf3vk9fe4fDn3v5G+P696/vR+XwlLADOWXbxBXbEMI0TUchlbljn1u2Ky
+bR2etf62bqeX+1BYAgjLrOBYztQsZ1C2Zlb2Lkv97Nb3c5dl6zZy1kvpda79fu51bt3W1te5y7h1
+f5Q8JnL+/ppZtdr13bI8qcfS1mP1qufP3n1y9vNHWAIIy6aw3Ps6J4ZyZ832rqNkWaKXpyQAI26r
+9rLc2c6asKxdrpqZ2Zzbi1pPe7/XEpYzPn+EJcCNwrJkliF3xiU6hkpmDyOWJTcYIq4zMmKPWMba
+5dq77ojN9yV/S8vyRKzDM58/NbF39PNHWAJMHpbvbzxHbAqviaHaN8bcgyKOCKyagzL2YjJnFrBk
+c33PYVlzkEnJOii9vOaxdGVY5qy/nGU98/kjLAEmC8tlUF4Zlq2zUq0zOtEhUPL7NWEZccBGdFiW
+zLy2Hg3d8re0LM8IM5ajPH+EJcAkYZkKSmFZv6+hsNz+myLu/6v2sWx5nN0xLO1jCXCTsNwLyqvC
+cm8zXO4bdGqTYM2b6N6ytGxKrF0vrbeVezBN7Yxbzibx0nVXsil8eX9HHRVesz9j1FHhLc+f0qP7
+j37+CEuAicKy5AX8zucpdI7G+HXYei7NmuB0H4/x/BGWAAOGZemLt7A0Itff2etUWApLAGHZSVS+
+/87XxyeAQwlLgIHCsvZFW1gCwhJAWDZHpbAEhCWAsAyJSmEJCEsAYRkSlcISEJYAwlJYAsISgN7C
+8vmDNz6gKhh//hOWAPax/BWWAhNoCcu9wBSWAAMdFV5/uqHnKm+YQE1YpgJTWAIMeIL0NTVhKTCB
+lrBcBqawBBgsLEuD83/PLN5AgZqw/PWv8D+9AHQalmYsgR5nLMUmwE3C0hsmcMU+liITYKKw9EYJ
+9HJUuLgEGDQsvUECPZ7HUlwCDBWWPnkH6PeTd4QlgLAEEJYAwhKgj7AUlQDCEkBYAghLgD7CUlQC
+CEuA5rAUlQDCEuCDtU9gEJUAwhLg0LAUlQAThCXAEVKfGSsqASYNS4Aj5YSlqAQQlgBNYfk+s2k9
+AQhLgKbdcKwHAGEJ0Lxft3UBICwBBCWAsASw2RtAWAKISgCEJWDTNwDCEkBQAghLAEEJICwBBCUA
+whIQlAAISwBBCSAsAQQlgLAEEJQACEtAUAIgLAEEJYCwBBCUAAhLQFACICwBQQmAsAQQlADCEkBQ
+AiAsAUEJgLAEBCUAwhIQlNYFgLAEEJQACEtAUAIgLAFBCYCwBG4Wk4ISAGEJmJ0EQFgCghIAYQkI
+SgCEJSAoAUBYAoISAGEJCEoAhCUgKAEQlsC4vpXiB4ISAGEJNEfla1wKSgCEJdAcloISAGEJNEfl
+U1QCICyByE3hACAsgayju4UlAMISaArK0qPCAUBYAo7uBkBYAoISAGEJCEoAEJYgKAFAWIKgtC4A
+EJaAoARAWAKCEgCEJYwXk4ISAGEJmJ0EOPg/3vRBWIKgBBj29fKPP/+iE8ISBCWAsERYgqAE8Pop
+6IQlICgBhKWwBAQlgLBEWIKgBBCWCEsQlAAIS2EJghIAYSkshSUISoDZw1KgCkso8u3R/sFRL3LW
+N8C1Yfn+/ff/6L9+P/d7qfBcu+7U7QlLYYmwNEsJMEFYbsVhKhZzf3bt8q3rE5bCksmj8unzXIGB
+P2uZvBnLo8Ky5LqFpbDkLnFpGIbR2RCWx4blkrAUliAsDcMQljTPWJaEobAUlpB8ETIMwxCWwrJ2
+n0phKSxBWBqGISxvHpZrm8P34nB51LewFJYgLA3DEJbOY4mwBGFpGIawRFgKSxCWhmEYwvKE1/Sv
+j090QlgiLH++kKe8/swd3tDW/vbI6+9x+XLufyN9f171/BnlvipdTmEpLIUlTDRj2cMb1BXLMEJE
+LZexZZlTvysm29bhWetv63Z6vw9zXoO8Vl8Xlo/H41aEJVwUlmuzL2uzMnszonuXpX526/u5y7J1
+GznrpfQ6134/9zq3bmvr69xl3Lo/Sh4TOX9/zaxa7fpuWZ7UY2nrsXrV82fvPjn7+SMshaWwFJbc
+9AUoKiz3vs6JodxZs73rKFmW6OUpCcCI26q9LHe2syYsa5erZmY25/ai1tPe77WE5YzPH2EpLIWl
+sORmLz7RM5bRMVTyxhOxLLnBEHGdkRF7xDLWLtfedUeHSOntRcZ5a4RHP39qY+/I50/ELifCUlgK
+SxhglvKITeE1MVT7xph7UMQRgVVzUMZeTObMApZsru85LGsOMilZB6WX1zyWrgzLnPWXs6xnPn9a
+9v0UloUf1/v58w/CUljCqUF5ZVi2zkq1zuhEh0DJ79eEZcQBG9FhWTLz2no0dMvf0rI8I8xYjvL8
+aQ1Qr+HlYRkVmMJSWEJys/fRB++M+MZYs6+hsNz+myLu/6v2sWx5nN0xLCP2mRWWx4Zla2AKS2EJ
+2VF5RVjubYbLfYNObRKseRPdW5aWTYm166X1tnIPpqmdccvZJF667ko2hS/v76ijwmv2Z4w6Krzl
++VN6dP/Rz5+a+1JYHhuWtYEpLIUlZEfl3T95xzka49dh67k0ayLFfdzn8yfqhO13CMutk+qX2gvL
+0sBci6/vt7P3/dTPCEthycRRKSxFR/T6O3udCsv5nz+jhmVJDI42Y5kTlmYshSU3jEof/wXM8pF4
+vYXk7PtYLiMy5+t3tdchLKHzqBSWgLBsD7eelvGso8JLojB1mbAUlkwWlcISEJYxm5nveB7LVCDm
+huXadWxdp7AEYQkgLCf95J2SsFwSlsKSCaNSWALCMuagGGFZd4S4sBSWCEsAM5bCMuzUQz3sWyks
+ISwsnz94AwPOlLsvoLAcPyzXNocLS2HJtPtYPn/jDQ84Myz3ArOXsNw6AXlv7wNnhqVP3hGW3OgT
+HGrCUmACV4RlKjCvCstezkspLIUlDHXC3lRYCkzgirBcBmZ01F3xaTgjhyXCEgpfUJ9ZvEAAZ4bl
+68nHI93hdd7jS1jChS9CghK4z4zlPScQuJKwRFgKSuDm+1jCqe/FVgKzhqU3PMBR4SAswXksAeex
+BGEJdvQGEJYISxCWAMIShCUIS0BYgrAEYQkISxCWICwBhCUIS4QlgLAEYQnCEhjmdEQrn9zgNRth
+CcISQFiCsOQuYQnQk9RnzXrNRlgCAMWEJcISABCWICwBABCWAAAISwAAhKUVAQCAsAQAQFgCACAs
+AQDgd/8B2MLNSngBKtIAAAAASUVORK5CYII=
+</xwf:image>
+</xwf:workflow>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/resources/axis2_default.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/resources/axis2_default.xml b/modules/workflow-model/workflow-engine/src/test/resources/axis2_default.xml
new file mode 100644
index 0000000..aee2d25
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/resources/axis2_default.xml
@@ -0,0 +1,278 @@
+<!--
+ ~ 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.
+ -->
+
+<axisconfig name="AxisJava2.0">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="hotdeployment">true</parameter>
+ <parameter name="hotupdate">false</parameter>
+ <parameter name="enableMTOM">false</parameter>
+
+ <!--If turned on with use the Accept header of the request to determine the contentType of the
+ response-->
+ <parameter name="httpContentNegotiation">false</parameter>
+
+ <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
+ <!--that behaviour.-->
+ <parameter name="sendStacktraceDetailsWithFaults">true</parameter>
+
+ <!--If there aren't any information available to find out the fault reason, we set the message of the exception-->
+ <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
+ <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
+ <!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
+ <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>
+
+ <!--This is the user name and password of admin console-->
+ <parameter name="userName">admin</parameter>
+ <parameter name="password">axis2</parameter>
+
+ <!--To override repository/services you need to uncomment following parameter and value SHOULD be absolute file path.-->
+ <!--ServicesDirectory only works on the following cases-->
+ <!---File based configurator and in that case the value should be a file URL (http:// not allowed)-->
+ <!---When creating URL Based configurator with URL “file://” -->
+ <!--- War based configurator with expanded case , -->
+
+ <!--All the other scenarios it will be ignored.-->
+ <!--<parameter name="ServicesDirectory">service</parameter>-->
+ <!--To override repository/modules you need to uncomment following parameter and value SHOULD be absolute file path-->
+ <!--<parameter name="ModulesDirectory">modules</parameter>-->
+
+ <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
+ <!--root which can configured using the following contextRoot parameter-->
+ <!--<parameter name="contextRoot">axis2</parameter>-->
+
+ <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distinguish those endpoints-->
+ <!--<parameter name="servicePath">services</parameter>-->
+ <!--<parameter name="restPath">rest</parameter>-->
+
+ <!-- Following parameter will completely disable REST handling in Axis2-->
+ <parameter name="disableREST" locked="false">false</parameter>
+
+ <!--POJO deployer , this will alow users to drop .class file and make that into a service-->
+ <deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
+ <deployer extension=".jar" directory="transports" class="org.apache.axis2.deployment.TransportDeployer"/>
+
+ <!-- Following parameter will set the host name for the epr-->
+ <!--<parameter name="hostname" locked="true">myhost.com</parameter>-->
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!--This is the Default Message Receiver for the system , if you want to have MessageReceivers for -->
+ <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+ <!--any operation -->
+ <!--Note : You can override this for particular service by adding the same element with your requirement-->
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </messageReceivers>
+
+ <!-- ================================================= -->
+ <!-- Message Formatter -->
+ <!-- ================================================= -->
+ <!--Following content type to message formatter mapping can be used to implement support for different message -->
+ <!--format serialization in Axis2. These message formats are expected to be resolved based on the content type. -->
+ <messageFormatters>
+ <messageFormatter contentType="application/x-www-form-urlencoded"
+ class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
+ <messageFormatter contentType="multipart/form-data"
+ class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
+ <messageFormatter contentType="application/xml"
+ class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
+ <messageFormatter contentType="text/xml"
+ class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
+ <messageFormatter contentType="application/soap+xml"
+ class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
+ </messageFormatters>
+
+ <!-- ================================================= -->
+ <!-- Message Builders -->
+ <!-- ================================================= -->
+ <!--Following content type to builder mapping can be used to implement support for different message -->
+ <!--formats in Axis2. These message formats are expected to be resolved based on the content type. -->
+ <messageBuilders>
+ <messageBuilder contentType="application/xml"
+ class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
+ <messageBuilder contentType="application/x-www-form-urlencoded"
+ class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
+ <!--Left commented because it adds the depandancy of servlet-api to other modules.
+ Please uncomment to Receive messages in multipart/form-data format-->
+ <!--<messageBuilder contentType="multipart/form-data"-->
+ <!--class="org.apache.axis2.builder.MultipartFormDataBuilder"/>-->
+ </messageBuilders>
+
+ <!-- ================================================= -->
+ <!-- Target Resolvers -->
+ <!-- ================================================= -->
+ <!-- Uncomment the following and specify the class name for your TargetResolver to add -->
+ <!-- a TargetResolver. TargetResolvers are used to process the To EPR for example to -->
+ <!-- choose a server in a cluster -->
+ <!--<targetResolvers>-->
+ <!--<targetResolver class="" />-->
+ <!--</targetResolvers>-->
+
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http"
+ class="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <parameter name="port">8080</parameter>
+ <!--If you want to give your own host address for EPR generation-->
+ <!--uncomment following parameter , and set as you required.-->
+ <!--<parameter name="hostname">http://myApp.com/ws</parameter>-->
+ </transportReceiver>
+
+ <!--Uncomment if you want to have TCP transport support-->
+ <!--<transportReceiver name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port">6061</parameter>-->
+ <!--If you want to give your own host address for EPR generation-->
+ <!--uncomment following parameter , and set as you required.-->
+ <!--<parameter name="hostname">tcp://myApp.com/ws</parameter>-->
+ <!--</transportReceiver>-->
+ <!--<transportSender name="tcp"-->
+ <!--class="org.apache.axis2.transport.tcp.TCPTransportSender"/>-->
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="local"
+ class="org.apache.axis2.transport.local.LocalTransportSender"/>
+ <transportSender name="http"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding">chunked</parameter>
+ </transportSender>
+ <transportSender name="https"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding">chunked</parameter>
+ </transportSender>
+ <!--<transportSender name="java"-->
+ <!--class="org.apache.axis2.transport.java.JavaTransportSender"/>-->
+
+
+ <!-- ================================================= -->
+ <!-- SOAP Role Configuration -->
+ <!-- ================================================= -->
+ <!-- Use the following pattern to configure this axis2
+ instance to act in particular roles. Note that in
+ the absence of any configuration, Axis2 will act
+ only in the ultimate receiver role -->
+ <!--
+ <SOAPRoleConfiguration isUltimateReceiver="true">
+ <role>http://my/custom/role</role>
+ </SOAPRoleConfiguration>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="InFlow">
+ <!-- System pre-defined phases -->
+ <phase name="Transport">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ </phase>
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+ <handler name="RequestURIOperationDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+
+ <handler name="HTTPLocationBasedDispatcher"
+ class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+ </phase>
+ <phase name="RMPhase"/>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or or service author can add any phase he want -->
+ <phase name="OperationInPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutPhase"/>
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <phase name="RMPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="InFaultFlow">
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+ <handler name="RequestURIOperationDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+
+ <handler name="HTTPLocationBasedDispatcher"
+ class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+ </phase>
+ <phase name="RMPhase"/>
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationInFaultPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFaultFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutFaultPhase"/>
+ <phase name="RMPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+</axisconfig>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-component/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-component/pom.xml b/modules/workflow-model/workflow-model-component/pom.xml
new file mode 100644
index 0000000..d7cbee3
--- /dev/null
+++ b/modules/workflow-model/workflow-model-component/pom.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-model-parent</artifactId>
+ <version>0.13-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>airavata-workflow-model-component</artifactId>
+ <packaging>jar</packaging>
+ <name>Airavata Workflow Component</name>
+ <url>http://airavata.apache.org/</url>
+
+ <!-- Edit the following properties. -->
+ <profiles>
+ <profile>
+ <id>collective</id>
+ <activation>
+ <file>
+ <exists>betacollective</exists>
+ </file>
+ </activation>
+ <properties>
+ <!-- Inherited from the parent in this collective build. -->
+ <ssl.trustedCertsFile>${trustedCertsLocation}</ssl.trustedCertsFile>
+ <build.scope>provided</build.scope>
+ <build.jsf>compile</build.jsf>
+ </properties>
+ </profile>
+ </profiles>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <configuration>
+ <includes>
+ <include>**/*Suite.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Test.java</exclude>
+ <exclude>**/*Tests.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>xsul</artifactId>
+ <version>${xsul.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-common-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-api-stubs</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${org.slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${org.slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-model-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentReference.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentReference.java b/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentReference.java
new file mode 100644
index 0000000..2adbb1b
--- /dev/null
+++ b/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentReference.java
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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.model.component.registry;
+
+import java.util.List;
+
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.workflow.model.component.Component;
+import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.component.ComponentReference;
+import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+import org.apache.airavata.workflow.model.component.ws.WSComponent;
+import org.apache.airavata.workflow.model.component.ws.WSComponentFactory;
+
+public class JCRComponentReference extends ComponentReference {
+
+ private ApplicationInterfaceDescription application;
+
+ private List<WSComponent> components;
+
+ public JCRComponentReference(String name, ApplicationInterfaceDescription application) {
+ super(name);
+ this.application=application;
+ }
+
+ /**
+ * @throws ComponentException
+ * @throws ComponentRegistryException
+ * @see org.apache.airavata.workflow.model.component.ComponentReference#getComponent()
+ */
+ @Override
+ @Deprecated
+ public Component getComponent() throws ComponentException, ComponentRegistryException {
+ return getComponents().get(0);
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.ComponentReference#getComponents()
+ */
+ @Override
+ public List<WSComponent> getComponents() throws ComponentRegistryException, ComponentException {
+ if (this.components == null) {
+ this.components = WSComponentFactory.createComponents(application);
+ }
+ return this.components;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java b/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
new file mode 100644
index 0000000..c1d3c65
--- /dev/null
+++ b/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
@@ -0,0 +1,78 @@
+/*
+ *
+ * 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.model.component.registry;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.airavata.api.Airavata;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.workflow.model.component.ComponentReference;
+import org.apache.airavata.workflow.model.component.ComponentRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JCRComponentRegistry extends ComponentRegistry {
+
+ private static final Logger log = LoggerFactory.getLogger(JCRComponentRegistry.class);
+ private static final String NAME = "Applications";
+ private Airavata.Client client;
+
+ public JCRComponentRegistry(Airavata.Client client) {
+ setClient(client);
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.registry.ComponentRegistry#getComponentReferenceList()
+ */
+ @Override
+ public List<ComponentReference> getComponentReferenceList() {
+ List<ComponentReference> tree = new ArrayList<ComponentReference>();
+ try {
+ List<ApplicationInterfaceDescription> allApplicationInterfaces = client.getAllApplicationInterfaces();
+ for (ApplicationInterfaceDescription interfaceDescription : allApplicationInterfaces) {
+ JCRComponentReference jcr = new JCRComponentReference(interfaceDescription.getApplicationName(),interfaceDescription);
+ tree.add(jcr);
+ }
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ }
+
+ return tree;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.model.component.registry.ComponentRegistry#getName()
+ */
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ public Airavata.Client getClient() {
+ return client;
+ }
+
+ public void setClient(Airavata.Client client) {
+ this.client = client;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/pom.xml b/modules/workflow-model/workflow-model-core/pom.xml
index e4db95a..a4ce300 100644
--- a/modules/workflow-model/workflow-model-core/pom.xml
+++ b/modules/workflow-model/workflow-model-core/pom.xml
@@ -64,6 +64,11 @@
<artifactId>airavata-common-utils</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-data-models</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/system/SubWorkflowComponent.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/system/SubWorkflowComponent.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/system/SubWorkflowComponent.java
index 15f61fb..7d532fd 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/system/SubWorkflowComponent.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/system/SubWorkflowComponent.java
@@ -34,7 +34,7 @@ public class SubWorkflowComponent extends WSComponent {
private Workflow workflow;
private SubWorkflowComponent(Workflow workflow) throws ComponentException {
- super(workflow.getWorkflowWSDL());
+// super(workflow.getWorkflowWSDL());
this.workflow = workflow;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/web/WebComponentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/web/WebComponentRegistry.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/web/WebComponentRegistry.java
index 69f6666..3f66877 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/web/WebComponentRegistry.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/web/WebComponentRegistry.java
@@ -160,9 +160,6 @@ public class WebComponentRegistry extends ComponentRegistry {
} catch (IOException e) {
// Ignore
logger.error(e.getMessage(), e);
- } catch (ComponentException e) {
- // Malformed WSDL.
- logger.error(e.getMessage(), e);
} catch (RuntimeException e) {
logger.error(e.getMessage(), e);
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java
index 3f5d2c1..ccdaaba 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponent.java
@@ -21,45 +21,34 @@
package org.apache.airavata.workflow.model.component.ws;
-import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
-import org.apache.airavata.common.exception.UtilsException;
import org.apache.airavata.common.utils.WSConstants;
-import org.apache.airavata.common.utils.WSDLUtil;
-import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.workflow.model.component.Component;
import org.apache.airavata.workflow.model.component.ComponentControlPort;
import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.gpel.DSCUtil;
import org.apache.airavata.workflow.model.graph.Graph;
import org.apache.airavata.workflow.model.graph.Node;
import org.apache.airavata.workflow.model.graph.ws.WSNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlCharacters;
import org.xmlpull.infoset.XmlElement;
+import org.xmlpull.infoset.XmlNamespace;
-import xsul5.wsdl.WsdlDefinitions;
-import xsul5.wsdl.WsdlDocumentation;
-import xsul5.wsdl.WsdlMessage;
-import xsul5.wsdl.WsdlMessagePart;
-import xsul5.wsdl.WsdlPortType;
-import xsul5.wsdl.WsdlPortTypeInput;
-import xsul5.wsdl.WsdlPortTypeOperation;
-import xsul5.wsdl.WsdlPortTypeOutput;
+import xsul5.XmlConstants;
public class WSComponent extends Component {
private static final Logger logger = LoggerFactory.getLogger(WSComponent.class);
- protected WsdlDefinitions wsdl;
-
- protected QName wsdlQName;
-
+ private ApplicationInterfaceDescription application;
+
/**
* The list of output component ports.
*/
@@ -74,8 +63,6 @@ public class WSComponent extends Component {
private String operationName;
- private String targetNamespace;
-
private QName portTypeQName;
private String inputPartName;
@@ -93,74 +80,54 @@ public class WSComponent extends Component {
/**
* Constructs a WSComponent.
*
- * @param componentPath
- * @param wsdl
- * @throws ComponentException
- */
- public WSComponent(WsdlDefinitions wsdl) throws ComponentException {
- // This constructor is called only from WorkflowComponent where we know
- // that there is only one operation in WSDL.
- this(wsdl, null, null);
- }
-
- /**
- * Constructs a WSComponent.
- *
* @param wsdl
* @param portTypeQName
* @param operationName
* @throws ComponentException
*/
- public WSComponent(WsdlDefinitions wsdl, QName portTypeQName, String operationName) throws ComponentException {
+ public WSComponent(ApplicationInterfaceDescription application, String operationName) throws ComponentException {
+ this.operationName = operationName;
+ this.description = application.getApplicationDesription();
+ this.setApplication(application);
+ setName(application.getApplicationName());
+
this.inputs = new ArrayList<WSComponentPort>();
this.outputs = new ArrayList<WSComponentPort>();
+
+ List<InputDataObjectType> applicationInputs = application.getApplicationInputs();
+ for (InputDataObjectType inputDataObjectType : applicationInputs) {
+
+ String typeName = inputDataObjectType.getType().toString().toLowerCase();
+ XmlNamespace namespace = null;
+ namespace = XmlConstants.BUILDER.newNamespace("xsd", WSConstants.XSD_NS_URI);
+ String prefix = "xsd";
+ QName type = new QName(namespace.getName(), typeName, prefix);
+
+ WSComponentPort port = new WSComponentPort(inputDataObjectType.getName(),type , this);
+ port.setDescription(inputDataObjectType.getUserFriendlyDescription());
+ port.setDefaultValue(inputDataObjectType.getValue());
+ inputs.add(port);
+ }
- try {
- this.wsdl = wsdl;
- if (portTypeQName == null) {
- portTypeQName = WSDLUtil.getFirstPortTypeQName(wsdl);
- }
- this.portTypeQName = portTypeQName;
- if (operationName == null) {
- operationName = WSDLUtil.getFirstOperationName(wsdl, this.portTypeQName);
- }
- this.operationName = operationName;
- this.description = ""; // To prevent to show null
-
- setName(this.portTypeQName.getLocalPart() + ":" + this.operationName);
-
- parse();
- } catch (UtilsException e) {
- e.printStackTrace();
- }
+ List<OutputDataObjectType> applicationOutputs = application.getApplicationOutputs();
+ for (OutputDataObjectType outputDataObjectType : applicationOutputs) {
+
+ String typeName = outputDataObjectType.getType().toString().toLowerCase();
+ XmlNamespace namespace = null;
+ namespace = XmlConstants.BUILDER.newNamespace("xsd", WSConstants.XSD_NS_URI);
+ String prefix = "xsd";
+ QName type = new QName(namespace.getName(), typeName, prefix);
+
+ WSComponentPort port = new WSComponentPort(outputDataObjectType.getName(),type , this);
+ port.setDefaultValue(outputDataObjectType.getValue());
+ outputs.add(port);
+ }
this.controlInPort = new ComponentControlPort();
this.controlOutPorts.add(new ComponentControlPort());
}
- /**
- * @return The WSDL
- */
- public WsdlDefinitions getWSDL() {
- return this.wsdl;
- }
- public WsdlDefinitions getConcreteWSDL(URI dscUri) {
- if (WSDLUtil.isAWSDL(this.wsdl)) {
- return DSCUtil.convertToCWSDL(this.wsdl, dscUri);
- } else {
- return this.wsdl;
- }
- }
-
- /**
- * Returns the QName of the WSDL.
- *
- * @return The QName of the WSDL.
- */
- public QName getWSDLQName() {
- return this.wsdlQName;
- }
/**
* Returns the QName of the portType.
@@ -267,7 +234,7 @@ public class WSComponent extends Component {
StringBuffer buf = new StringBuffer();
buf.append("<html>\n");
- buf.append("<h1>Service: " + getName() + "</h1>\n");
+ buf.append("<h1>Application: " + getName() + "</h1>\n");
buf.append("<h2>Description:</h2>\n");
buf.append(this.description);
@@ -286,20 +253,6 @@ public class WSComponent extends Component {
return buf.toString();
}
- /**
- * @return The XML Element.
- */
- public XmlElement toXML() {
- return this.wsdl.xml();
- }
-
- /**
- * @return The WSDL in String.
- */
- public String toXMLText() {
- return this.wsdl.xmlStringPretty();
- }
-
private void messageToHtml(List<WSComponentPort> ports, StringBuffer buf) {
buf.append("<dl>\n");
for (WSComponentPort port : ports) {
@@ -312,196 +265,16 @@ public class WSComponent extends Component {
buf.append("</dl>\n");
}
- private void parse() throws ComponentException {
-
- // The name of WSDL changes even with the same portType.
- // this.name = this.definitions.getAttributeValue(null, "name");
-
- this.targetNamespace = this.wsdl.getTargetNamespace();
-
- String wsdlName = this.wsdl.xml().attributeValue(WSConstants.NAME_ATTRIBUTE);
- if (wsdlName == null) {
- wsdlName = "NoName"; // TODO
- }
- this.wsdlQName = new QName(this.targetNamespace, wsdlName);
-
- WsdlDocumentation documentation = this.wsdl.getDocumentation();
- if (documentation != null) {
- StringBuffer buf = new StringBuffer();
- for (Object child : documentation.xml().children()) {
- if (child instanceof String) {
- buf.append(child.toString());
- } else if (child instanceof XmlCharacters) {
- buf.append(((XmlCharacters) child).getText());
- }
- }
- this.description = buf.toString();
- }
-
- WsdlPortType portType = this.wsdl.getPortType(this.portTypeQName.getLocalPart());
- if (portType == null) {
- throw new ComponentException("portType, " + this.portTypeQName + " is not defined.");
- }
- parsePortType(portType);
- }
-
- private void parsePortType(WsdlPortType portType) throws ComponentException {
- WsdlPortTypeOperation operation = portType.getOperation(this.operationName);
- if (operation == null) {
- throw new ComponentException("Operation, " + this.operationName + " is not defined.");
- }
- parseOperation(operation);
- }
-
- private void parseOperation(WsdlPortTypeOperation operation) throws ComponentException {
-
- WsdlPortTypeInput input = operation.getInput();
- // No input is possible.
- if (input != null) {
- WsdlMessage inputMessage = input.lookupMessage();
- this.inputs = parseMessage(inputMessage, true);
- }
-
- WsdlPortTypeOutput output = operation.getOutput();
- // No output is possible.
- if (output != null) {
- WsdlMessage outputMessage = output.lookupMessage();
- this.outputs = parseMessage(outputMessage, false);
- }
- }
-
- private List<WSComponentPort> parseMessage(WsdlMessage message, boolean input) throws ComponentException {
- List<WSComponentPort> parts = new ArrayList<WSComponentPort>();
- for (WsdlMessagePart part : message.parts()) {
- String partName = part.getName();
- if (input) {
- this.inputPartName = partName;
- } else {
- this.outputPartName = partName;
- }
+ public XmlElement toXML() {
+ return null;
+ }
- QName partElement = part.getElement();
- if (partElement == null) {
- // In case type is used directly. This is an old way.
- QName partType = part.getType();
- if (partType != null) {
- parts.add(new WSComponentPort(partName, partType, this));
- }
-
- } else {
- String typeName = partElement.getLocalPart();
- if (input) {
- this.inputTypeName = typeName;
- } else {
- this.outputTypeName = typeName;
- }
- parseType(typeName, parts);
- }
- }
- return parts;
- }
+ public ApplicationInterfaceDescription getApplication() {
+ return application;
+ }
- private void parseType(String typeName, List<WSComponentPort> parts) throws ComponentException {
+ public void setApplication(ApplicationInterfaceDescription application) {
+ this.application = application;
+ }
- XmlElement typesElement = this.wsdl.getTypes();
- if (typesElement == null) {
- throw new ComponentException("No types is defined.");
- }
-
- if (typesElement.element(null, WSConstants.SCHEMA_TAG) == null) {
- throw new ComponentException("No schema is defined.");
- }
-
- XmlElement elementElement = null;
- XmlElement schemaElement = null;
-
- Iterable<XmlElement> schemaElements = typesElement.elements(null, WSConstants.SCHEMA_TAG);
- for (XmlElement elemt : schemaElements) {
- schemaElement = elemt;
- elementElement = findElementElement(typeName, elemt);
- if (null != elementElement) {
- break;
- }
- }
-
- if (elementElement == null) {
- throw new ComponentException("No element is defined for " + typeName);
- }
- String typesTargetNamespace = schemaElement.attributeValue(WSConstants.TARGET_NAMESPACE_ATTRIBUTE);
- String elementType = elementElement.attributeValue(WSConstants.TYPE_ATTRIBUTE);
-
- XmlElement sequenceElement;
- if (elementType == null) {
- // anonymous type
- XmlElement complexElement = elementElement.element(null, WSConstants.COMPLEX_TYPE_TAG);
- if (complexElement == null) {
- throw new ComponentException("We only support complexType as annonymous type: "
- + XMLUtil.xmlElementToString(elementElement));
- }
- sequenceElement = complexElement.element(null, WSConstants.SEQUENCE_TAG);
- // TODO Check if there is any other defined.
- } else {
- // named complexType
- String elementTypeName = XMLUtil.getLocalPartOfQName(elementType);
- XmlElement typeElement = findTypeElement(elementTypeName, schemaElement);
- sequenceElement = typeElement.element(null, WSConstants.SEQUENCE_TAG);
- // TODO Check if there is any other defined.
- }
-
- if (sequenceElement == null) {
- // Assume that there is no input/output.
- logger.debug("There is no sequence defined.");
- } else {
- // Only supports elements in the sequence now.
- for (XmlElement element : sequenceElement.elements(null, WSConstants.ELEMENT_TAG)) {
- WSComponentPort componentPort = new WSComponentPort(element, typesTargetNamespace, this);
- // Check if the type is defined in types
- QName paramType = componentPort.getType();
- if (!(WSConstants.XSD_NS_URI.equalsIgnoreCase(paramType.getNamespaceURI()))) {
- XmlElement typeDefinition = null;
- try {
- typeDefinition = WSDLUtil.getTypeDefinition(this.wsdl, paramType);
- } catch (UtilsException e) {
- e.printStackTrace();
- }
- if (typeDefinition == null) {
- throw new ComponentException("could not find definition for type " + paramType + " in "
- + this.wsdlQName);
- }
- }
- parts.add(componentPort);
- }
- }
- }
-
- /**
- * @param typeName
- * @param schemaElement
- * @return The XmlElement
- */
- private XmlElement findElementElement(String typeName, XmlElement schemaElement) {
- for (XmlElement element : schemaElement.elements(null, WSConstants.ELEMENT_TAG)) {
- String elementName = element.attributeValue(WSConstants.NAME_ATTRIBUTE);
- if (typeName.equals(elementName)) {
- return element;
- }
- }
- return null;
- }
-
- /**
- * @param typeName
- * @param schemaElement
- * @return The XmlElement
- */
- private XmlElement findTypeElement(String typeName, XmlElement schemaElement) {
- // Only supports complexType now
- for (XmlElement complexTypeElement : schemaElement.elements(null, WSConstants.COMPLEX_TYPE_TAG)) {
- String elementName = complexTypeElement.attributeValue(WSConstants.NAME_ATTRIBUTE);
- if (typeName.equals(elementName)) {
- return complexTypeElement;
- }
- }
- return null;
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java
index 97b10fc..8c8bacc 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentFactory.java
@@ -24,18 +24,9 @@ package org.apache.airavata.workflow.model.component.ws;
import java.util.ArrayList;
import java.util.List;
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.common.exception.UtilsException;
-import org.apache.airavata.common.utils.WSDLUtil;
-import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
import org.apache.airavata.workflow.model.component.ComponentException;
import org.apache.airavata.workflow.model.utils.MessageConstants;
-import org.xmlpull.infoset.XmlElement;
-
-import xsul5.wsdl.WsdlDefinitions;
-import xsul5.wsdl.WsdlPortType;
-import xsul5.wsdl.WsdlPortTypeOperation;
public class WSComponentFactory {
@@ -44,70 +35,12 @@ public class WSComponentFactory {
* @return The list of components in the specified WSDL.
* @throws ComponentException
*/
- public static List<WSComponent> createComponents(String wsdlString) throws ComponentException {
- try {
- return createComponents(XMLUtil.stringToXmlElement(wsdlString));
- } catch (RuntimeException e) {
- throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
- }
-
- }
-
- /**
- * @param componentElement
- * @return The list of components in the specified WSDL.
- * @throws ComponentException
- */
- public static List<WSComponent> createComponents(XmlElement componentElement) throws ComponentException {
- try {
- WsdlDefinitions definitions = new WsdlDefinitions(componentElement);
- return createComponents(definitions);
- } catch (RuntimeException e) {
- throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
- }
- }
-
- /**
- * @param wsdl
- * @return The list of components in the specified WSDL.
- * @throws ComponentException
- */
- public static List<WSComponent> createComponents(WsdlDefinitions wsdl) throws ComponentException {
- List<WSComponent> components = new ArrayList<WSComponent>();
- try {
- QName portTypeQName = WSDLUtil.getFirstPortTypeQName(wsdl);
- WsdlPortType portType = wsdl.getPortType(portTypeQName.getLocalPart());
- for (WsdlPortTypeOperation operation : portType.operations()) {
- String operationName = operation.getOperationName();
- WSComponent component = createComponent(wsdl, portTypeQName, operationName);
- components.add(component);
- }
- } catch (Exception e) {
- throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
- }
+ public static List<WSComponent> createComponents(ApplicationInterfaceDescription application) throws ComponentException {
+ List<WSComponent> components = new ArrayList<WSComponent>();
+ WSComponent component = createComponent(application, application.getApplicationInterfaceId());
+ components.add(component);
return components;
- }
- /**
- * Creates a WSComponent.
- *
- * @param wsdlString
- * The string representation of the component
- * @return The WsdlComponent created
- * @throws ComponentException
- */
- @Deprecated
- public static WSComponent createComponent(String wsdlString) throws ComponentException {
- return createComponents(wsdlString).get(0);
- }
-
- /**
- * @param wsdl
- * @return The Component created
- * @throws ComponentException
- */
- public static WSComponent createComponent(WsdlDefinitions wsdl) throws ComponentException {
- return createComponent(wsdl, null, null);
}
/**
@@ -117,31 +50,24 @@ public class WSComponentFactory {
* @return The component created.
* @throws ComponentException
*/
- public static WSComponent createComponent(WsdlDefinitions wsdl, QName portTypeQName, String operationName)
+ public static WSComponent createComponent(ApplicationInterfaceDescription application, String operationName)
throws ComponentException {
try {
- if (portTypeQName == null) {
- portTypeQName = WSDLUtil.getFirstPortTypeQName(wsdl);
- }
- if (operationName == null) {
- operationName = WSDLUtil.getFirstOperationName(wsdl, portTypeQName);
- }
-
- // check if it's WSComponent or WorkflowComponent
- WsdlPortType portType = wsdl.getPortType(portTypeQName.getLocalPart());
- XmlElement templateIDElement = portType.xml().element(WorkflowComponent.GPEL_NAMESPACE,
- WorkflowComponent.WORKFLOW_TEMPLATE_ID_TAG);
WSComponent component;
- if (templateIDElement == null) {
- component = new WSComponent(wsdl, portTypeQName, operationName);
- } else {
- component = new WorkflowComponent(wsdl, portTypeQName, operationName);
- }
+ component = new WSComponent(application, operationName);
return component;
} catch (RuntimeException e) {
throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
- } catch (UtilsException e) {
- throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
}
}
+
+ public static List<WSComponent> createComponents(
+ xsul5.wsdl.WsdlDefinitions wsdlDefinitions3ToWsdlDefintions5) {
+ return null;
+ }
+
+ public static List<WSComponent> createComponents(String compString) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentPort.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentPort.java b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentPort.java
index 67f3b99..259744e 100644
--- a/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentPort.java
+++ b/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/ws/WSComponentPort.java
@@ -74,15 +74,6 @@ public class WSComponentPort extends ComponentDataPort {
this.schemaUsed = false;
}
- protected WSComponentPort(XmlElement element, String targetNamespace, WSComponent component)
- throws ComponentException {
- this.component = component;
- this.elementElement = element;
- this.targetNamespace = targetNamespace;
- this.schemaUsed = true;
- parse(element);
- }
-
/**
* @return The component
*/
@@ -189,20 +180,7 @@ public class WSComponentPort extends ComponentDataPort {
// TODO fix this.
this.type = WSConstants.XSD_ANY_TYPE;
} else {
- String typeName = XMLUtil.getLocalPartOfQName(typeQNameString);
- String prefix = XMLUtil.getPrefixOfQName(typeQNameString);
- XmlNamespace namespace = null;
- if (prefix == null) {
- if ("string".equals(typeName) || "int".equals(typeName)) {
- namespace = XmlConstants.BUILDER.newNamespace("xsd", WSConstants.XSD_NS_URI);
- prefix = "xsd";
- } else {
- throw new ComponentException("Namespace prefix, " + prefix + ", is not defined");
- }
- } else {
- namespace = element.lookupNamespaceByPrefix(prefix);
- }
- this.type = new QName(namespace.getName(), typeName, prefix);
+
}
// annotation
[5/9] introducing workflow support in airavata api + other related
modules
Posted by sa...@apache.org.
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/WorkflowInterpreterSkeleton2.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterSkeleton2.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterSkeleton2.java
new file mode 100644
index 0000000..8da619e
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreterSkeleton2.java
@@ -0,0 +1,498 @@
+package org.apache.airavata.workflow.engine.interpretor;
+///*
+// *
+// * 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.interpretor;
+//
+//import java.io.IOException;
+//import java.net.URI;
+//import java.net.URISyntaxException;
+//import java.net.URL;
+//import java.util.ArrayList;
+//import java.util.HashMap;
+//import java.util.Iterator;
+//import java.util.List;
+//import java.util.Map;
+//
+//import javax.xml.namespace.QName;
+//import javax.xml.stream.XMLInputFactory;
+//import javax.xml.stream.XMLStreamException;
+//import javax.xml.stream.XMLStreamReader;
+//
+//import org.apache.airavata.client.AiravataAPIFactory;
+//import org.apache.airavata.client.api.AiravataAPI;
+//import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+//import org.apache.airavata.client.stub.interpretor.NameValue;
+//import org.apache.airavata.client.tools.PeriodicExecutorThread;
+//import org.apache.airavata.common.exception.ApplicationSettingsException;
+//import org.apache.airavata.common.utils.ServerSettings;
+//import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
+//import org.apache.airavata.model.workspace.experiment.Experiment;
+//import org.apache.airavata.orchestrator.cpi.OrchestratorService;
+//import org.apache.airavata.schemas.wec.ContextHeaderDocument;
+//import org.apache.airavata.workflow.model.component.ComponentException;
+//import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+//import org.apache.airavata.workflow.model.graph.GraphException;
+//import org.apache.airavata.workflow.model.graph.system.InputNode;
+//import org.apache.airavata.workflow.model.ode.ODEClient;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
+//import org.apache.airavata.ws.monitor.MonitorException;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.XBayaConstants;
+//import org.apache.airavata.xbaya.concurrent.PredicatedTaskRunner;
+//import org.apache.axiom.om.OMElement;
+//import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+//import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
+//import org.apache.axiom.soap.SOAPHeader;
+//import org.apache.axis2.context.ConfigurationContext;
+//import org.apache.axis2.context.MessageContext;
+//import org.apache.axis2.description.AxisService;
+//import org.apache.xmlbeans.XmlException;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+////import org.apache.airavata.registry.api.AiravataRegistry2;
+//
+///**
+// * WorkflowInterpretorSkeleton java skeleton for the axisService
+// */
+//public class WorkflowInterpreterSkeleton2 {
+// private static final Logger log = LoggerFactory.getLogger(WorkflowInterpreterSkeleton2.class);
+//
+//// public static final String PROXYSERVER = "myproxy.url";
+// public static final String MSGBOX = "msgbox";
+// public static final String GFAC = "gfac";
+// public static final String BROKER = "broker";
+// public static final String MYPROXY_USER = "myproxy.user";
+// public static final String MYPROXY_PASS = "myproxy.pass";
+// public static final String MYPROXY_SERVER = "myproxy.server";
+// public static final String MYPROXY_LIFETIME = "myproxy.life";
+// public static final String TRUSTED_CERT_LOCATION = "trusted.cert.location";
+//
+// public static boolean provenance = false;
+// public static final String PROVENANCE = "provenance";
+// public static String systemUserName = "";
+// public static String systemUserPW = "";
+// public static boolean runInThread = false;
+// public static final String RUN_IN_THREAD = "runInThread";
+// public static Boolean gfacEmbeddedMode = true;
+// private static PredicatedTaskRunner runner = null;
+//// public static JCRComponentRegistry jcrComponentRegistry = null;
+// private static AiravataAPI airavataAPI=null;
+// public static int provenanceWriterThreadPoolSize = 1;
+// public static final String PROVENANCE_WRITER_THREAD_POOL_SIZE = "provenanceWriterThreadPoolSize";
+// public static final int JCR_AVAIALABILITY_WAIT_INTERVAL = 1000 * 10;
+// public static final String GFAC_EMBEDDED = "gfac.embedded";
+// public static ConfigurationContext configurationContext;
+// public static final String SERVICE_NAME="WorkflowInterpretor";
+// public static boolean notInterrupted = true;
+// public Map<String, WorkflowInterpreterConfiguration> workflowConfigurations=new HashMap<String, WorkflowInterpreterConfiguration>();
+// private WorkflowInterpreterInteractor interactor;
+// private String gateway;
+//
+// protected static final String SERVICE_URL = "interpreter_service_url";
+//
+// protected static final String JCR_REG = "jcr_registry";
+//
+// protected WIServiceThread thread;
+//
+// private AiravataAPI getAiravataAPI(){
+// if (airavataAPI==null) {
+// try {
+// systemUserName = ServerSettings.getSystemUser();
+// systemUserPW = ServerSettings.getSystemUserPassword();
+// gateway = ServerSettings.getSystemUserGateway();
+// airavataAPI = AiravataAPIFactory.getAPI(gateway, systemUserName);
+// } catch (ApplicationSettingsException e) {
+// log.error("Unable to read the properties file", e);
+// } catch (AiravataAPIInvocationException e) {
+// log.error("Unable to create Airavata API", e);
+// }
+// }
+// return airavataAPI;
+// }
+//
+// private WorkflowInterpreterInteractor getInteractor(){
+// if (interactor==null){
+// interactor=new SSWorkflowInterpreterInteractorImpl();
+// }
+// return interactor;
+// }
+//
+//
+// public void suspendWorkflow(String experimentId)throws Exception{
+// if (workflowConfigurations.containsKey(experimentId)){
+// if (getInteractor().isExecutionPaused(workflowConfigurations.get(experimentId))){
+// throw new Exception("Experiment '"+experimentId+"' is already paused!!!");
+// }else{
+// log.info("Suspending workflow execution "+experimentId+"...");
+// getInteractor().pauseExecution(workflowConfigurations.get(experimentId));
+// }
+// }else{
+// throw new Exception("Invalid Experiment id: Experiment "+experimentId+" not running");
+// }
+// }
+//
+// public void resumeWorkflow(String experimentId)throws Exception{
+// if (workflowConfigurations.containsKey(experimentId)){
+// if (getInteractor().isExecutionPaused(workflowConfigurations.get(experimentId)) || workflowConfigurations.get(experimentId).getWorkflow().getExecutionState()==WorkflowExecutionState.STOPPED){
+// log.info("Resuming workflow execution "+experimentId+"...");
+// getInteractor().resumeExecution(workflowConfigurations.get(experimentId));
+//
+// }else{
+// throw new Exception("Experiment '"+experimentId+"' is not suspended!!!");
+// }
+// }else{
+// //TODO chk to see if the experiment is present in registry if so reload it and resume execution else error
+// throw new Exception("Invalid Experiment id: Experiment "+experimentId+" not running");
+// }
+// }
+//
+// public void haltWorkflow(String experimentId)throws Exception{
+// if (workflowConfigurations.containsKey(experimentId)){
+// log.info("Terminating workflow execution "+experimentId+"...");
+// getInteractor().terminateExecution(workflowConfigurations.get(experimentId));
+// }else{
+// throw new Exception("Invalid Experiment id: Experiment "+experimentId+" not running");
+// }
+// }
+//
+// /**
+// * @param workflowAsString
+// * @param topic
+// * @param inputs
+// * @return
+// * @throws XMLStreamException
+// */
+// public java.lang.String launchWorkflow(Experiment experiment, String workflowName, OrchestratorService.Client orchestratorClient) throws XMLStreamException {
+// OMElement workflowContext = getWorkflowContextHeader();
+// if(workflowContext == null){
+// workflowContext = AXIOMUtil.stringToOM("<wor:context-header xmlns:wor=\"http://airavata.apache.org/schemas/wec/2012/05\">\n" +
+// " <wor:soa-service-eprs>\n" +
+// " <wor:gfac-url></wor:gfac-url>\n" +
+// " <wor:registry-url></wor:registry-url>\n" +
+// " </wor:soa-service-eprs>\n" +
+// " <wor:workflow-monitoring-context>\n" +
+// " <wor:experiment-id></wor:experiment-id>\n" +
+// " <wor:workflow-instance-id xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\" />\n" +
+// " <wor:event-publish-epr></wor:event-publish-epr>\n" +
+// " <wor:msg-box-epr></wor:msg-box-epr>\n" +
+// " </wor:workflow-monitoring-context>\n" +
+// " <wor:workflow-scheduling-context />\n" +
+// " <wor:security-context />\n" +
+// "</wor:context-header>");
+// }
+// Map<String, String> configuration = new HashMap<String, String>();
+// WorkflowContextHeaderBuilder workflowContextHeaderBuilder = parseContextHeader(workflowContext, configuration);
+// String user = workflowContextHeaderBuilder.getSubmissionUser();
+//
+// String s = null;
+// try {
+// s = setupAndLaunch(workflowAsString, topic, ServerSettings.getSystemUserGateway(),
+// user,inputs, configuration, runInThread, workflowContextHeaderBuilder);
+// } catch (AiravataAPIInvocationException e) {
+// log.error(e.getMessage());
+// } catch (ApplicationSettingsException e) {
+// log.error(e.getMessage());
+// }
+// return s;
+// }
+//
+// private OMElement getWorkflowContextHeader() {
+// MessageContext currentMessageContext = MessageContext.getCurrentMessageContext();
+// SOAPHeader header = currentMessageContext.getEnvelope().getHeader();
+// Iterator<?> childrenWithName = header.getChildrenWithName(new QName("http://airavata.apache.org/schemas/wec/2012/05", "context-header"));
+// if (childrenWithName.hasNext()) {
+// return (OMElement) childrenWithName.next();
+// } else {
+// return null;
+// }
+// }
+//
+// private WorkflowContextHeaderBuilder parseContextHeader(OMElement workflowContext, Map<String, String> configuration) throws XMLStreamException {
+// ContextHeaderDocument parse = null;
+// try {
+// parse = ContextHeaderDocument.Factory.parse(workflowContext.toStringWithConsume());
+// String msgBox = parse.getContextHeader().getWorkflowMonitoringContext().getMsgBoxEpr();
+// if(msgBox == null || "".equals(msgBox)){
+// msgBox = getAiravataAPI().getAiravataManager().getMessageBoxServiceURL().toASCIIString();
+// }
+// String msgBroker = parse.getContextHeader().getWorkflowMonitoringContext().getEventPublishEpr();
+// if(msgBroker == null || "".equals(msgBroker)){
+// msgBroker = getAiravataAPI().getAiravataManager().getEventingServiceURL().toASCIIString();
+// }
+// String gfac = parse.getContextHeader().getSoaServiceEprs().getGfacUrl();
+//// if(gfac == null || "".equals(gfac)){
+//// gfac = getAiravataAPI().getAiravataManager().getGFaCURLs().get(0).toString();
+//// }
+// configuration.put(BROKER, msgBroker);
+// configuration.put(GFAC, gfac);
+// configuration.put(MSGBOX, msgBox);
+// } catch (XmlException e) {
+// log.error(e.getMessage());
+// } catch (AiravataAPIInvocationException e) {
+// log.error(e.getMessage());
+// }
+// String submissionUser = workflowContext.getAttributeValue(new QName(workflowContext.getNamespace().getNamespaceURI(), "submissionUser"));
+// WorkflowContextHeaderBuilder workflowContextHeaderBuilder = new WorkflowContextHeaderBuilder(parse.getContextHeader());
+// workflowContextHeaderBuilder.setSubmissionUser(submissionUser);
+// return workflowContextHeaderBuilder;
+// }
+//
+// public String setupAndLaunch(String workflowAsString, String experimentId, String gatewayId, String username,
+// Map<String,String> inputs,boolean inNewThread,WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException{
+// List<NameValue> inputData=new ArrayList<NameValue>();
+// for (String inputName : inputs.keySet()) {
+// NameValue input = new NameValue();
+// input.setName(inputName);
+// input.setValue(inputs.get(inputName));
+// inputData.add(input);
+// }
+// Map<String, String> configuration = new HashMap<String, String>();
+// configuration.put(BROKER, getAiravataAPI().getAiravataManager().getEventingServiceURL().toASCIIString());
+// configuration.put(MSGBOX, getAiravataAPI().getAiravataManager().getMessageBoxServiceURL().toASCIIString());
+//
+// return setupAndLaunch(workflowAsString, experimentId, gatewayId, username, inputData.toArray(new NameValue[]{}), configuration, inNewThread, builder);
+// }
+//
+// private String setupAndLaunch(String workflowAsString, String topic, String gatewayId, String username,
+// NameValue[] inputs,Map<String,String>configurations,boolean inNewThread,
+// WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException{
+// log.debug("Launch is called for topic:"+topic);
+//
+// Workflow workflow = null;
+// try {
+// workflow = new Workflow(workflowAsString);
+// log.debug("Workflow Object created");
+// } catch (GraphException e1) {
+// e1.printStackTrace();
+// } catch (ComponentException e1) {
+// e1.printStackTrace();
+// }
+// log.debug("Setting Input values");
+// List<InputNode> inputNodes = new ODEClient().getInputNodes(workflow);
+// for (InputNode inputNode : inputNodes) {
+// for (NameValue input : inputs) {
+// if (inputNode.getID().equals(input.getName())) {
+// inputNode.setDefaultValue(input.getValue());
+// break;
+// }
+// }
+// if (inputNode.getDefaultValue() == null) {
+// throw new WorkflowRuntimeException("Could not find a input value for component with name :" + inputNode.getName());
+// }
+//
+// }
+// log.debug("Input all set");
+//
+// XBayaConfiguration conf = null;
+// try {
+// conf = getConfiguration(configurations);
+// conf.setTopic(topic);
+// conf.setRunWithCrossProduct(true);
+// } catch (URISyntaxException e1) {
+// throw new WorkflowRuntimeException(e1);
+// }
+// WorkflowInterpretorEventListener listener = null;
+// WorkflowInterpreter interpreter = null;
+// AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(gatewayId, username);
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, topic, conf.getMessageBoxURL(), conf.getBrokerURL(), airavataAPI, conf, null, null);
+// workflowInterpreterConfiguration.setGfacEmbeddedMode(gfacEmbeddedMode);
+// workflowInterpreterConfiguration.setActOnProvenance(provenance);
+//
+// if (builder.getSecurityContext().getAmazonWebservices() != null) {
+// workflowInterpreterConfiguration.setAwsSecretKey(builder.getSecurityContext().getAmazonWebservices().getSecretAccessKey());
+// workflowInterpreterConfiguration.setAwsAccessKey(builder.getSecurityContext().getAmazonWebservices().getAccessKeyId());
+// }
+// // WorkflowInterpreter object should create prior creation of Listener, because listener needs the threadlocal variable
+// interpreter = new WorkflowInterpreter(workflowInterpreterConfiguration, getInteractor());
+// listener = new WorkflowInterpretorEventListener(workflow, conf);
+// try {
+// log.debug("start listener set");
+// listener.start();
+// } catch (MonitorException e1) {
+// e1.printStackTrace();
+// }
+//
+// WorkflowContextHeaderBuilder.setCurrentContextHeader(builder.getContextHeader());
+//
+// final WorkflowInterpretorEventListener finalListener = listener;
+// conf.setAiravataAPI(getAiravataAPI());
+//
+// final WorkflowInterpreter finalInterpreter = interpreter;
+//// interpreter.setActOnProvenance(provenance);
+// interpreter.setProvenanceWriter(runner);
+// final String experimentId = topic;
+// log.debug("Created the interpreter");
+// if(inNewThread){
+// runInThread(finalInterpreter,finalListener,experimentId,builder);
+// }else{
+// executeWorkflow(finalInterpreter, finalListener, experimentId);
+// }
+// log.info("Experiment launched :" + topic);
+// return topic;
+// }
+//
+// private void runInThread(final WorkflowInterpreter interpreter,final WorkflowInterpretorEventListener listener,final String experimentId,final WorkflowContextHeaderBuilder builder) {
+// new Thread(new Runnable() {
+//
+// public void run() {
+// WorkflowContextHeaderBuilder.setCurrentContextHeader(builder.getContextHeader());
+// executeWorkflow(interpreter, listener, experimentId);
+// }
+// }).start();
+// }
+//
+// private void executeWorkflow(WorkflowInterpreter interpreter, WorkflowInterpretorEventListener listener,String experimentId) {
+// try {
+// workflowConfigurations.put(experimentId,interpreter.getConfig());
+// interpreter.scheduleDynamically();
+// log.debug("Interpreter invoked...");
+// } catch (Exception e) {
+// throw new WorkflowRuntimeException(e);
+// } finally {
+// if (workflowConfigurations.containsKey(experimentId)){
+// workflowConfigurations.remove(experimentId);
+// }
+// /*
+// * stop listener no matter what happens
+// */
+//// try {
+//// if(listener != null)
+//// listener.stop();
+//// } catch (MonitorException e) {
+//// e.printStackTrace();
+//// }
+// }
+// }
+//
+// public XBayaConfiguration getConfiguration(Map<String,String> vals) throws URISyntaxException {
+// XBayaConfiguration configuration = new XBayaConfiguration();
+// configuration.setBrokerURL(new URI(findValue(vals, BROKER, XBayaConstants.DEFAULT_BROKER_URL.toString())));
+// configuration.setGFacURL(new URI(findValue(vals, GFAC, XBayaConstants.DEFAULT_GFAC_URL.toString())));
+// configuration.setMessageBoxURL(new URI(findValue(vals, MSGBOX, XBayaConstants.DEFAULT_MESSAGE_BOX_URL.toString())));
+// configuration.setMyProxyLifetime(XBayaConstants.DEFAULT_MYPROXY_LIFTTIME);
+// configuration.setMyProxyPort(XBayaConstants.DEFAULT_MYPROXY_PORT);
+// //This null check will fix some test failures
+// if (WorkflowInterpreterSkeleton2.configurationContext != null) {
+// configuration.setMyProxyServer(findValue(vals, MYPROXY_SERVER, (String) WorkflowInterpreterSkeleton2.configurationContext.getProperty(MYPROXY_SERVER)));
+// configuration.setMyProxyPassphrase(findValue(vals, MYPROXY_PASS, (String) WorkflowInterpreterSkeleton2.configurationContext.getProperty(MYPROXY_PASS)));
+// configuration.setMyProxyUsername(findValue(vals, MYPROXY_USER, (String) WorkflowInterpreterSkeleton2.configurationContext.getProperty(MYPROXY_USER)));
+// configuration.setTrustedCertLocation(findValue(vals, TRUSTED_CERT_LOCATION, (String) WorkflowInterpreterSkeleton2.configurationContext.getProperty(TRUSTED_CERT_LOCATION)));
+// configuration.setTrustedCertLocation(findValue(vals, MYPROXY_LIFETIME, (String) WorkflowInterpreterSkeleton2.configurationContext.getProperty(MYPROXY_LIFETIME)));
+// }
+// return configuration;
+// }
+//
+// private String findValue(Map<String,String> vals, String key, String defaultVal) {
+// if(vals.get(key) != null) {
+// return vals.get(key);
+// }
+// return defaultVal;
+// }
+//
+// public void shutDown(ConfigurationContext configctx, AxisService service) {
+// URI gfacURL = (URI) configctx.getProperty(SERVICE_URL);
+// if (getAiravataAPI() != null && thread != null) {
+// AiravataAPI registry = getAiravataAPI();
+// try {
+// registry.getAiravataManager().removeWorkflowInterpreterURI(gfacURL);
+// } catch (AiravataAPIInvocationException e) {
+// e.printStackTrace();
+// }
+// thread.interrupt();
+// try {
+// thread.join();
+// } catch (InterruptedException e) {
+// log.warn("GFacURL update thread is interrupted");
+// }
+// }
+// if (runner != null) {
+// runner.shutDown();
+// }
+//
+// notInterrupted = false;
+// }
+//
+// private List<HostDescription> getDefinedHostDescriptions() {
+// URL url = this.getClass().getClassLoader().getResource("host.xml");
+// ArrayList<HostDescription> hostDescriptions = new ArrayList<HostDescription>();
+// XMLStreamReader reader = null;
+// try {
+// if (url != null) {
+// reader = XMLInputFactory.newInstance().createXMLStreamReader(url.openStream());
+// } else {
+// throw new RuntimeException("Error retrieving host.xml file. Should reside in " +
+// "$SERVER_HOME/webapps/axis2/WEB-INF/classes/host.xml");
+// }
+// } catch (XMLStreamException e) {
+// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+// } catch (IOException e) {
+// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+// }
+// StAXOMBuilder builder = new StAXOMBuilder(reader);
+// OMElement documentElement = builder.getDocumentElement();
+// Iterator<?> server = documentElement.getChildrenWithName(new QName("server"));
+// while (server.hasNext()) {
+// HostDescription hostDescription = new HostDescription();
+// OMElement next = (OMElement) server.next();
+// if (next.getFirstChildWithName(new QName("gram.endpoint")) != null &&
+// "globus".equals(next.getFirstChildWithName(new QName("type")).getText())) {
+// hostDescription.getType().changeType(GlobusHostType.type);
+// ((GlobusHostType) hostDescription.getType()).addGlobusGateKeeperEndPoint(next.getFirstChildWithName(new QName("gram.endpoint")).getText());
+// ((GlobusHostType) hostDescription.getType()).addGridFTPEndPoint(next.getFirstChildWithName(new QName("gridftp.endpoint")).getText());
+// } else if("ssh".equals(next.getFirstChildWithName(new QName("type")).getText())) {
+// hostDescription.getType().changeType(SSHHostType.type);
+// if(next.getFirstChildWithName(new QName("hpc.resource")) != null){
+// if("true".equals(next.getFirstChildWithName(new QName("gram.endpoint")))){
+// ((SSHHostType) hostDescription.getType()).setHpcResource(true);
+// }
+// }
+// ((SSHHostType) hostDescription.getType()).setHpcResource(false);
+// } else if("gsissh".equals(next.getFirstChildWithName(new QName("type")).getText())) {
+// hostDescription.getType().changeType(GsisshHostType.type);
+// }
+// (hostDescription.getType()).setHostName(next.getFirstChildWithName(new QName("name")).getText());
+// (hostDescription.getType()).setHostAddress(next.getFirstChildWithName(new QName("host")).getText());
+// hostDescriptions.add(hostDescription);
+// }
+// return hostDescriptions;
+// }
+//
+// public static final int URL_UPDATE_INTERVAL = 1000 * 60 * 60 * 3;
+//
+// class WIServiceThread extends PeriodicExecutorThread {
+// private ConfigurationContext context = null;
+//
+// WIServiceThread(AiravataAPI registry, ConfigurationContext context) {
+// super(registry);
+// this.context = context;
+// }
+//
+// @Override
+// protected void updateRegistry(AiravataAPI registry) throws Exception {
+// URI localAddress = (URI) this.context.getProperty(SERVICE_URL);
+// registry.getAiravataManager().addWorkflowInterpreterURI(localAddress);
+// log.debug("Updated Workflow Interpreter service URL in to Repository");
+//
+// }
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/AsynchronousInvoker.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/AsynchronousInvoker.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/AsynchronousInvoker.java
new file mode 100644
index 0000000..fa0709d
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/AsynchronousInvoker.java
@@ -0,0 +1,118 @@
+/*
+ *
+ * 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.invoker;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import xsul.wsdl.WsdlDefinitions;
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.WSIFOperation;
+import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
+import xsul.xwsif_runtime_async_http.XsulSoapHttpWsaResponsesCorrelator;
+
+public class AsynchronousInvoker extends SimpleInvoker {
+
+ private static final Logger logger = LoggerFactory.getLogger(AsynchronousInvoker.class);
+
+ private String messageBoxURL;
+
+ /**
+ * Constructs an AsynchronousInvoker.
+ *
+ * @param definitions
+ */
+ public AsynchronousInvoker(WsdlDefinitions definitions) {
+ this(definitions, null);
+ }
+
+ /**
+ * Constructs an AsynchronousInvoker.
+ *
+ * @param definitions
+ * @param messageBoxURL
+ */
+ public AsynchronousInvoker(WsdlDefinitions definitions, String messageBoxURL) {
+ super(definitions);
+ this.messageBoxURL = messageBoxURL;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.SimpleInvoker#setup()
+ */
+ @Override
+ public void setup() throws WorkflowException {
+ super.setup();
+ /* Set the output message to null to set teh output from async Listener */
+ WSIFAsyncResponsesCorrelator correlator;
+ if (this.messageBoxURL == null || this.messageBoxURL.length() == 0) {
+ correlator = new XsulSoapHttpWsaResponsesCorrelator();
+ String serverLoc = ((XsulSoapHttpWsaResponsesCorrelator) correlator).getServerLocation();
+ logger.debug("using async correlator at " + serverLoc);
+ } else {
+ correlator = new MsgBoxWsaResponsesCorrelator(this.messageBoxURL,this);
+ logger.debug("using message box at " + this.messageBoxURL);
+ }
+ this.client.useAsyncMessaging(correlator);
+ }
+
+ public boolean invoke() throws WorkflowException {
+ final WSIFOperation operation = this.getOperation();
+ final WSIFMessage inputMessage = this.getInputMessage();
+ this.setOutputMessage(null);
+ try {
+ new Thread() {
+ @Override
+ public void run() {
+ try {
+ operation.executeInputOnlyOperation(inputMessage);
+ } catch (Exception e) {
+ // Ignore the error.
+ logger.error("Error invoking GFac Service",e);
+ }
+ }
+ }.start();
+
+ while(this.getOutputMessage() == null){
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ logger.error("Error Waiting for the response from backend");
+ }
+ }
+ // Gfac operation failed, so xbaya side throws this exception
+ if("ErrorResponse".equals(XMLUtil.stringToXmlElement3(this.getOutputMessage().toString()).getName())){
+ // Here we do not throw an exception, because if we throw an exception Interpreter will catch it and do the unsubscription,
+ // which is not needed because if there's an gfac side error gfac will send a failure and unsubscription will be done in monitoring
+ // so if we send an exception we are attempting to do two unsubscriptions which will cause a one unsubscription to fail.
+ return false;
+ }
+
+ return true;
+ } catch (RuntimeException e) {
+ String message = "Error in invoking a service.";
+ throw new WorkflowException(message, 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/invoker/DynamicInvoker.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/DynamicInvoker.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/DynamicInvoker.java
new file mode 100644
index 0000000..b9466c4
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/DynamicInvoker.java
@@ -0,0 +1,167 @@
+/*
+ *
+ * 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.invoker;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+
+import xsul.wsif.WSIFMessage;
+import xsul.xwsif_runtime.WSIFClient;
+
+public class DynamicInvoker implements Invoker {
+
+ private URL jarUrl;
+
+ private String className;
+
+ private String operationName;
+
+ private Object[] inputs;
+
+ private Object result;
+
+ /**
+ * Constructs a DynamicInvoker.
+ *
+ * @param className
+ * @param jarUrl
+ * @param operationName
+ */
+ public DynamicInvoker(String className, URL jarUrl, String operationName, Object[] inputs) {
+ this.className = className;
+ this.jarUrl = jarUrl;
+ this.operationName = operationName;
+ this.inputs = inputs;
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#getOutput(java.lang.String)
+ */
+ public Object getOutput(String name) throws WorkflowException {
+ waitToFinish();
+ return result;
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#invoke()
+ */
+ public boolean invoke() throws WorkflowException {
+ try {
+ Class<?> targetClass = Class.forName(this.className);
+ Object obj = targetClass.newInstance();
+
+ Method[] methods = targetClass.getDeclaredMethods();
+ Method targetMethod = null;
+ for (Method method : methods) {
+ if (this.operationName.equals(method.getName())) {
+ targetMethod = method;
+ break;
+ }
+ }
+ if (targetMethod == null) {
+ throw new WorkflowException("Could not find the method using reflection: " + this.operationName);
+ }
+
+ targetMethod.setAccessible(true);
+ this.result = targetMethod.invoke(obj, inputs);
+
+ } catch (Exception e) {
+ throw new WorkflowException(e);
+ }
+ return true;
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#setInput(java.lang.String, java.lang.Object)
+ */
+ public void setInput(String name, Object value) throws WorkflowException {
+
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#setOperation(java.lang.String)
+ */
+ public void setOperation(String operationName) throws WorkflowException {
+ this.operationName = operationName;
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#setup()
+ */
+ public void setup() throws WorkflowException {
+ Class[] parameters = new Class[] { URL.class };
+ URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
+ Class sysclass = URLClassLoader.class;
+
+ try {
+ Method method = sysclass.getDeclaredMethod("addURL", parameters);
+ method.setAccessible(true);
+ method.invoke(sysloader, new Object[] { this.jarUrl });
+ } catch (Throwable t) {
+ t.printStackTrace();
+ throw new WorkflowException("Error, could not add URL to system classloader");
+ }
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#waitToFinish()
+ */
+ public void waitToFinish() throws WorkflowException {
+ while (this.result == null) {
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#getOutputs()
+ */
+ public WSIFMessage getOutputs() throws WorkflowException {
+ waitToFinish();
+ return (WSIFMessage) this.result;
+
+ }
+
+ @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/invoker/Invoker.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/Invoker.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/Invoker.java
new file mode 100644
index 0000000..cdd47e7
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/Invoker.java
@@ -0,0 +1,105 @@
+/*
+ *
+ * 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.invoker;
+
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+
+import xsul.wsif.WSIFMessage;
+import xsul.xwsif_runtime.WSIFClient;
+
+public interface Invoker {
+
+ /**
+ * Sets up the service.
+ *
+ * @throws WorkflowException
+ */
+ public void setup() throws WorkflowException;
+
+ /**
+ * @return The WSIFClient.
+ */
+ public WSIFClient getClient();
+
+ /**
+ * Sets the operation name to invoke.
+ *
+ * @param operationName
+ * The name of the operation
+ * @throws WorkflowException
+ */
+ public void setOperation(String operationName) throws WorkflowException;
+
+ /**
+ * Sets an input parameter
+ *
+ * @param name
+ * The name of the input parameter
+ * @param value
+ * The value of the input parameter
+ * @throws WorkflowException
+ */
+ public void setInput(String name, Object value) throws WorkflowException;
+
+ /**
+ * Returns the all input parameters
+ *
+ * @return The input parameters
+ * @throws WorkflowException
+ */
+ public WSIFMessage getInputs() throws WorkflowException;
+
+ /**
+ * Invokes the service.
+ *
+ * @return true if the invocation succeeds; fase otherwise
+ * @throws WorkflowException
+ */
+ public boolean invoke() throws WorkflowException;
+
+ /**
+ * Returns the all output parameters
+ *
+ * @return The output parameters
+ * @throws WorkflowException
+ */
+ public WSIFMessage getOutputs() throws WorkflowException;
+
+ /**
+ * Returns the output of a specified name.
+ *
+ * @param name
+ * The name of the output parameter
+ * @return The value of the output
+ * @throws WorkflowException
+ */
+ public Object getOutput(String name) throws WorkflowException;
+
+ /**
+ * Returns the fault message.
+ *
+ * @return The fault message
+ * @throws WorkflowException
+ */
+ public WSIFMessage getFault() throws WorkflowException;
+
+}
\ 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/invoker/MsgBoxWsaResponsesCorrelator.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/MsgBoxWsaResponsesCorrelator.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/MsgBoxWsaResponsesCorrelator.java
new file mode 100644
index 0000000..80825d8
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/MsgBoxWsaResponsesCorrelator.java
@@ -0,0 +1,140 @@
+/*
+ *
+ * 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.invoker;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.wsmg.msgbox.client.MsgBoxClient;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlDocument;
+import org.xmlpull.v1.builder.XmlElement;
+import org.xmlpull.v1.builder.XmlInfosetBuilder;
+import xsul.MLogger;
+import xsul.XmlConstants;
+import xsul.XsulException;
+import xsul.processor.DynamicInfosetProcessorException;
+import xsul.ws_addressing.WsaEndpointReference;
+import xsul.ws_addressing.WsaMessageInformationHeaders;
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.impl.WSIFMessageElement;
+import xsul.xwsif_runtime_async.WSIFAsyncResponseListener;
+import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
+import xsul.xwsif_runtime_async.WSIFAsyncWsaResponsesCorrelatorBase;
+
+import javax.xml.stream.XMLStreamException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class MsgBoxWsaResponsesCorrelator extends WSIFAsyncWsaResponsesCorrelatorBase
+ implements WSIFAsyncResponsesCorrelator, Runnable
+{
+ private static final Logger logger = LoggerFactory.getLogger(MsgBoxWsaResponsesCorrelator.class);
+ private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
+
+ private String msgBoxServiceLoc;
+ private MsgBoxClient msgBoxClient;
+ EndpointReference msgBoxAddr;
+ private Thread messageBoxDonwloader;
+
+ private AsynchronousInvoker invoker;
+
+ public MsgBoxWsaResponsesCorrelator(String msgBoxServiceLoc,AsynchronousInvoker output)
+ throws DynamicInfosetProcessorException
+ {
+ this.invoker = output;
+ this.msgBoxServiceLoc = msgBoxServiceLoc;
+ msgBoxClient = new MsgBoxClient();
+ try {
+ msgBoxAddr = msgBoxClient.createMessageBox(msgBoxServiceLoc,5000L);
+ try {
+ setReplyTo(new WsaEndpointReference(new URI(msgBoxAddr.getAddress())));
+ } catch (URISyntaxException e) {
+ logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
+ }
+ messageBoxDonwloader = new Thread(this, Thread.currentThread().getName()+"-async-msgbox-correlator");
+ messageBoxDonwloader.setDaemon(true);
+ messageBoxDonwloader.start();
+ } catch (RemoteException e) {
+ logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+// public void setMsgBoxAddr(WsaEndpointReference msgBoxAddr) {
+// this.msgBoxAddr = msgBoxAddr;
+// }
+
+
+
+ public void run() {
+ while(true) {
+ try {
+ Iterator<OMElement> omElementIterator = msgBoxClient.takeMessagesFromMsgBox(msgBoxAddr, 5000L);
+ List<XmlElement> xmlArrayList = new ArrayList<XmlElement>();
+ while (omElementIterator.hasNext()){
+ OMElement next = omElementIterator.next();
+ String message = next.toStringWithConsume();
+ xmlArrayList.add(XMLUtil.stringToXmlElement3(message));
+ }
+ // now hard work: find callbacks
+ for (int i = 0; i < xmlArrayList.size(); i++) {
+ XmlElement m = xmlArrayList.get(i);
+ try {
+ logger.debug(Thread.currentThread().getName());
+ WSIFMessageElement e = new WSIFMessageElement(m);
+ this.invoker.setOutputMessage(e);
+ //ideally there are no multiple messages, so we can return from this thread at this point
+ //otherwise this thread will keep running forever for each worfklow node, so there can be large
+ // number of waiting threads in an airavata deployment
+ return;
+ } catch (Throwable e) {
+ logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+ try {
+ Thread.currentThread().sleep(1000L); //do not overload msg box service ...
+ } catch (InterruptedException e) {
+ break;
+ }
+ } catch (XsulException e) {
+ logger.error("could not retrieve messages");
+ break;
+ } catch (RemoteException e) {
+ logger.error("could not retrieve messages");
+ break;
+ } catch (XMLStreamException e) {
+ logger.error("could not retrieve messages");
+ break;
+ } catch (Exception e){
+ logger.error("could not retrieve messages");
+ break;
+ }
+ }
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/SimpleInvoker.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/SimpleInvoker.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/SimpleInvoker.java
new file mode 100644
index 0000000..70be0e9
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/SimpleInvoker.java
@@ -0,0 +1,260 @@
+/*
+ *
+ * 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.invoker;
+
+import java.util.Iterator;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.wsdl.WsdlDefinitions;
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.WSIFOperation;
+import xsul.wsif.WSIFPort;
+import xsul.wsif.WSIFService;
+import xsul.wsif.WSIFServiceFactory;
+import xsul.wsif.spi.WSIFProviderManager;
+import xsul.xwsif_runtime.WSIFClient;
+import xsul.xwsif_runtime.WSIFRuntime;
+
+public class SimpleInvoker implements Invoker {
+
+ private static final Logger log = LoggerFactory.getLogger(SimpleInvoker.class);
+
+ protected WSIFClient client;
+
+ private WsdlDefinitions definitions;
+
+ private WSIFOperation operation;
+
+ private WSIFMessage inputMessage;
+
+ private volatile WSIFMessage outputMessage;
+
+ private WSIFMessage faultMessage;
+
+ private boolean lock = false;
+
+ static {
+ WSIFProviderManager.getInstance().addProvider(new xsul.wsif_xsul_soap_http.Provider());
+ }
+
+ /**
+ * Constructs a SimpleInvoker.
+ *
+ * @param definitions
+ */
+ public SimpleInvoker(WsdlDefinitions definitions) {
+ this.definitions = definitions;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#setup()
+ */
+ public void setup() throws WorkflowException {
+ try {
+ WSIFService service = WSIFServiceFactory.newInstance().getService(this.definitions);
+ WSIFPort port = service.getPort();
+ this.client = WSIFRuntime.getDefault().newClientFor(port);
+ this.client.setAsyncResponseTimeoutInMs(999999999);
+ } catch (RuntimeException e) {
+ String message = "The WSDL is in the wrong format";
+ throw new WorkflowException(message, e);
+ }
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#getClient()
+ */
+ public WSIFClient getClient() {
+ return this.client;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#setOperation(java.lang.String)
+ */
+ public void setOperation(String operationName) throws WorkflowException {
+ try {
+ WSIFPort port = this.client.getPort();
+ this.operation = port.createOperation(operationName);
+ this.inputMessage = this.operation.createInputMessage();
+ this.outputMessage = this.operation.createOutputMessage();
+ this.faultMessage = this.operation.createFaultMessage();
+ } catch (RuntimeException e) {
+ String message = "The WSDL does not conform to the invoking service.";
+ throw new WorkflowException(message, e);
+ }
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#setInput(java.lang.String, java.lang.Object)
+ */
+ public void setInput(String name, Object value) throws WorkflowException {
+ try {
+ if (value instanceof XmlElement) {
+ // If the value is a complex type, change the name of the
+ // element to the correct one.
+ XmlElement valueElement = (XmlElement) value;
+ valueElement.setName(name);
+ } else if (value instanceof String) {
+ if(XMLUtil.isXML((String)value)){
+ XmlElement valueElement = XMLUtil.stringToXmlElement3((String) value);
+ valueElement.setName(name);
+ value = valueElement;
+ }
+ // Simple case.
+ } else {
+ // convert int, doule to string.
+ value = "" + value;
+ }
+ this.inputMessage.setObjectPart(name, value);
+ } catch (RuntimeException e) {
+ String message = "Error in setting an input. name: " + name + " value: " + value;
+ throw new WorkflowException(message, e);
+ }
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#getInputs()
+ */
+ public WSIFMessage getInputs() {
+ return this.inputMessage;
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#invoke()
+ */
+ public boolean invoke() throws WorkflowException {
+ try {
+ boolean success = this.operation.executeRequestResponseOperation(this.inputMessage, this.outputMessage,
+ this.faultMessage);
+ while(this.outputMessage == null){
+
+ }
+ return success;
+ } catch (RuntimeException e) {
+ String message = "Error in invoking a service.";
+ throw new WorkflowException(message, e);
+ }
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#getOutputs()
+ */
+ public WSIFMessage getOutputs() {
+ if (lock) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ return this.outputMessage;
+ }
+
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#getOutput(java.lang.String)
+ */
+ public Object getOutput(String name) throws WorkflowException {
+ try {
+ // This code doesn't work when the output is a complex type.
+ // Object output = this.outputMessage.getObjectPart(name);
+ // return output;
+
+ XmlElement outputElement = (XmlElement) this.outputMessage;
+ XmlElement valueElement = outputElement.element(null, name);
+ Iterator childIt = valueElement.children();
+ int numberOfChildren = 0;
+ while (childIt.hasNext()) {
+ childIt.next();
+ numberOfChildren++;
+ }
+ if (numberOfChildren == 1) {
+ Object child = valueElement.children().next();
+ if (child instanceof String) {
+ // Value is a simple type. Return the string.
+ String value = (String) child;
+ return value;
+ }
+ if (child instanceof XmlElement) {
+ log.debug("output: " + XMLUtil.xmlElementToString((XmlElement) child));
+ Object child1 = ((XmlElement) child).children().next();
+ if (child1 instanceof String) {
+ // Value is a simple type. Return the string.
+ String value = (String) child1;
+ return value;
+ }
+ }
+ }
+ // Value is a complex type. Return the whole XmlElement so that we
+ // can set it to the next service as it is.
+ return valueElement;
+ } catch (RuntimeException e) {
+ String message = "Error in getting output. name: " + name;
+ throw new WorkflowException(message, e);
+ }
+ }
+
+ /**
+ * @see org.apache.airavata.workflow.engine.invoker.Invoker#getFault()
+ */
+ public WSIFMessage getFault() {
+ return this.faultMessage;
+ }
+
+ public WsdlDefinitions getDefinitions() {
+ return definitions;
+ }
+
+ public WSIFOperation getOperation() {
+ return operation;
+ }
+
+ public WSIFMessage getInputMessage() {
+ return inputMessage;
+ }
+
+ public synchronized WSIFMessage getOutputMessage() {
+ return outputMessage;
+ }
+
+ public WSIFMessage getFaultMessage() {
+ return faultMessage;
+ }
+
+ public synchronized void setOutputMessage(WSIFMessage outputMessage) {
+ log.debug("Setting output message");
+ this.outputMessage = outputMessage;
+ }
+
+ public void setLock(boolean lock) {
+ this.lock = lock;
+ }
+
+ public boolean isLock() {
+ return lock;
+ }
+}
\ 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/invoker/WorkflowInputUtil.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/WorkflowInputUtil.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/WorkflowInputUtil.java
new file mode 100644
index 0000000..13eb884
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/WorkflowInputUtil.java
@@ -0,0 +1,52 @@
+/*
+ *
+ * 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.invoker;
+
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
+
+public class WorkflowInputUtil {
+
+ public static String createInputForGFacService(WSComponentPort port,String input){
+ String paramType = port.getType().getLocalPart();
+ StringBuffer inputString = new StringBuffer("<");
+ if("StringParameterType".equals(paramType) || "URIParameterType".equals(paramType) ||
+ "DoubleParameterType".equals(paramType) || "IntegerParameterType".equals(paramType)
+ || "FloatParameterType".equals(paramType)|| "BooleanParameterType".equals(paramType)
+ || "FileParameterType".equals(paramType)){
+ inputString.append(port.getName()).append(">").
+ append(getValueElement(input)).append("</").append(port.getName()).append(">");
+ }else if(paramType.endsWith("ArrayType")){
+ inputString.append(port.getName()).append(">");
+ String[] valueList = StringUtil.getElementsFromString(input);
+ for(String inputValue:valueList){
+ inputString.append(getValueElement(inputValue));
+ }
+ inputString.append(getValueElement(port.getName()));
+ }
+ inputString.append(">");
+ return inputString.toString();
+ }
+
+ private static String getValueElement(String value){
+ return "<value>" + value + "</value>";
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/AmazonUtil.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/AmazonUtil.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/AmazonUtil.java
new file mode 100644
index 0000000..5609a39
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/AmazonUtil.java
@@ -0,0 +1,150 @@
+/*
+ *
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.airavata.workflow.engine.core.amazon.AmazonCredential;
+
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.services.ec2.AmazonEC2;
+import com.amazonaws.services.ec2.AmazonEC2Client;
+import com.amazonaws.services.ec2.model.DescribeInstancesResult;
+import com.amazonaws.services.ec2.model.DescribeKeyPairsResult;
+import com.amazonaws.services.ec2.model.Instance;
+import com.amazonaws.services.ec2.model.KeyPairInfo;
+import com.amazonaws.services.ec2.model.Reservation;
+import com.amazonaws.services.ec2.model.RunInstancesRequest;
+import com.amazonaws.services.ec2.model.RunInstancesResult;
+import com.amazonaws.services.ec2.model.TerminateInstancesRequest;
+
+public class AmazonUtil {
+
+ /**
+ * Amazon EC2 instance type
+ */
+ public final static String[] INSTANCE_TYPE = { "t1.micro", "m1.small", "m1.large", "m1.xlarge", "m2.xlarge",
+ "m2.2xlarge", "m2.4xlarge", "c1.medium", "c1.xlarge" };
+
+ private static AmazonEC2 getEC2Client() {
+ AmazonEC2 ec2 = new AmazonEC2Client(new BasicAWSCredentials(AmazonCredential.getInstance().getAwsAccessKeyId(),
+ AmazonCredential.getInstance().getAwsSecretAccessKey()));
+ return ec2;
+ }
+
+ /**
+ * Launch a new EC2 instance
+ *
+ * @param AMI_ID
+ * @param type
+ * @param number
+ * @return list of newly launched instances
+ */
+ public static List<Instance> launchInstance(String AMI_ID, String type, Integer number) {
+ List<Instance> resultList = new ArrayList<Instance>();
+
+ RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
+ request.setInstanceType(type);
+
+ RunInstancesResult result = getEC2Client().runInstances(request);
+ resultList.addAll(result.getReservation().getInstances());
+ return resultList;
+ }
+
+ /**
+ * Launch a new EC2 instance
+ *
+ * @param AMI_ID
+ * @param type
+ * @param number
+ * @param keyname
+ * @return list of newly launched instances
+ */
+ public static List<Instance> launchInstance(String AMI_ID, String type, Integer number, String keyname) {
+ List<Instance> resultList = new ArrayList<Instance>();
+
+ RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
+ request.setInstanceType(type);
+ request.setKeyName(keyname);
+
+ RunInstancesResult result = getEC2Client().runInstances(request);
+ resultList.addAll(result.getReservation().getInstances());
+ return resultList;
+ }
+
+ /**
+ * Load instances
+ *
+ * @return list of instances
+ */
+ public static List<Instance> loadInstances() {
+ List<Instance> resultList = new ArrayList<Instance>();
+ DescribeInstancesResult describeInstancesResult = getEC2Client().describeInstances();
+ List<Reservation> reservations = describeInstancesResult.getReservations();
+ for (Iterator<Reservation> iterator = reservations.iterator(); iterator.hasNext();) {
+ Reservation reservation = iterator.next();
+ for (Instance instance : reservation.getInstances()) {
+ resultList.add(instance);
+ }
+ }
+ return resultList;
+ }
+
+ /**
+ * Load keypairs
+ *
+ * @return list of keypairs
+ */
+ public static List<String> loadKeypairs() {
+ List<String> resultList = new ArrayList<String>();
+ DescribeKeyPairsResult results = getEC2Client().describeKeyPairs();
+ for (KeyPairInfo key : results.getKeyPairs()) {
+ resultList.add(key.getKeyName());
+ }
+ return resultList;
+ }
+
+ /**
+ * Terminate instances
+ *
+ * @param instanceIds
+ */
+ public static void terminateInstances(List<String> instanceIds) {
+ // terminate
+ TerminateInstancesRequest request = new TerminateInstancesRequest(instanceIds);
+ getEC2Client().terminateInstances(request);
+ }
+
+ /**
+ * Terminate instances
+ *
+ * @param instanceIds
+ */
+ public static void terminateInstances(String... instanceIds) {
+ // terminate
+ TerminateInstancesRequest request = new TerminateInstancesRequest();
+ getEC2Client().terminateInstances(request.withInstanceIds(instanceIds));
+ }
+
+}
\ 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/util/Data.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/Data.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/Data.java
new file mode 100644
index 0000000..3a2da0b
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/Data.java
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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.util;
+
+public class Data {
+ private String destination_path;
+ private String verify_size;
+ private String source_path;
+ private boolean recursive;
+ private String DATA_TYPE;
+
+ public String getDestination_path() {
+ return destination_path;
+ }
+
+ public void setDestination_path(String destination_path) {
+ this.destination_path = destination_path;
+ }
+
+ public String getVerify_size() {
+ return verify_size;
+ }
+
+ public void setVerify_size(String verify_size) {
+ this.verify_size = verify_size;
+ }
+
+ public String getSource_path() {
+ return source_path;
+ }
+
+ public void setSource_path(String source_path) {
+ this.source_path = source_path;
+ }
+
+ public boolean getRecursive() {
+ return recursive;
+ }
+
+ public void setRecursive(boolean recursive) {
+ this.recursive = recursive;
+ }
+
+ public String getDATA_TYPE() {
+ return DATA_TYPE;
+ }
+
+ public void setDATA_TYPE(String DATA_TYPE) {
+ this.DATA_TYPE = DATA_TYPE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/GOConstants.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/GOConstants.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/GOConstants.java
new file mode 100644
index 0000000..909e04c
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/GOConstants.java
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.util;
+
+public class GOConstants {
+ public static final String BASEURL = "https://transfer.api.globusonline.org/v0.10";
+ public static final String NEXUS_API_HOST = "nexus.api.globusonline.org";
+ public static final int NEXUS_API_PORT = 443;
+ public static final String NEXUS_API_SCHEMA = "https";
+ public static final String GOAUTH_TOKEN_REQ_URL = "/goauth/token?grant_type=client_credentials";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/GlobusOnlineUtils.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/GlobusOnlineUtils.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/GlobusOnlineUtils.java
new file mode 100644
index 0000000..4c22667
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/util/GlobusOnlineUtils.java
@@ -0,0 +1,246 @@
+package org.apache.airavata.workflow.engine.util;
+///*
+// *
+// * 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.util;
+//
+//import org.apache.http.HttpEntity;
+//import org.apache.http.HttpHost;
+//import org.apache.http.auth.AuthScope;
+//import org.apache.http.auth.UsernamePasswordCredentials;
+//import org.apache.http.client.AuthCache;
+//import org.apache.http.client.ClientProtocolException;
+//import org.apache.http.client.CredentialsProvider;
+//import org.apache.http.client.methods.CloseableHttpResponse;
+//import org.apache.http.client.methods.HttpGet;
+//import org.apache.http.client.protocol.HttpClientContext;
+//import org.apache.http.impl.auth.BasicScheme;
+//import org.apache.http.impl.client.BasicAuthCache;
+//import org.apache.http.impl.client.BasicCredentialsProvider;
+//import org.apache.http.impl.client.CloseableHttpClient;
+//import org.apache.http.impl.client.HttpClients;
+//import org.apache.http.util.EntityUtils;
+//import org.globusonline.transfer.APIError;
+//import org.globusonline.transfer.Authenticator;
+//import org.globusonline.transfer.GoauthAuthenticator;
+//import org.globusonline.transfer.JSONTransferAPIClient;
+//import org.json.JSONArray;
+//import org.json.JSONException;
+//import org.json.JSONObject;
+//import org.json.JSONTokener;
+//
+//import java.io.File;
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.io.InputStreamReader;
+//import java.security.GeneralSecurityException;
+//import java.security.KeyManagementException;
+//import java.security.NoSuchAlgorithmException;
+//import java.text.DateFormat;
+//import java.text.SimpleDateFormat;
+//import java.util.*;
+//
+//public class GlobusOnlineUtils {
+// public static final String ACCESS_TOKEN = "access_token";
+//
+// private static String goUserName;
+// private static String goPWD;
+//
+// public static void main(String[] args) {
+//// String s = appendFileName("/~/Desktop/1.docx", "/~/");
+//// System.out.println(s);
+//
+// }
+//
+// public GlobusOnlineUtils(String goUsername, String goPwd) {
+// goUserName = goUsername;
+// goPWD = goPwd;
+// }
+//
+// public String getAuthenticationToken() {
+// String token = null;
+// HttpHost targetHost = new HttpHost(GOConstants.NEXUS_API_HOST, GOConstants.NEXUS_API_PORT, GOConstants.NEXUS_API_SCHEMA);
+// CredentialsProvider credsProvider = new BasicCredentialsProvider();
+// credsProvider.setCredentials(
+// new AuthScope(targetHost.getHostName(), targetHost.getPort()),
+// new UsernamePasswordCredentials(goUserName, goPWD));
+//
+// CloseableHttpClient httpclient = HttpClients.custom()
+// .setDefaultCredentialsProvider(credsProvider).build();
+// try {
+//
+// // Create AuthCache instance
+// AuthCache authCache = new BasicAuthCache();
+// // Generate BASIC scheme object and add it to the local
+// // auth cache
+// BasicScheme basicScheme = new BasicScheme();
+// authCache.put(targetHost, basicScheme);
+//
+// // Add AuthCache to the execution context
+// HttpClientContext localContext = HttpClientContext.create();
+// localContext.setAuthCache(authCache);
+//
+// HttpGet httpget = new HttpGet(GOConstants.GOAUTH_TOKEN_REQ_URL);
+// httpget.addHeader("accept", "application/json");
+// System.out.println("executing request: " + httpget.getRequestLine());
+// System.out.println("to target: " + targetHost);
+//
+// CloseableHttpResponse response = httpclient.execute(targetHost, httpget, localContext);
+// try {
+// HttpEntity entity = response.getEntity();
+// InputStream entityContent = entity.getContent();
+// InputStreamReader reader = new InputStreamReader(entityContent);
+// JSONTokener tokenizer = new JSONTokener(reader);
+// JSONObject json = new JSONObject(tokenizer);
+// token = (String)json.get(ACCESS_TOKEN);
+// entityContent.close();
+// EntityUtils.consume(entity);
+//
+// } catch (JSONException e) {
+// e.printStackTrace();
+// } finally {
+// response.close();
+// }
+// //}
+// } catch (ClientProtocolException e) {
+// e.printStackTrace();
+// } catch (IOException e) {
+// e.printStackTrace();
+// } finally {
+// try {
+// httpclient.close();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+// }
+// return token;
+// }
+//
+// public JSONTransferAPIClient getAuthenticated (){
+// JSONTransferAPIClient jsonTransferAPIClient = null;
+// try {
+// String authenticationToken = getAuthenticationToken();
+// Authenticator authenticator = new GoauthAuthenticator(authenticationToken);
+// jsonTransferAPIClient = new JSONTransferAPIClient(goUserName,
+// null, GOConstants.BASEURL);
+// jsonTransferAPIClient.setAuthenticator(authenticator);
+// } catch (KeyManagementException e) {
+// e.printStackTrace();
+// } catch (NoSuchAlgorithmException e) {
+// e.printStackTrace();
+// }
+// return jsonTransferAPIClient;
+// }
+//
+// public String transferFiles (TransferFile tf){
+// String taskId = null;
+// try {
+// JSONTransferAPIClient apiClient = getAuthenticated();
+// String submissionId = apiClient.getSubmissionId();
+// tf.setSubmission_id(submissionId);
+// JSONObject jsonObject = new JSONObject(tf);
+// JSONTransferAPIClient.Result result = apiClient.transfer(jsonObject);
+// taskId = (String)result.document.get("task_id");
+// } catch (IOException e) {
+// e.printStackTrace();
+// } catch (GeneralSecurityException e) {
+// e.printStackTrace();
+// } catch (JSONException e) {
+// e.printStackTrace();
+// } catch (APIError apiError) {
+// apiError.printStackTrace();
+// }
+// return taskId;
+// }
+//
+// public TransferFile getTransferFile (String sourceEp,
+// String destEp,
+// String sourcePath,
+// String destPath,
+// String label){
+//
+// TransferFile transferFile = new TransferFile();
+//
+//
+// transferFile.setPreserve_timestamp(false);
+// transferFile.setDATA_TYPE("transfer");
+// transferFile.setEncrypt_data(false);
+// transferFile.setSync_level(null);
+// transferFile.setSource_endpoint(sourceEp);
+// transferFile.setLabel(label);
+// transferFile.setDestination_endpoint(destEp);
+// transferFile.setLength(2);
+// transferFile.setDeadline(getDeadlineForTransfer());
+// transferFile.setNotify_on_succeeded(true);
+// transferFile.setNotify_on_failed(true);
+// transferFile.setVerify_checksum(false);
+// transferFile.setDelete_destination_extra(false);
+// Data[] datas = new Data[1];
+// Data data = new Data();
+// data.setDATA_TYPE("transfer_item");
+// data.setDestination_path(appendFileName(sourcePath, destPath));
+// data.setVerify_size(null);
+// data.setSource_path(sourcePath);
+// data.setRecursive(false);
+// datas[0] = data;
+// transferFile.setDATA(datas);
+// return transferFile;
+// }
+//
+// private static String appendFileName(String sourcePath, String destPath){
+// String[] split = sourcePath.split(File.separator);
+// String fileName = split[split.length - 1];
+// if (destPath.endsWith(File.separator)){
+// destPath = destPath.concat(fileName);
+// }else {
+// destPath = destPath.concat("/" + fileName);
+// }
+// System.out.println(destPath);
+// return destPath;
+// }
+//
+// private String getDeadlineForTransfer (){
+// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+// Calendar calendar = Calendar.getInstance();
+// calendar.add(calendar.DAY_OF_MONTH, 1);
+// Date tomorrow = calendar.getTime();
+// String date = dateFormat.format(tomorrow);
+// System.out.println(date);
+// return date;
+// }
+//
+// public List<String> getEPList() throws IOException, APIError, GeneralSecurityException, JSONException {
+// List<String> epList = new ArrayList<String>();
+// Map<String, String> params = new HashMap<String, String>();
+// params.put("limit", "0");
+// JSONTransferAPIClient transferAPIClient = getAuthenticated();
+// JSONTransferAPIClient.Result result = transferAPIClient.getResult("/endpoint_list", params);
+// JSONObject document = result.document;
+// JSONArray dataArray = document.getJSONArray("DATA");
+// for (int i = 0; i < dataArray.length(); i++ ){
+// JSONObject jsonObject = dataArray.getJSONObject(i);
+// String epName = (String)jsonObject.get("canonical_name");
+// epList.add(epName);
+// }
+// return epList;
+// }
+//
+//}
[8/9] git commit: introducing workflow support in airavata api +
other related modules
Posted by sa...@apache.org.
introducing workflow support in airavata api + other related modules
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/a8974b7c
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/a8974b7c
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/a8974b7c
Branch: refs/heads/workflow-support
Commit: a8974b7cbad93b57b109b270e3e7c07794a8a338
Parents: dfe99b8
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Fri Jul 11 21:52:23 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Fri Jul 11 21:52:23 2014 -0400
----------------------------------------------------------------------
airavata-api/airavata-api-server/pom.xml | 5 +
.../server/handler/AiravataServerHandler.java | 70 +-
.../server/handler/WorkflowServerHandler.java | 69 +-
.../api/client/AiravataClientFactory.java | 9 +-
.../client/samples/CreateLaunchExperiment.java | 10 +-
modules/distribution/server/pom.xml | 5 +
.../server/src/main/assembly/bin-assembly.xml | 1 +
.../orchestrator/core/ValidatorTest.java | 224 +--
modules/workflow-model/pom.xml | 6 +-
modules/workflow-model/workflow-engine/pom.xml | 328 ++++
.../workflow/catalog/WorkflowCatalog.java | 53 +
.../catalog/WorkflowCatalogException.java | 17 +
.../catalog/WorkflowCatalogFactory.java | 33 +
.../workflow/catalog/WorkflowCatalogImpl.java | 173 +++
.../engine/concurrent/PredicatedExecutable.java | 33 +
.../engine/concurrent/PredicatedTaskRunner.java | 153 ++
.../engine/core/amazon/AmazonCredential.java | 79 +
.../engine/core/amazon/EC2InstanceResult.java | 95 ++
.../engine/core/generators/XmlBeansFiler.java | 71 +
.../core/workflow/ParameterListModel.java | 88 ++
.../engine/datadriven/WorkflowHarvester.java | 191 +++
.../engine/file/XBayaPathConstants.java | 64 +
.../engine/gfac/GFacRegistryClient.java | 169 +++
.../workflow/engine/gfac/SimpleWSClient.java | 134 ++
.../engine/globus/FileTransferConstants.java | 38 +
.../globus/GridFTPFileTransferClient.java | 239 +++
.../engine/graph/controller/NodeController.java | 200 +++
.../engine/interpretor/DoWhileHandler.java | 249 ++++
.../engine/interpretor/ExperimentTemplate.java | 37 +
.../engine/interpretor/HeaderConstants.java | 33 +
.../SSWorkflowInterpreterInteractorImpl.java | 115 ++
.../interpretor/SystemComponentInvoker.java | 114 ++
.../WorkFlowInterpreterException.java | 37 +
.../interpretor/WorkflowExecutionMessage.java | 40 +
.../interpretor/WorkflowExecutionTemplate.java | 51 +
.../engine/interpretor/WorkflowInterpreter.java | 1408 ++++++++++++++++++
.../WorkflowInterpreterConfiguration.java | 78 +
.../WorkflowInterpreterInteractor.java | 94 ++
.../interpretor/WorkflowInterpreterInvoker.java | 66 +
.../WorkflowInterpreterSkeleton2.java | 498 +++++++
.../engine/invoker/AsynchronousInvoker.java | 118 ++
.../workflow/engine/invoker/DynamicInvoker.java | 167 +++
.../workflow/engine/invoker/Invoker.java | 105 ++
.../invoker/MsgBoxWsaResponsesCorrelator.java | 140 ++
.../workflow/engine/invoker/SimpleInvoker.java | 260 ++++
.../engine/invoker/WorkflowInputUtil.java | 52 +
.../workflow/engine/util/AmazonUtil.java | 150 ++
.../airavata/workflow/engine/util/Data.java | 70 +
.../workflow/engine/util/GOConstants.java | 30 +
.../workflow/engine/util/GlobusOnlineUtils.java | 246 +++
.../workflow/engine/util/InterpreterUtil.java | 308 ++++
.../workflow/engine/util/RegistryConstants.java | 30 +
.../workflow/engine/util/TransferFile.java | 170 +++
.../workflow/engine/util/XBayaUtil.java | 218 +++
.../workflow/WorkflowEngineException.java | 42 +
.../engine/workflow/proxy/ProxyWSDL.java | 87 ++
.../engine/workflow/proxy/WorkflowClient.java | 35 +
.../engine/workflow/proxy/WorkflowContext.java | 42 +
.../workflow/proxy/WorkflowProxyException.java | 64 +
.../src/main/resources/WorkflowInterpretor.wsdl | 72 +
.../src/main/resources/images/airavata-2.png | Bin 0 -> 5582 bytes
.../main/resources/images/airavata-config.png | Bin 0 -> 1297 bytes
.../src/main/resources/images/airavata-icon.png | Bin 0 -> 584 bytes
.../main/resources/images/airavata-icon2.png | Bin 0 -> 981 bytes
.../src/main/resources/images/airavata-name.png | Bin 0 -> 8261 bytes
.../resources/images/airavata-title-text.png | Bin 0 -> 16438 bytes
.../src/main/resources/images/airavata.png | Bin 0 -> 17280 bytes
.../src/main/resources/images/application.png | Bin 0 -> 894 bytes
.../src/main/resources/images/applications.png | Bin 0 -> 657 bytes
.../src/main/resources/images/closed.gif | Bin 0 -> 923 bytes
.../src/main/resources/images/cloud.png | Bin 0 -> 573 bytes
.../src/main/resources/images/experiment.png | Bin 0 -> 543 bytes
.../src/main/resources/images/experiments.png | Bin 0 -> 1142 bytes
.../src/main/resources/images/gfac_url.png | Bin 0 -> 739 bytes
.../src/main/resources/images/gfac_urls.png | Bin 0 -> 816 bytes
.../src/main/resources/images/host.png | Bin 0 -> 652 bytes
.../src/main/resources/images/hosts.png | Bin 0 -> 671 bytes
.../src/main/resources/images/input_para.png | Bin 0 -> 428 bytes
.../src/main/resources/images/jcr-repo.png | Bin 0 -> 1010 bytes
.../src/main/resources/images/leaf.gif | Bin 0 -> 906 bytes
.../src/main/resources/images/menu/jcr.png | Bin 0 -> 1158 bytes
.../src/main/resources/images/menu/new2.png | Bin 0 -> 1175 bytes
.../src/main/resources/images/menu/open1.png | Bin 0 -> 925 bytes
.../src/main/resources/images/menu/open2.png | Bin 0 -> 964 bytes
.../src/main/resources/images/menu/open_dir.png | Bin 0 -> 749 bytes
.../src/main/resources/images/menu/pause1.png | Bin 0 -> 1101 bytes
.../resources/images/menu/pause_monitor1.png | Bin 0 -> 873 bytes
.../src/main/resources/images/menu/play3.png | Bin 0 -> 1192 bytes
.../src/main/resources/images/menu/play4.png | Bin 0 -> 765 bytes
.../images/menu/resume_monitoring1.png | Bin 0 -> 957 bytes
.../src/main/resources/images/menu/save1.png | Bin 0 -> 1200 bytes
.../src/main/resources/images/menu/stop.png | Bin 0 -> 316 bytes
.../src/main/resources/images/opened.gif | Bin 0 -> 917 bytes
.../src/main/resources/images/output_para.png | Bin 0 -> 490 bytes
.../src/main/resources/images/parameter.png | Bin 0 -> 544 bytes
.../src/main/resources/images/pause.jpeg | Bin 0 -> 458 bytes
.../src/main/resources/images/play.jpeg | Bin 0 -> 471 bytes
.../src/main/resources/images/registry.png | Bin 0 -> 3419 bytes
.../src/main/resources/images/service.png | Bin 0 -> 871 bytes
.../src/main/resources/images/services.png | Bin 0 -> 899 bytes
.../src/main/resources/images/step.gif | Bin 0 -> 211 bytes
.../src/main/resources/images/stop.jpeg | Bin 0 -> 497 bytes
.../src/main/resources/images/workflow.png | Bin 0 -> 601 bytes
.../resources/images/workflow_templates.png | Bin 0 -> 710 bytes
.../src/main/resources/images/workflows.png | Bin 0 -> 778 bytes
.../src/main/resources/services.xml | 30 +
.../resources/wsdls/TestCMD_Example1_AWSDL.xml | 56 +
.../src/main/resources/wsdls/adder-awsdl.xml | 63 +
.../src/main/resources/wsdls/eventing.wsdl | 332 +++++
.../interpreter/ComplexForEachWorkflowTest.java | 73 +
.../xbaya/interpreter/ComplexMathService.java | 40 +
.../interpreter/ComplexMathWorkflowTest.java | 71 +
.../interpreter/CrossProductWorkflowTest.java | 71 +
.../airavata/xbaya/interpreter/EchoService.java | 28 +
.../xbaya/interpreter/ForEachWorkflowTest.java | 73 +
.../interpreter/LevenshteinDistanceService.java | 48 +
.../airavata/xbaya/interpreter/Listener.java | 31 +
.../xbaya/interpreter/NotificationSender.java | 204 +++
.../xbaya/interpreter/RegistryServiceTest.java | 105 ++
.../interpreter/SimpleForEachWorkflowTest.java | 72 +
.../interpreter/SimpleMathWorkflowTest.java | 73 +
.../xbaya/interpreter/WorkflowTest.java | 74 +
.../xbaya/interpreter/WorkflowTrackingTest.java | 105 ++
.../xbaya/interpreter/XBayaClientTest.java | 80 +
.../interpreter/XBayaConsolidatedTestSuite.java | 67 +
.../xbaya/interpreter/utils/ConfigKeys.java | 34 +
.../xbaya/interpreter/utils/TestUtilServer.java | 243 +++
.../interpreter/utils/WorkflowTestUtils.java | 97 ++
.../workflow-engine/src/test/java/test.xwf | 251 ++++
.../src/test/resources/axis2_default.xml | 278 ++++
.../workflow-model-component/pom.xml | 104 ++
.../registry/JCRComponentReference.java | 66 +
.../registry/JCRComponentRegistry.java | 78 +
.../workflow-model/workflow-model-core/pom.xml | 5 +
.../component/system/SubWorkflowComponent.java | 2 +-
.../component/web/WebComponentRegistry.java | 3 -
.../model/component/ws/WSComponent.java | 329 +---
.../model/component/ws/WSComponentFactory.java | 108 +-
.../model/component/ws/WSComponentPort.java | 24 +-
.../model/component/ws/WSComponentRegistry.java | 5 +-
.../model/component/ws/WorkflowComponent.java | 31 +-
.../airavata/workflow/model/gpel/DSCUtil.java | 24 +-
.../model/gpel/script/WorkflowWSDL.java | 5 +-
.../workflow/model/graph/util/GraphUtil.java | 4 +-
.../workflow/model/graph/ws/WSNode.java | 16 +-
.../airavata/workflow/model/wf/Workflow.java | 91 +-
modules/xbaya-gui/pom.xml | 5 +
.../ui/dialogs/registry/RegistryWindow.java | 4 +-
.../WorkflowInterpreterLaunchWindow.java | 48 +-
pom.xml | 1 +
150 files changed, 10653 insertions(+), 682 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/airavata-api/airavata-api-server/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/pom.xml b/airavata-api/airavata-api-server/pom.xml
index c585408..5f8adc7 100644
--- a/airavata-api/airavata-api-server/pom.xml
+++ b/airavata-api/airavata-api-server/pom.xml
@@ -67,6 +67,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-engine</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>${thrift.version}</version>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 683848a..9831431 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -33,6 +33,7 @@ import java.util.Random;
import org.airavata.appcatalog.cpi.AppCatalog;
import org.airavata.appcatalog.cpi.AppCatalogException;
import org.airavata.appcatalog.cpi.ApplicationDeployment;
+import org.airavata.appcatalog.cpi.ApplicationInterface;
import org.airavata.appcatalog.cpi.ComputeResource;
import org.airavata.appcatalog.cpi.GwyResourceProfile;
import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
@@ -87,6 +88,8 @@ import org.apache.airavata.registry.cpi.RegistryModelType;
import org.apache.airavata.registry.cpi.utils.Constants;
import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.TaskDetailConstants;
import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants;
+import org.apache.airavata.workflow.catalog.WorkflowCatalogException;
+import org.apache.airavata.workflow.catalog.WorkflowCatalogFactory;
import org.apache.thrift.TException;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
@@ -1018,26 +1021,65 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
throw exception;
}
- final OrchestratorService.Client orchestratorClient = getOrchestratorClient();
final String expID = airavataExperimentId;
final String token = airavataCredStoreToken;
synchronized (this) {
- if (orchestratorClient.validateExperiment(expID)) {
- (new Thread() {
- public void run() {
- try {
- launchSingleAppExperiment(expID, token, orchestratorClient);
- } catch (TException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- }).start();
- } else {
- throw new InvalidRequestException("Experiment Validation Failed, please check the configuration");
- }
+ try {
+ ApplicationInterface applicationInterface = AppCatalogFactory.getAppCatalog().getApplicationInterface();
+ List<String> allApplicationInterfaceIds = applicationInterface.getAllApplicationInterfaceIds();
+ Experiment experiment = getExperiment(expID);
+ String applicationId = experiment.getApplicationId();
+ Thread thread = null;
+ if (allApplicationInterfaceIds.contains(applicationId)){
+ //its an single application execution experiment
+ final OrchestratorService.Client orchestratorClient = getOrchestratorClient();
+ if (orchestratorClient.validateExperiment(expID)) {
+ thread = new Thread() {
+ public void run() {
+ try {
+ launchSingleAppExperiment(expID, token, orchestratorClient);
+ } catch (TException e) {
+ e.printStackTrace();
+ }
+ }
+ };
+ } else {
+ throw new InvalidRequestException("Experiment Validation Failed, please check the configuration");
+ }
+
+ } else {
+ List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows();
+ if (allWorkflows.contains(applicationId)){
+ //its a workflow execution experiment
+ thread = new Thread() {
+ public void run() {
+ try {
+ launchWorkflowExperiment(expID, token);
+ } catch (TException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+ };
+ } else {
+ throw new InvalidRequestException("Experiment '"+expID+"' launch failed. Unable to locate an application or a workflow with the id "+applicationId);
+ }
+ }
+ thread.start();
+ } catch (AppCatalogException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (WorkflowCatalogException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
}
}
+ private boolean launchWorkflowExperiment(String experimentId, String airavataCredStoreToken) throws TException {
+ return true;
+ }
+
private boolean launchSingleAppExperiment(String experimentId, String airavataCredStoreToken, OrchestratorService.Client orchestratorClient) throws TException {
Experiment experiment = null;
try {
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/WorkflowServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/WorkflowServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/WorkflowServerHandler.java
index 1999618..8cb57d6 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/WorkflowServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/WorkflowServerHandler.java
@@ -24,17 +24,14 @@ package org.apache.airavata.api.server.handler;
import java.util.List;
import org.apache.airavata.api.workflow.Workflow.Iface;
-import org.apache.airavata.client.AiravataAPIFactory;
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.common.utils.XMLUtil;
import org.apache.airavata.model.Workflow;
import org.apache.airavata.model.error.AiravataClientException;
import org.apache.airavata.model.error.AiravataErrorType;
import org.apache.airavata.model.error.AiravataSystemException;
import org.apache.airavata.model.error.InvalidRequestException;
+import org.apache.airavata.workflow.catalog.WorkflowCatalog;
+import org.apache.airavata.workflow.catalog.WorkflowCatalogException;
+import org.apache.airavata.workflow.catalog.WorkflowCatalogFactory;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,14 +39,14 @@ import org.slf4j.LoggerFactory;
public class WorkflowServerHandler implements Iface {
private static final Logger log = LoggerFactory.getLogger(WorkflowServerHandler.class);
- private AiravataAPI airavataAPI;
+ private WorkflowCatalog workflowCatalog;
@Override
public List<String> getAllWorkflows() throws InvalidRequestException,
AiravataClientException, AiravataSystemException, TException {
try {
- return getAiravataAPI().getWorkflowManager().getWorkflowTemplateIds();
- } catch (AiravataAPIInvocationException e) {
+ return getWorkflowCatalog().getAllWorkflows();
+ } catch (WorkflowCatalogException e) {
String msg = "Error in retrieving all workflow template Ids.";
log.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
@@ -63,13 +60,8 @@ public class WorkflowServerHandler implements Iface {
throws InvalidRequestException, AiravataClientException,
AiravataSystemException, TException {
try {
- org.apache.airavata.workflow.model.wf.Workflow w = getAiravataAPI().getWorkflowManager().getWorkflow(workflowTemplateId);
- Workflow workflow = new Workflow();
- workflow.setTemplateId(workflowTemplateId);
- workflow.setGraph(XMLUtil.xmlElementToString(w.toXML()));
- workflow.setName(w.getName());
- return workflow;
- } catch (AiravataAPIInvocationException e) {
+ return getWorkflowCatalog().getWorkflow(workflowTemplateId);
+ } catch (WorkflowCatalogException e) {
String msg = "Error in retrieving the workflow "+workflowTemplateId+".";
log.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
@@ -83,8 +75,8 @@ public class WorkflowServerHandler implements Iface {
throws InvalidRequestException, AiravataClientException,
AiravataSystemException, TException {
try {
- getAiravataAPI().getWorkflowManager().deleteWorkflow(workflowTemplateId);
- } catch (AiravataAPIInvocationException e) {
+ getWorkflowCatalog().deleteWorkflow(workflowTemplateId);
+ } catch (WorkflowCatalogException e) {
String msg = "Error in deleting the workflow "+workflowTemplateId+".";
log.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
@@ -98,9 +90,8 @@ public class WorkflowServerHandler implements Iface {
throws InvalidRequestException, AiravataClientException,
AiravataSystemException, TException {
try {
- getAiravataAPI().getWorkflowManager().addWorkflow(workflow.getGraph());
- return workflow.getName();
- } catch (AiravataAPIInvocationException e) {
+ return getWorkflowCatalog().registerWorkflow(workflow);
+ } catch (WorkflowCatalogException e) {
String msg = "Error in registering the workflow "+workflow.getName()+".";
log.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
@@ -114,8 +105,8 @@ public class WorkflowServerHandler implements Iface {
throws InvalidRequestException, AiravataClientException,
AiravataSystemException, TException {
try {
- getAiravataAPI().getWorkflowManager().updateWorkflow(workflowTemplateId, workflow.getGraph());
- } catch (AiravataAPIInvocationException e) {
+ getWorkflowCatalog().updateWorkflow(workflowTemplateId, workflow);
+ } catch (WorkflowCatalogException e) {
String msg = "Error in updating the workflow "+workflow.getName()+".";
log.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
@@ -129,13 +120,8 @@ public class WorkflowServerHandler implements Iface {
throws InvalidRequestException, AiravataClientException,
AiravataSystemException, TException {
try {
- if (getAiravataAPI().getWorkflowManager().isWorkflowExists(workflowName)){
- return workflowName;
- }
- AiravataClientException airavataClientException = new AiravataClientException(AiravataErrorType.UNKNOWN);
- airavataClientException.setParameter("No worklfow exists with the name "+workflowName);
- throw airavataClientException;
- } catch (AiravataAPIInvocationException e) {
+ return getWorkflowCatalog().getWorkflowTemplateId(workflowName);
+ } catch (WorkflowCatalogException e) {
String msg = "Error in retrieving the workflow template id for "+workflowName+".";
log.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
@@ -149,8 +135,8 @@ public class WorkflowServerHandler implements Iface {
throws InvalidRequestException, AiravataClientException,
AiravataSystemException, TException {
try {
- return getAiravataAPI().getWorkflowManager().isWorkflowExists(workflowName);
- } catch (AiravataAPIInvocationException e) {
+ return getWorkflowCatalog().isWorkflowExistWithName(workflowName);
+ } catch (WorkflowCatalogException e) {
String msg = "Error in veriying the workflow for workflow name "+workflowName+".";
log.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
@@ -158,24 +144,15 @@ public class WorkflowServerHandler implements Iface {
throw exception;
}
}
-
- private String getAiravataUserName() throws ApplicationSettingsException {
- return ServerSettings.getDefaultUserGateway();
- }
-
- private String getGatewayName() throws ApplicationSettingsException {
- return ServerSettings.getDefaultUser();
- }
- private AiravataAPI getAiravataAPI() {
- if (airavataAPI == null) {
+ private WorkflowCatalog getWorkflowCatalog() {
+ if (workflowCatalog == null) {
try {
- airavataAPI = AiravataAPIFactory.getAPI(getGatewayName(),
- getAiravataUserName());
+ workflowCatalog = WorkflowCatalogFactory.getWorkflowCatalog();
} catch (Exception e) {
- log.error("Unable to create Airavata API", e);
+ log.error("Unable to create Workflow Catalog", e);
}
}
- return airavataAPI;
+ return workflowCatalog;
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java
index bc8cde5..dc6b6e1 100644
--- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java
+++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java
@@ -21,13 +21,11 @@
package org.apache.airavata.api.client;
-import java.lang.reflect.InvocationTargetException;
-
import org.apache.airavata.api.Airavata;
+import org.apache.airavata.api.workflow.Workflow;
//import org.apache.airavata.api.appcatalog.ApplicationCatalogAPI;
import org.apache.airavata.model.error.AiravataClientConnectException;
import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TMultiplexedProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
@@ -51,18 +49,19 @@ public class AiravataClientFactory {
}
}
- /*public static ApplicationCatalogAPI.Client createApplicationCatalogClient(String serverHost, int serverPort) throws AiravataClientConnectException{
+ public static Workflow.Client createWorkflowClient(String serverHost, int serverPort) throws AiravataClientConnectException{
try {
TTransport transport = new TSocket(serverHost, serverPort);
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
// TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "AppCatalog");
- return new ApplicationCatalogAPI.Client(protocol);
+ return new Workflow.Client(protocol);
} catch (TTransportException e) {
throw new AiravataClientConnectException("Unable to connect to the server at "+serverHost+":"+serverPort);
}
}
+ /*
public static <T extends org.apache.thrift.TServiceClient> T createApplicationCatalogClient(String serverHost, int serverPort, Class<T> type) throws Exception{
try {
TTransport transport = new TSocket(serverHost, serverPort);
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index d812ff0..fa29da2 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -77,19 +77,19 @@ public class CreateLaunchExperiment {
AiravataUtils.setExecutionAsClient();
client = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT);
System.out.println("API version is " + client.getAPIVersion());
-// addDescriptors();
+ addDescriptors();
// final String expId = createExperimentForSSHHost(airavata);
// final String expId = createExperimentForTrestles(client);
// final String expId = createExperimentForStampede(client);
-// final String expId = createExperimentForLocalHost(client);
+ final String expId = createExperimentForLocalHost(client);
// final String expId = createExperimentForLonestar(airavata);
// final String expId = createExperimentWRFTrestles(client);
// final String expId = createExperimentForBR2(client);
// final String expId = createExperimentForBR2Amber(client);
// final String expId = createExperimentWRFStampede(client);
// final String expId = createExperimentForStampedeAmber(client);
- final String expId = createExperimentForTrestlesAmber(client);
+// final String expId = createExperimentForTrestlesAmber(client);
System.out.println("Experiment ID : " + expId);
// updateExperiment(airavata, expId);
@@ -106,7 +106,7 @@ public class CreateLaunchExperiment {
try {
DocumentCreatorNew documentCreator = new DocumentCreatorNew(client);
// DocumentCreator documentCreator = new DocumentCreator(getAiravataAPI());
-// localHostAppId = documentCreator.createLocalHostDocs();
+ localHostAppId = documentCreator.createLocalHostDocs();
// sshHostAppId = documentCreator.createSSHHostDocs();
// documentCreator.createGramDocs();
// pbsEchoAppId =documentCreator.createPBSDocsForOGCE_Echo();
@@ -118,7 +118,7 @@ public class CreateLaunchExperiment {
// slurmWRFAppId = documentCreator.createSlumWRFDocs();
// br2AmberAppId = documentCreator.createBigRedAmberDocs();
// slurmAmberAppId = documentCreator.createStampedeAmberDocs();
- trestlesAmberAppId = documentCreator.createTrestlesAmberDocs();
+// trestlesAmberAppId = documentCreator.createTrestlesAmberDocs();
System.out.printf(localHostAppId);
System.out.println(sshHostAppId);
System.out.println(pbsEchoAppId);
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/distribution/server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/server/pom.xml b/modules/distribution/server/pom.xml
index fcc4ec4..e7ccde2 100644
--- a/modules/distribution/server/pom.xml
+++ b/modules/distribution/server/pom.xml
@@ -387,6 +387,11 @@
<artifactId>airavata-model-utils</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-engine</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata-api-server</artifactId>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/distribution/server/src/main/assembly/bin-assembly.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/server/src/main/assembly/bin-assembly.xml b/modules/distribution/server/src/main/assembly/bin-assembly.xml
index dcfa0a1..39ebbbb 100644
--- a/modules/distribution/server/src/main/assembly/bin-assembly.xml
+++ b/modules/distribution/server/src/main/assembly/bin-assembly.xml
@@ -221,6 +221,7 @@
<include>org.apache.airavata:airavata-messenger-commons:jar</include>
<include>org.apache.airavata:airavata-messenger-client:jar</include>
<include>org.apache.airavata:airavata-workflow-tracking:jar</include>
+ <include>org.apache.airavata:airavata-workflow-engine:jar</include>
<include>org.apache.airavata:gsissh:jar</include>
<include>org.apache.airavata:airavata-model-utils:jar</include>
<include>org.apache.airavata:airavata-api-server:jar</include>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java
index e00853b..dcf1c6e 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java
@@ -1,112 +1,112 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.orchestrator.core;
-
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.error.LaunchValidationException;
-import org.apache.airavata.model.util.ExperimentModelUtil;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.orchestrator.core.utils.OrchestratorConstants;
-import org.apache.airavata.orchestrator.cpi.Orchestrator;
-import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.ParentDataType;
-import org.apache.airavata.registry.cpi.Registry;
-import org.junit.Assert;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ValidatorTest extends BaseOrchestratorTest {
- private static final Logger log = LoggerFactory.getLogger(NewOrchestratorTest.class);
-
- private Orchestrator orchestrator;
- private List<TaskDetails> tasks;
-
- @BeforeTest
- public void setUp() throws Exception {
- AiravataUtils.setExecutionAsServer();
- super.setUp();
- System.setProperty(OrchestratorConstants.JOB_VALIDATOR,"org.apache.airavata.orchestrator.core.util.TestValidator,org.apache.airavata.orchestrator.core.util.SecondValidator");
- System.setProperty("enable.validation", "true");
- orchestrator = new SimpleOrchestratorImpl();
- }
-
-
-
- @Test
- public void testValidator() throws Exception {
- // creating host description
- List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
- DataObjectType input = new DataObjectType();
- input.setKey("echo_input");
- input.setType(DataType.STRING);
- input.setValue("echo_output=Hello World");
- exInputs.add(input);
-
- List<DataObjectType> exOut = new ArrayList<DataObjectType>();
- DataObjectType output = new DataObjectType();
- output.setKey("echo_output");
- output.setType(DataType.STRING);
- output.setValue("");
- exOut.add(output);
-
- Experiment simpleExperiment =
- ExperimentModelUtil.createSimpleExperiment("default", "admin", "echoExperiment", "SimpleEcho0", "SimpleEcho0", exInputs);
- simpleExperiment.setExperimentOutputs(exOut);
-
- WorkflowNodeDetails test = ExperimentModelUtil.createWorkflowNode("test", null);
- ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("localhost", 1, 1, 1, "normal", 0, 0, 1, "sds128");
- scheduling.setResourceHostId("localhost");
- UserConfigurationData userConfigurationData = new UserConfigurationData();
- userConfigurationData.setAiravataAutoSchedule(false);
- userConfigurationData.setOverrideManualScheduledParams(false);
- userConfigurationData.setComputationalResourceScheduling(scheduling);
- simpleExperiment.setUserConfigurationData(userConfigurationData);
-
- Registry defaultRegistry = RegistryFactory.getDefaultRegistry();
- String experimentId = (String)defaultRegistry.add(ParentDataType.EXPERIMENT, simpleExperiment);
-
- simpleExperiment.setExperimentID(experimentId);
- tasks = orchestrator.createTasks(experimentId);
-
- Assert.assertTrue(orchestrator.validateExperiment(simpleExperiment, test, tasks.get(0)).isValidationState());
-
- simpleExperiment.setExperimentID(null);
-
- try {
- orchestrator.validateExperiment(simpleExperiment, test, tasks.get(0)).isValidationState();
- }catch(LaunchValidationException e){
- Assert.assertTrue(true);
- }
- tasks.get(0).setTaskID(null);
- try {
- orchestrator.validateExperiment(simpleExperiment, test, tasks.get(0));
- }catch (LaunchValidationException e){
- Assert.assertTrue(true);
- }
- }
-
-}
+///*
+// *
+// * 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.orchestrator.core;
+//
+//import org.apache.airavata.common.utils.AiravataUtils;
+//import org.apache.airavata.model.error.LaunchValidationException;
+//import org.apache.airavata.model.util.ExperimentModelUtil;
+//import org.apache.airavata.model.workspace.experiment.*;
+//import org.apache.airavata.orchestrator.core.utils.OrchestratorConstants;
+//import org.apache.airavata.orchestrator.cpi.Orchestrator;
+//import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
+//import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+//import org.apache.airavata.registry.cpi.ParentDataType;
+//import org.apache.airavata.registry.cpi.Registry;
+//import org.junit.Assert;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.testng.annotations.BeforeTest;
+//import org.testng.annotations.Test;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//
+//public class ValidatorTest extends BaseOrchestratorTest {
+// private static final Logger log = LoggerFactory.getLogger(NewOrchestratorTest.class);
+//
+// private Orchestrator orchestrator;
+// private List<TaskDetails> tasks;
+//
+// @BeforeTest
+// public void setUp() throws Exception {
+// AiravataUtils.setExecutionAsServer();
+// super.setUp();
+// System.setProperty(OrchestratorConstants.JOB_VALIDATOR,"org.apache.airavata.orchestrator.core.util.TestValidator,org.apache.airavata.orchestrator.core.util.SecondValidator");
+// System.setProperty("enable.validation", "true");
+// orchestrator = new SimpleOrchestratorImpl();
+// }
+//
+//
+//
+// @Test
+// public void testValidator() throws Exception {
+// // creating host description
+// List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
+// DataObjectType input = new DataObjectType();
+// input.setKey("echo_input");
+// input.setType(DataType.STRING);
+// input.setValue("echo_output=Hello World");
+// exInputs.add(input);
+//
+// List<DataObjectType> exOut = new ArrayList<DataObjectType>();
+// DataObjectType output = new DataObjectType();
+// output.setKey("echo_output");
+// output.setType(DataType.STRING);
+// output.setValue("");
+// exOut.add(output);
+//
+// Experiment simpleExperiment =
+// ExperimentModelUtil.createSimpleExperiment("default", "admin", "echoExperiment", "SimpleEcho0", "SimpleEcho0", exInputs);
+// simpleExperiment.setExperimentOutputs(exOut);
+//
+// WorkflowNodeDetails test = ExperimentModelUtil.createWorkflowNode("test", null);
+// ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("localhost", 1, 1, 1, "normal", 0, 0, 1, "sds128");
+// scheduling.setResourceHostId("localhost");
+// UserConfigurationData userConfigurationData = new UserConfigurationData();
+// userConfigurationData.setAiravataAutoSchedule(false);
+// userConfigurationData.setOverrideManualScheduledParams(false);
+// userConfigurationData.setComputationalResourceScheduling(scheduling);
+// simpleExperiment.setUserConfigurationData(userConfigurationData);
+//
+// Registry defaultRegistry = RegistryFactory.getDefaultRegistry();
+// String experimentId = (String)defaultRegistry.add(ParentDataType.EXPERIMENT, simpleExperiment);
+//
+// simpleExperiment.setExperimentID(experimentId);
+// tasks = orchestrator.createTasks(experimentId);
+//
+// Assert.assertTrue(orchestrator.validateExperiment(simpleExperiment, test, tasks.get(0)).isValidationState());
+//
+// simpleExperiment.setExperimentID(null);
+//
+// try {
+// orchestrator.validateExperiment(simpleExperiment, test, tasks.get(0)).isValidationState();
+// }catch(LaunchValidationException e){
+// Assert.assertTrue(true);
+// }
+// tasks.get(0).setTaskID(null);
+// try {
+// orchestrator.validateExperiment(simpleExperiment, test, tasks.get(0));
+// }catch (LaunchValidationException e){
+// Assert.assertTrue(true);
+// }
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/pom.xml b/modules/workflow-model/pom.xml
index d9d1554..f91882b 100644
--- a/modules/workflow-model/pom.xml
+++ b/modules/workflow-model/pom.xml
@@ -25,8 +25,8 @@
<modules>
<module>workflow-model-core</module>
- <!--module>workflow-model-component</module>
- <module>workflow-model-component-node</module-->
- <!--module>workflow-engine</module-->
+ <module>workflow-model-component</module>
+ <!--module>workflow-model-component-node</module-->
+ <module>workflow-engine</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/pom.xml b/modules/workflow-model/workflow-engine/pom.xml
new file mode 100644
index 0000000..fcdfd87
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/pom.xml
@@ -0,0 +1,328 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-model-parent</artifactId>
+ <version>0.13-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>airavata-workflow-engine</artifactId>
+ <packaging>jar</packaging>
+ <name>Airavata Workflow Engine</name>
+ <url>http://airavata.apache.org/</url>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>restore-persistence</id>
+ <phase>prepare-package</phase>
+ <configuration>
+ <tasks>
+ <copy file="${project.build.outputDirectory}/services.xml" tofile="${project.build.outputDirectory}/META-INF/services.xml" />
+ <copy file="src/main/resources/WorkflowInterpretor.wsdl" tofile="${project.build.outputDirectory}/META-INF/service.wsdl" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/target/jnlp/lib</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <excludeTransitive>false</excludeTransitive>
+ </configuration>
+ </execution>
+ <!--execution>
+ <id>unpack-dependencies</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>apache-airavata-samples</artifactId>
+ <type>zip</type>
+ <outputDirectory>${project.build.directory}/samples</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution-->
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!--dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>apache-airavata-samples</artifactId>
+ <version>${project.version}</version>
+ <type>zip</type>
+ <optional>true</optional>
+ </dependency-->
+
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>xpp3</artifactId>
+ <version>${xpp3.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>xpp5</artifactId>
+ <version>${xpp5.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>xsul</artifactId>
+ <version>${xsul.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>gpel-client</artifactId>
+ <version>${gpel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>atomixmiser</artifactId>
+ <version>${atomixmiser.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.python</groupId>
+ <artifactId>jython</artifactId>
+ <version>${jython.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>${xmlbeans.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>${axis2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${axis2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-dom</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-transport-local</artifactId>
+ <version>${axis2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-transport-http</artifactId>
+ <version>${axis2.version}</version>
+ </dependency>
+
+ <!-- AMAZON STUFFS -->
+ <dependency>
+ <groupId>com.amazonaws</groupId>
+ <artifactId>aws-java-sdk</artifactId>
+ <version>1.3.20</version>
+ </dependency>
+ <dependency>
+ <groupId>net.java.dev.jets3t</groupId>
+ <artifactId>jets3t</artifactId>
+ <version>0.8.0</version>
+ </dependency>
+
+ <!-- AIRAVATA modules -->
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-model-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-model-component</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-message-monitor</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-model-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-orchestrator-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-client-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-common-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-tracking</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-jpa-registry</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-registry-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- JCR Support -->
+ <!-- TODO need clean up -->
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-gfac-schema-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-gfac-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-gfac-ec2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ <version>${jcr.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-execution-context</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--dependency> <groupId>org.apache.airavata</groupId> <artifactId>airavata-jpa-registry</artifactId> <version>${project.version}</version>
+ </dependency -->
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbyclient</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.globusonline</groupId>-->
+ <!--<artifactId>transfer-api-client-java</artifactId>-->
+ <!--<version>0.10.8</version>-->
+ <!--</dependency>-->
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ <version>4.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-client-configuration</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-server-configuration</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalog.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalog.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalog.java
new file mode 100644
index 0000000..9d825e8
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalog.java
@@ -0,0 +1,53 @@
+/*
+ *
+ * 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.catalog;
+
+import java.util.List;
+
+import org.apache.airavata.model.Workflow;
+import org.apache.airavata.model.error.AiravataClientException;
+import org.apache.airavata.model.error.AiravataSystemException;
+import org.apache.airavata.model.error.InvalidRequestException;
+import org.apache.thrift.TException;
+
+public interface WorkflowCatalog {
+ public List<String> getAllWorkflows() throws WorkflowCatalogException;
+
+ public Workflow getWorkflow(String workflowTemplateId)
+ throws WorkflowCatalogException;
+
+ public void deleteWorkflow(String workflowTemplateId)
+ throws WorkflowCatalogException;
+
+ public String registerWorkflow(Workflow workflow)
+ throws WorkflowCatalogException;
+
+ public void updateWorkflow(String workflowTemplateId, Workflow workflow)
+ throws WorkflowCatalogException;
+
+ public String getWorkflowTemplateId(String workflowName)
+ throws WorkflowCatalogException;
+
+ public boolean isWorkflowExistWithName(String workflowName)
+ throws WorkflowCatalogException;
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogException.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogException.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogException.java
new file mode 100644
index 0000000..b6caa5f
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogException.java
@@ -0,0 +1,17 @@
+package org.apache.airavata.workflow.catalog;
+
+public class WorkflowCatalogException extends Exception{
+ private static final long serialVersionUID = -2849422320139467602L;
+
+ public WorkflowCatalogException(Throwable e) {
+ super(e);
+ }
+
+ public WorkflowCatalogException(String message) {
+ super(message, null);
+ }
+
+ public WorkflowCatalogException(String message, Throwable e) {
+ super(message, e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogFactory.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogFactory.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogFactory.java
new file mode 100644
index 0000000..9156282
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogFactory.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.catalog;
+
+public class WorkflowCatalogFactory {
+ private static WorkflowCatalogImpl workflowCatalog;
+
+ public static WorkflowCatalog getWorkflowCatalog(){
+ if (workflowCatalog==null) {
+ workflowCatalog = new WorkflowCatalogImpl();
+ }
+ return workflowCatalog;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogImpl.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogImpl.java
new file mode 100644
index 0000000..4a3dcf1
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogImpl.java
@@ -0,0 +1,173 @@
+/*
+ *
+ * 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.catalog;
+
+import java.util.List;
+
+import org.apache.airavata.client.AiravataAPIFactory;
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.model.Workflow;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkflowCatalogImpl implements WorkflowCatalog {
+ private static final Logger log = LoggerFactory.getLogger(WorkflowCatalogImpl.class);
+
+ private AiravataAPI airavataAPI;
+
+ public List<String> getAllWorkflows() throws WorkflowCatalogException{
+ try {
+ return getAiravataAPI().getWorkflowManager()
+ .getWorkflowTemplateIds();
+ } catch (AiravataAPIInvocationException e) {
+ String msg = "Error in retrieving all workflow template Ids.";
+ log.error(msg, e);
+ WorkflowCatalogException exception = new WorkflowCatalogException(msg + " More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ public Workflow getWorkflow(String workflowTemplateId)
+ throws WorkflowCatalogException{
+ try {
+ org.apache.airavata.workflow.model.wf.Workflow w = getAiravataAPI()
+ .getWorkflowManager().getWorkflow(workflowTemplateId);
+ Workflow workflow = new Workflow();
+ workflow.setTemplateId(workflowTemplateId);
+ workflow.setGraph(XMLUtil.xmlElementToString(w.toXML()));
+ workflow.setName(w.getName());
+ return workflow;
+ } catch (AiravataAPIInvocationException e) {
+ String msg = "Error in retrieving the workflow "
+ + workflowTemplateId + ".";
+ log.error(msg, e);
+ WorkflowCatalogException exception = new WorkflowCatalogException(msg + " More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ public void deleteWorkflow(String workflowTemplateId)
+ throws WorkflowCatalogException{
+ try {
+ getAiravataAPI().getWorkflowManager().deleteWorkflow(
+ workflowTemplateId);
+ } catch (AiravataAPIInvocationException e) {
+ String msg = "Error in deleting the workflow " + workflowTemplateId
+ + ".";
+ log.error(msg, e);
+ WorkflowCatalogException exception = new WorkflowCatalogException(msg + " More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ public String registerWorkflow(Workflow workflow)
+ throws WorkflowCatalogException {
+ try {
+ getAiravataAPI().getWorkflowManager().addWorkflow(
+ workflow.getGraph());
+ return workflow.getName();
+ } catch (AiravataAPIInvocationException e) {
+ String msg = "Error in registering the workflow "
+ + workflow.getName() + ".";
+ log.error(msg, e);
+ WorkflowCatalogException exception = new WorkflowCatalogException(msg + " More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ public void updateWorkflow(String workflowTemplateId, Workflow workflow)
+ throws WorkflowCatalogException {
+ try {
+ getAiravataAPI().getWorkflowManager().updateWorkflow(
+ workflowTemplateId, workflow.getGraph());
+ } catch (AiravataAPIInvocationException e) {
+ String msg = "Error in updating the workflow " + workflow.getName()
+ + ".";
+ log.error(msg, e);
+ WorkflowCatalogException exception = new WorkflowCatalogException(msg + " More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ public String getWorkflowTemplateId(String workflowName)
+ throws WorkflowCatalogException {
+ try {
+ if (getAiravataAPI().getWorkflowManager().isWorkflowExists(
+ workflowName)) {
+ return workflowName;
+ }
+ WorkflowCatalogException airavataClientException = new WorkflowCatalogException("No worklfow exists with the name "
+ + workflowName);
+ throw airavataClientException;
+ } catch (AiravataAPIInvocationException e) {
+ String msg = "Error in retrieving the workflow template id for "
+ + workflowName + ".";
+ log.error(msg, e);
+ WorkflowCatalogException exception = new WorkflowCatalogException(msg + " More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ public boolean isWorkflowExistWithName(String workflowName)
+ throws WorkflowCatalogException {
+ try {
+ return getAiravataAPI().getWorkflowManager().isWorkflowExists(
+ workflowName);
+ } catch (AiravataAPIInvocationException e) {
+ String msg = "Error in veriying the workflow for workflow name "
+ + workflowName + ".";
+ log.error(msg, e);
+ WorkflowCatalogException exception = new WorkflowCatalogException(msg + " More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ private String getAiravataUserName() throws ApplicationSettingsException {
+ return ServerSettings.getDefaultUserGateway();
+ }
+
+ private String getGatewayName() throws ApplicationSettingsException {
+ return ServerSettings.getDefaultUser();
+ }
+
+ private AiravataAPI getAiravataAPI() {
+ if (airavataAPI == null) {
+ try {
+ airavataAPI = AiravataAPIFactory.getAPI(getGatewayName(),
+ getAiravataUserName());
+ } catch (Exception e) {
+ log.error("Unable to create Airavata API", e);
+ }
+ }
+ return airavataAPI;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/concurrent/PredicatedExecutable.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/concurrent/PredicatedExecutable.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/concurrent/PredicatedExecutable.java
new file mode 100644
index 0000000..060ef55
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/concurrent/PredicatedExecutable.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.concurrent;
+
+/**
+ * Intended for jobs that are runnable; Way of determining
+ * whether a given job is ready to be executed
+ *
+ * @author Chathura Herath
+ */
+public interface PredicatedExecutable extends Runnable{
+
+ public boolean isReady();
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/concurrent/PredicatedTaskRunner.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/concurrent/PredicatedTaskRunner.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/concurrent/PredicatedTaskRunner.java
new file mode 100644
index 0000000..89557ab
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/concurrent/PredicatedTaskRunner.java
@@ -0,0 +1,153 @@
+/*
+ *
+ * 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.concurrent;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * Used to run jobs that need to be started after a predicate is
+ *
+ * @author Chathura Herath
+ */
+public class PredicatedTaskRunner {
+
+ protected volatile ConcurrentLinkedQueue<PredicatedExecutable> jobQueue = new ConcurrentLinkedQueue<PredicatedExecutable>();
+
+ protected ExecutorService threadPool;
+
+ protected volatile boolean stop = false;
+
+ public PredicatedTaskRunner(int numberOfThreads) {
+ this.threadPool = Executors.newFixedThreadPool(numberOfThreads);
+ addIdleTask();
+ startCheckThread();
+
+ }
+
+ private void addIdleTask() {
+ PredicatedExecutable sleepTask = new PredicatedExecutable() {
+
+ @Override
+ public void run() {
+ synchronized (jobQueue) {
+ if (jobQueue.size() == 1) {
+ try {
+ jobQueue.wait();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ } else if (allTasksAreWaiting(jobQueue)) {
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+
+ }
+
+ private boolean allTasksAreWaiting(
+ ConcurrentLinkedQueue<PredicatedExecutable> jobQueue) {
+ for (PredicatedExecutable predicatedExecutable : jobQueue) {
+ if (predicatedExecutable.isReady()) {
+ return false;
+ }
+ }
+ return true;
+
+ }
+
+ @Override
+ public boolean isReady() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+ };
+
+ this.jobQueue.add(sleepTask);
+ }
+
+ private void startCheckThread() {
+ new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+
+ while (!stop) {
+ try {
+
+
+ synchronized (jobQueue) {
+ while(jobQueue.size() == 0 || allTasksAreWaiting(jobQueue)){
+ jobQueue.wait(50);
+ }
+ }
+
+ PredicatedExecutable job = jobQueue.remove();
+ if (job.isReady()) {
+ // remove from front and execute and you are done
+ threadPool.execute(job);
+ } else {
+ // add to end if not ready to run
+ jobQueue.add(job);
+ }
+
+
+
+ } catch (Throwable e) {
+ // we go on no matter what
+ e.printStackTrace();
+ }
+ }
+
+ }
+ }).start();
+ }
+
+ private boolean allTasksAreWaiting(
+ ConcurrentLinkedQueue<PredicatedExecutable> jobQueue) {
+ for (PredicatedExecutable predicatedExecutable : jobQueue) {
+ if (predicatedExecutable.isReady()) {
+ return false;
+ }
+ }
+ return true;
+
+ }
+
+ public void scedule(PredicatedExecutable job) {
+
+ synchronized (jobQueue) {
+ this.jobQueue.add(job);
+ this.jobQueue.notifyAll();
+ }
+
+ }
+
+ public void shutDown() {
+ this.threadPool.shutdown();
+ this.stop = 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/core/amazon/AmazonCredential.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/amazon/AmazonCredential.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/amazon/AmazonCredential.java
new file mode 100644
index 0000000..62b5452
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/amazon/AmazonCredential.java
@@ -0,0 +1,79 @@
+/*
+ *
+ * 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.core.amazon;
+
+public class AmazonCredential {
+ private static AmazonCredential instance;
+ private String awsAccesskey;
+ private String awsSecretAccessKey;
+
+ private AmazonCredential() {
+ this.awsAccesskey = "";
+ this.awsSecretAccessKey = "";
+ }
+
+ /**
+ *
+ * @return AmazonCredential
+ */
+ public static AmazonCredential getInstance() {
+ if (instance == null) {
+ instance = new AmazonCredential();
+ }
+ return instance;
+ }
+
+ /**
+ *
+ * @param accesskey
+ */
+ public void setAwsAccessKeyId(String accesskey) {
+ this.awsAccesskey = accesskey;
+ }
+
+ /**
+ *
+ * @param secretAccessKey
+ */
+ public void setAwsSecretAccessKey(String secretAccessKey) {
+ this.awsSecretAccessKey = secretAccessKey;
+ }
+
+ /**
+ *
+ * @param accesskey
+ * @return
+ */
+ public String getAwsAccessKeyId() {
+ return this.awsAccesskey;
+ }
+
+ /**
+ *
+ * @param secretAccessKey
+ * @return
+ */
+ public String getAwsSecretAccessKey() {
+ return this.awsSecretAccessKey;
+ }
+
+}
\ 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/core/amazon/EC2InstanceResult.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/amazon/EC2InstanceResult.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/amazon/EC2InstanceResult.java
new file mode 100644
index 0000000..dc838f5
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/amazon/EC2InstanceResult.java
@@ -0,0 +1,95 @@
+package org.apache.airavata.workflow.engine.core.amazon;
+///*
+// *
+// * 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.core.amazon;
+//
+//import org.apache.airavata.xbaya.ui.widgets.TableRenderable;
+//
+//import com.amazonaws.services.ec2.model.Instance;
+//
+//public class EC2InstanceResult implements TableRenderable {
+//
+// private static String[] columnName = { "Instance", "AMI ID", "Root Device", "Type", "Status", "Key Pair Name",
+// "Monitoring", "Virtualization", "Placement Group" };
+//
+// private Instance instance;
+//
+// /**
+// *
+// * Constructs a EC2InstancesResult.
+// *
+// * @param ins
+// */
+// public EC2InstanceResult(Instance ins) {
+// this.instance = ins;
+// }
+//
+// public Instance getInstance() {
+// return this.instance;
+// }
+//
+// /**
+// * @see org.apache.airavata.xbaya.ui.widgets.TableRenderable#getColumnCount()
+// */
+// @Override
+// public int getColumnCount() {
+// return 8;
+// }
+//
+// /**
+// * @see org.apache.airavata.xbaya.ui.widgets.TableRenderable#getColumnTitle(int)
+// */
+// @Override
+// public String getColumnTitle(int index) {
+// return columnName[index];
+// }
+//
+// /**
+// * @see org.apache.airavata.xbaya.ui.widgets.TableRenderable#getValue(int)
+// */
+// @Override
+// public Object getValue(int index) {
+// switch (index) {
+// case 0:
+// return this.instance.getInstanceId();
+// case 1:
+// return this.instance.getImageId();
+// case 2:
+// return this.instance.getRootDeviceType();
+// case 3:
+// return this.instance.getInstanceType();
+// case 4:
+// return this.instance.getState().getName();
+// case 5:
+// return this.instance.getKeyName();
+// case 6:
+// return this.instance.getMonitoring().getState();
+// case 7:
+// return this.instance.getVirtualizationType();
+// case 8:
+// return this.instance.getPlacement().getGroupName();
+// default:
+// 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/core/generators/XmlBeansFiler.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/generators/XmlBeansFiler.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/generators/XmlBeansFiler.java
new file mode 100644
index 0000000..e78adcf
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/generators/XmlBeansFiler.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.core.generators;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.LinkedList;
+import java.util.List;
+
+public class XmlBeansFiler /* implements Filer */{
+
+ private String path;
+
+ private List<File> javaFilePaths = new LinkedList<File>();
+
+ /**
+ * Constructs a XmlBeansFiler.
+ *
+ * @param file
+ */
+ public XmlBeansFiler(String path) {
+ this.path = path + "/generated";
+ }
+
+ /**
+ * @see org.apache.xmlbeans.Filer#createBinaryFile(java.lang.String)
+ */
+ public OutputStream createBinaryFile(String name) throws IOException {
+ name = name.replace('.', File.separatorChar);
+ String binPath = this.path + File.separatorChar + name;
+ File srcFile = new File(binPath);
+ srcFile.getParentFile().mkdirs();
+ return new FileOutputStream(new File(binPath));
+ }
+
+ /**
+ * @see org.apache.xmlbeans.Filer#createSourceFile(java.lang.String)
+ */
+ public Writer createSourceFile(String name) throws IOException {
+ name = name.replace('.', File.separatorChar);
+ String srcPath = this.path + File.separatorChar + name + ".java";
+ File srcFile = new File(srcPath);
+ srcFile.getParentFile().mkdirs();
+ javaFilePaths.add(new File(srcFile.getCanonicalPath()));
+ return new FileWriter(srcFile);
+ }
+
+}
\ No newline at end of file
[9/9] git commit: introducing workflow engine cpi
Posted by sa...@apache.org.
introducing workflow engine cpi
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/0095c915
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/0095c915
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/0095c915
Branch: refs/heads/workflow-support
Commit: 0095c915145ff26a0d1a39c2059c09687098e602
Parents: a8974b7
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Fri Jul 11 22:31:17 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Fri Jul 11 22:31:17 2014 -0400
----------------------------------------------------------------------
.../catalog/WorkflowCatalogFactory.java | 2 +-
.../workflow/engine/WorkflowEngine.java | 26 +++++++
.../engine/WorkflowEngineException.java | 17 +++++
.../workflow/engine/WorkflowEngineFactory.java | 33 +++++++++
.../workflow/engine/WorkflowEngineImpl.java | 77 ++++++++++++++++++++
5 files changed, 154 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/0095c915/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogFactory.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogFactory.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogFactory.java
index 9156282..3b4e747 100644
--- a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogFactory.java
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/catalog/WorkflowCatalogFactory.java
@@ -22,7 +22,7 @@
package org.apache.airavata.workflow.catalog;
public class WorkflowCatalogFactory {
- private static WorkflowCatalogImpl workflowCatalog;
+ private static WorkflowCatalog workflowCatalog;
public static WorkflowCatalog getWorkflowCatalog(){
if (workflowCatalog==null) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/0095c915/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngine.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngine.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngine.java
new file mode 100644
index 0000000..3d17378
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngine.java
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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;
+
+public interface WorkflowEngine {
+ public void launchExperiment(String experimentId, String token) throws WorkflowEngineException;
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0095c915/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineException.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineException.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineException.java
new file mode 100644
index 0000000..1ef965d
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineException.java
@@ -0,0 +1,17 @@
+package org.apache.airavata.workflow.engine;
+
+public class WorkflowEngineException extends Exception{
+ private static final long serialVersionUID = -2849422320139467602L;
+
+ public WorkflowEngineException(Throwable e) {
+ super(e);
+ }
+
+ public WorkflowEngineException(String message) {
+ super(message, null);
+ }
+
+ public WorkflowEngineException(String message, Throwable e) {
+ super(message, e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0095c915/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineFactory.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineFactory.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineFactory.java
new file mode 100644
index 0000000..272d11a
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineFactory.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;
+
+public class WorkflowEngineFactory {
+ private static WorkflowEngine workflowCatalog;
+
+ public static WorkflowEngine getWorkflowEngine(){
+ if (workflowCatalog==null) {
+ workflowCatalog = new WorkflowEngineImpl();
+ }
+ return workflowCatalog;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/0095c915/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineImpl.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineImpl.java
new file mode 100644
index 0000000..84045ab
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineImpl.java
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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;
+
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.orchestrator.client.OrchestratorClientFactory;
+import org.apache.airavata.orchestrator.cpi.OrchestratorService;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.airavata.workflow.catalog.WorkflowCatalog;
+import org.apache.airavata.workflow.catalog.WorkflowCatalogFactory;
+import org.apache.airavata.workflow.engine.interpretor.WorkflowInterpreter;
+import org.apache.airavata.workflow.engine.interpretor.WorkflowInterpreterConfiguration;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkflowEngineImpl implements WorkflowEngine {
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowEngineImpl.class);
+
+ @Override
+ public void launchExperiment(String experimentId, String token)
+ throws WorkflowEngineException {
+ try {
+ Registry registry = RegistryFactory.getDefaultRegistry();
+ Experiment experiment = (Experiment)registry.get(RegistryModelType.EXPERIMENT, experimentId);
+ WorkflowCatalog workflowCatalog = WorkflowCatalogFactory.getWorkflowCatalog();
+ WorkflowInterpreterConfiguration config = new WorkflowInterpreterConfiguration(new Workflow(workflowCatalog.getWorkflow(experiment.getApplicationId()).getGraph()));
+ final WorkflowInterpreter workflowInterpreter = new WorkflowInterpreter(experiment, token, config , getOrchestratorClient());
+ new Thread(){
+ public void run() {
+ try {
+ workflowInterpreter.scheduleDynamically();
+ } catch (WorkflowException e) {
+ e.printStackTrace();
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ }
+ };
+ }.start();
+ } catch (Exception e) {
+ logger.error("Error while retrieving the experiment", e);
+ WorkflowEngineException exception = new WorkflowEngineException("Error while launching the workflow experiment. More info : " + e.getMessage());
+ throw exception;
+ }
+
+ }
+
+ private OrchestratorService.Client getOrchestratorClient() {
+ final int serverPort = Integer.parseInt(ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ORCHESTRATOR_SERVER_PORT,"8940"));
+ final String serverHost = ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.ORCHESTRATOR_SERVER_HOST, null);
+ return OrchestratorClientFactory.createOrchestratorClient(serverHost, serverPort);
+ }
+}
[3/9] introducing workflow support in airavata api + other related
modules
Posted by sa...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/resources/wsdls/eventing.wsdl
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/resources/wsdls/eventing.wsdl b/modules/workflow-model/workflow-engine/src/main/resources/wsdls/eventing.wsdl
new file mode 100644
index 0000000..ac33777
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/resources/wsdls/eventing.wsdl
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<wsdl:definitions targetNamespace='http://schemas.xmlsoap.org/ws/2004/08/eventing' xmlns:wse='http://schemas.xmlsoap.org/ws/2004/08/eventing'
+ xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+
+ <wsdl:types>
+
+ <xs:schema targetNamespace="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:tns="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+ xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified" blockDefault="#all">
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd" />
+
+ <xs:import namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing" schemaLocation="http://schemas.xmlsoap.org/ws/2004/08/addressing" />
+
+ <!-- Types and global elements -->
+ <xs:complexType name="DeliveryType" mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="Mode" type="xs:anyURI" use="optional" />
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+
+ <xs:element name="NotifyTo" type="wsa:EndpointReferenceType" />
+
+ <xs:simpleType name="NonNegativeDurationType">
+ <xs:restriction base="xs:duration">
+ <xs:minInclusive value="P0Y0M0DT0H0M0S" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ExpirationType">
+ <xs:union memberTypes="xs:dateTime tns:NonNegativeDurationType" />
+ </xs:simpleType>
+
+ <xs:complexType name="FilterType" mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="Dialect" type="xs:anyURI" use="optional" />
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+
+ <xs:complexType name="LanguageSpecificStringType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute ref="xml:lang" />
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <!-- Subscribe request -->
+ <xs:element name="Subscribe">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="EndTo" type="wsa:EndpointReferenceType" minOccurs="0" />
+ <xs:element name="Delivery" type="tns:DeliveryType" />
+ <xs:element name="Expires" type="tns:ExpirationType" minOccurs="0" />
+ <xs:element name="Filter" type="tns:FilterType" minOccurs="0" />
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="Identifier" type="xs:anyURI" />
+
+ <!-- Subscribe response -->
+ <xs:element name="SubscribeResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="SubscriptionManager" type="wsa:EndpointReferenceType" />
+ <xs:element name="Expires" type="tns:ExpirationType" />
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Used in a fault if there's an unsupported dialect -->
+ <xs:element name="SupportedDialect" type="xs:anyURI" />
+
+ <!-- Used in a fault if there's an unsupported delivery mode -->
+ <xs:element name="SupportedDeliveryMode" type="xs:anyURI" />
+
+ <!-- Renew request -->
+ <xs:element name="Renew">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Expires" type="tns:ExpirationType" minOccurs="0" />
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Renew response -->
+ <xs:element name="RenewResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Expires" type="tns:ExpirationType" minOccurs="0" />
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- GetStatus request -->
+ <xs:element name="GetStatus">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- GetStatus response -->
+ <xs:element name="GetStatusResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Expires" type="tns:ExpirationType" minOccurs="0" />
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Unsubscribe request -->
+ <xs:element name="Unsubscribe">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- count(/s:Envelope/s:Body/*) = 0 for Unsubscribe response -->
+
+ <!-- SubscriptionEnd message -->
+ <xs:element name="SubscriptionEnd">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="SubscriptionManager" type="wsa:EndpointReferenceType" />
+ <xs:element name="Status" type="tns:OpenSubscriptionEndCodeType" />
+ <xs:element name="Reason" type="tns:LanguageSpecificStringType" minOccurs="0" maxOccurs="unbounded" />
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="SubscriptionEndCodeType">
+ <xs:restriction base="xs:anyURI">
+ <xs:enumeration value="http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryFailure" />
+ <xs:enumeration value="http://schemas.xmlsoap.org/ws/2004/08/eventing/SourceShuttingDown" />
+ <xs:enumeration value="http://schemas.xmlsoap.org/ws/2004/08/eventing/SourceCancelling" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="OpenSubscriptionEndCodeType">
+ <xs:union memberTypes="tns:SubscriptionEndCodeType xs:anyURI" />
+ </xs:simpleType>
+
+ <xs:attribute name="EventSource" type="xs:boolean" />
+
+ </xs:schema>
+
+ <xs:schema targetNamespace="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" elementFormDefault="qualified" blockDefault="#all">
+ <!-- //////////////////// WS-Addressing //////////////////// -->
+ <!-- Endpoint reference -->
+ <xs:element name="EndpointReference" type="wsa:EndpointReferenceType" />
+ <xs:complexType name="EndpointReferenceType">
+ <xs:sequence>
+ <xs:element name="Address" type="wsa:AttributedURI" />
+ <xs:element name="ReferenceProperties" type="wsa:ReferencePropertiesType" minOccurs="0" />
+ <xs:element name="ReferenceParameters" type="wsa:ReferenceParametersType" minOccurs="0" />
+ <xs:element name="PortType" type="wsa:AttributedQName" minOccurs="0" />
+ <xs:element name="ServiceName" type="wsa:ServiceNameType" minOccurs="0" />
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>
+ If "Policy" elements from namespace "http://schemas.xmlsoap.org/ws/2002/12/policy#policy" are used, they must
+ appear first (before any extensibility elements).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:any>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:complexType>
+ <xs:complexType name="ReferencePropertiesType">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="ReferenceParametersType">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="ServiceNameType">
+ <xs:simpleContent>
+ <xs:extension base="xs:QName">
+ <xs:attribute name="PortName" type="xs:NCName" />
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <!-- Message information header blocks -->
+ <xs:element name="MessageID" type="wsa:AttributedURI" />
+ <xs:element name="RelatesTo" type="wsa:Relationship" />
+ <xs:element name="To" type="wsa:AttributedURI" />
+ <xs:element name="Action" type="wsa:AttributedURI" />
+ <xs:element name="From" type="wsa:EndpointReferenceType" />
+ <xs:element name="ReplyTo" type="wsa:EndpointReferenceType" />
+ <xs:element name="FaultTo" type="wsa:EndpointReferenceType" />
+ <xs:complexType name="Relationship">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="RelationshipType" type="xs:QName" use="optional" />
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:simpleType name="RelationshipTypeValues">
+ <xs:restriction base="xs:QName">
+ <xs:enumeration value="wsa:Reply" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:element name="ReplyAfter" type="wsa:ReplyAfterType" />
+ <xs:complexType name="ReplyAfterType">
+ <xs:simpleContent>
+ <xs:extension base="xs:nonNegativeInteger">
+ <xs:anyAttribute namespace="##other" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:simpleType name="FaultSubcodeValues">
+ <xs:restriction base="xs:QName">
+ <xs:enumeration value="wsa:InvalidMessageInformationHeader" />
+ <xs:enumeration value="wsa:MessageInformationHeaderRequired" />
+ <xs:enumeration value="wsa:DestinationUnreachable" />
+ <xs:enumeration value="wsa:ActionNotSupported" />
+ <xs:enumeration value="wsa:EndpointUnavailable" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:attribute name="Action" type="xs:anyURI" />
+ <!-- Common declarations and definitions -->
+ <xs:complexType name="AttributedQName">
+ <xs:simpleContent>
+ <xs:extension base="xs:QName">
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="AttributedURI">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:anyAttribute namespace="##other" processContents="lax" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:schema>
+
+ </wsdl:types>
+
+ <wsdl:message name='SubscribeMsg'>
+ <wsdl:part name='body' element='wse:Subscribe' />
+ </wsdl:message>
+ <wsdl:message name='SubscribeResponseMsg'>
+ <wsdl:part name='body' element='wse:SubscribeResponse' />
+ </wsdl:message>
+
+ <wsdl:message name='RenewMsg'>
+ <wsdl:part name='body' element='wse:Renew' />
+ </wsdl:message>
+ <wsdl:message name='RenewResponseMsg'>
+ <wsdl:part name='body' element='wse:RenewResponse' />
+ </wsdl:message>
+
+ <wsdl:message name='GetStatusMsg'>
+ <wsdl:part name='body' element='wse:GetStatus' />
+ </wsdl:message>
+ <wsdl:message name='GetStatusResponseMsg'>
+ <wsdl:part name='body' element='wse:GetStatusResponse' />
+ </wsdl:message>
+
+ <wsdl:message name='UnsubscribeMsg'>
+ <wsdl:part name='body' element='wse:Unsubscribe' />
+ </wsdl:message>
+ <wsdl:message name='UnsubscribeResponseMsg' />
+
+ <wsdl:message name='SubscriptionEnd'>
+ <wsdl:part name='body' element='wse:SubscriptionEnd' />
+ </wsdl:message>
+
+ <wsdl:portType name='EventSource'>
+ <wsdl:operation name='SubscribeOp'>
+ <wsdl:input message='wse:SubscribeMsg' />
+ <wsdl:output message='wse:SubscribeResponseMsg' />
+ </wsdl:operation>
+ <wsdl:operation name='SubscriptionEnd'>
+ <wsdl:output message='wse:SubscriptionEnd' />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name='SubscriptionManager'>
+ <wsdl:operation name='RenewOp'>
+ <wsdl:input message='wse:RenewMsg' />
+ <wsdl:output message='wse:RenewResponseMsg' />
+ </wsdl:operation>
+ <wsdl:operation name='GetStatusOp'>
+ <wsdl:input message='wse:GetStatusMsg' />
+ <wsdl:output message='wse:GetStatusResponseMsg' />
+ </wsdl:operation>
+ <wsdl:operation name='UnsubscribeOp'>
+ <wsdl:input message='wse:UnsubscribeMsg' />
+ <wsdl:output message='wse:UnsubscribeResponseMsg' />
+ </wsdl:operation>
+ </wsdl:portType>
+</wsdl:definitions>
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexForEachWorkflowTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexForEachWorkflowTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexForEachWorkflowTest.java
new file mode 100644
index 0000000..a096071
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexForEachWorkflowTest.java
@@ -0,0 +1,73 @@
+///*
+// *
+// * 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.interpreter;
+//
+//import java.io.IOException;
+//import java.net.URISyntaxException;
+//import java.net.URL;
+//import java.util.UUID;
+//
+////import org.apache.airavata.registry.api.AiravataRegistry2;
+//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.interpreter.utils.WorkflowTestUtils;
+//import org.apache.airavata.xbaya.interpretor.SSWorkflowInterpreterInteractorImpl;
+//import org.apache.airavata.xbaya.interpretor.StandaloneNotificationSender;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//public class ComplexForEachWorkflowTest {
+// final Logger logger = LoggerFactory.getLogger(ForEachWorkflowTest.class);
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// @Test
+// public void testScheduleDynamically() throws IOException, URISyntaxException, WorkflowException {
+// logger.info("Running ComplexForEachWorkflowTest...");
+// URL systemResource = this.getClass().getClassLoader().getSystemResource("ComplexForEach.xwf");
+// Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
+//// ((InputNode) workflow.getGraph().getNode("input")).setDefaultValue("1");
+// XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
+//// AiravataRegistry2 registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+//// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf,null,null,true);
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,
+// UUID.randomUUID().toString(), conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf,null,null,true);
+//
+// workflowInterpreterConfiguration.setNotifier(new StandaloneNotificationSender(workflowInterpreterConfiguration.getTopic(),workflowInterpreterConfiguration.getWorkflow()));
+// SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl();
+//
+// WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,ssWorkflowInterpreterInteractorImpl);
+// interpretor.scheduleDynamically();
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathService.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathService.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathService.java
new file mode 100644
index 0000000..ce50e50
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathService.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.xbaya.interpreter;
+
+public class ComplexMathService {
+ public int adder(int param1, int param2) {
+ return param1 + param2;
+ }
+
+ public int multiplier(int param1, int param2) {
+ return param1 * param2;
+ }
+
+ public String echo(String str) {
+ return str;
+ }
+
+ public String concatenate(String str1, String str2) {
+ return str1 + str2;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathWorkflowTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathWorkflowTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathWorkflowTest.java
new file mode 100644
index 0000000..dd7d184
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathWorkflowTest.java
@@ -0,0 +1,71 @@
+///*
+// *
+// * 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.interpreter;
+//
+//import java.io.IOException;
+//import java.net.URISyntaxException;
+//import java.net.URL;
+//import java.util.UUID;
+//
+////import org.apache.airavata.registry.api.AiravataRegistry2;
+//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.interpreter.utils.WorkflowTestUtils;
+//import org.apache.airavata.xbaya.interpretor.SSWorkflowInterpreterInteractorImpl;
+//import org.apache.airavata.xbaya.interpretor.StandaloneNotificationSender;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//public class ComplexMathWorkflowTest {
+// final Logger logger = LoggerFactory.getLogger(ComplexMathWorkflowTest.class);
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// @Test
+// public void testScheduleDynamically() throws IOException, URISyntaxException, WorkflowException {
+// logger.info("Running ComplexMathWorkflowTest...");
+// URL systemResource = this.getClass().getClassLoader().getSystemResource("ComplexMath.xwf");
+// Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
+// XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
+//// AiravataRegistry2 registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+//// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,true);
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,
+// UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, null,null,true);
+// workflowInterpreterConfiguration.setNotifier(new StandaloneNotificationSender(workflowInterpreterConfiguration.getTopic(),workflowInterpreterConfiguration.getWorkflow()));
+// SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl();
+// WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,ssWorkflowInterpreterInteractorImpl);
+// interpretor.scheduleDynamically();
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/CrossProductWorkflowTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/CrossProductWorkflowTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/CrossProductWorkflowTest.java
new file mode 100644
index 0000000..6971e8a
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/CrossProductWorkflowTest.java
@@ -0,0 +1,71 @@
+///*
+// *
+// * 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.interpreter;
+//
+//import java.io.IOException;
+//import java.net.URISyntaxException;
+//import java.net.URL;
+//import java.util.UUID;
+//
+////import org.apache.airavata.registry.api.AiravataRegistry2;
+//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.interpreter.utils.WorkflowTestUtils;
+//import org.apache.airavata.xbaya.interpretor.SSWorkflowInterpreterInteractorImpl;
+//import org.apache.airavata.xbaya.interpretor.StandaloneNotificationSender;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//public class CrossProductWorkflowTest {
+// final Logger logger = LoggerFactory.getLogger(CrossProductWorkflowTest.class);
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// @Test
+// public void testScheduleDynamically() throws IOException, URISyntaxException, WorkflowException {
+// logger.info("Running CrossProductWorkflowTest...");
+// URL systemResource = this.getClass().getClassLoader().getSystemResource("LevenshteinDistance.xwf");
+// Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
+// XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
+//// AiravataRegistry2 registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+//// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,true);
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,
+// UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, null,null,true);
+// workflowInterpreterConfiguration.setNotifier(new StandaloneNotificationSender(workflowInterpreterConfiguration.getTopic(),workflowInterpreterConfiguration.getWorkflow()));
+//
+// WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,new SSWorkflowInterpreterInteractorImpl());
+// interpretor.scheduleDynamically();
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/EchoService.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/EchoService.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/EchoService.java
new file mode 100644
index 0000000..0e76399
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/EchoService.java
@@ -0,0 +1,28 @@
+/*
+ *
+ * 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.interpreter;
+
+public class EchoService {
+
+ public String echo(String input) {
+ return input;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ForEachWorkflowTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ForEachWorkflowTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ForEachWorkflowTest.java
new file mode 100644
index 0000000..85fcc22
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/ForEachWorkflowTest.java
@@ -0,0 +1,73 @@
+///*
+// *
+// * 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.interpreter;
+//
+//import java.io.IOException;
+//import java.net.URISyntaxException;
+//import java.net.URL;
+//import java.util.UUID;
+//
+////import org.apache.airavata.registry.api.AiravataRegistry2;
+//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+//import org.apache.airavata.workflow.model.graph.system.InputNode;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.interpreter.utils.WorkflowTestUtils;
+//import org.apache.airavata.xbaya.interpretor.SSWorkflowInterpreterInteractorImpl;
+//import org.apache.airavata.xbaya.interpretor.StandaloneNotificationSender;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//public class ForEachWorkflowTest {
+// final Logger logger = LoggerFactory.getLogger(ForEachWorkflowTest.class);
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// @Test
+// public void testScheduleDynamically() throws IOException, URISyntaxException, WorkflowException {
+// logger.info("Running ForEachWorkflowTest...");
+// URL systemResource = this.getClass().getClassLoader().getSystemResource("SimpleEcho.xwf");
+// Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
+// ((InputNode) workflow.getGraph().getNode("input")).setDefaultValue("1");
+// XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
+//// AiravataRegistry2 registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+//// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,true);
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,
+// UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, null,null,true);
+// workflowInterpreterConfiguration.setNotifier(new StandaloneNotificationSender(workflowInterpreterConfiguration.getTopic(),workflowInterpreterConfiguration.getWorkflow()));
+// SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl();
+//
+// WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,ssWorkflowInterpreterInteractorImpl);
+// interpretor.scheduleDynamically();
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/LevenshteinDistanceService.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/LevenshteinDistanceService.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/LevenshteinDistanceService.java
new file mode 100644
index 0000000..3a65729
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/LevenshteinDistanceService.java
@@ -0,0 +1,48 @@
+/*
+ *
+ * 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.interpreter;
+
+public class LevenshteinDistanceService {
+ public int computeDistance(String sequence1, String sequence2) {
+ int[][] distance = new int[sequence1.length() + 1][sequence2.length() + 1];
+
+ for (int i = 0; i <= sequence1.length(); i++) {
+ distance[i][0] = i;
+ }
+ for (int j = 0; j <= sequence2.length(); j++) {
+ distance[0][j] = j;
+ }
+
+ for (int i = 1; i <= sequence1.length(); i++) {
+ for (int j = 1; j <= sequence2.length(); j++) {
+ distance[i][j] = min(distance[i - 1][j] + 1, distance[i][j - 1] + 1, distance[i - 1][j - 1] + ((sequence1.charAt(i - 1) == sequence2.charAt(j - 1)) ? 0 : 1));
+ }
+ }
+
+ return distance[sequence1.length()][sequence2.length()];
+ }
+
+ private int min(int a, int b, int c) {
+ return Math.min(Math.min(a, b), c);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
new file mode 100644
index 0000000..6443828
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.interpreter;
+
+import org.apache.airavata.wsmg.client.NotificationHandler;
+
+public class Listener implements NotificationHandler {
+
+ public void handleNotification(String message) {
+ System.out.println("MessageRecieved: " + message);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
new file mode 100644
index 0000000..261b07f
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
@@ -0,0 +1,204 @@
+/*
+ *
+ * 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.interpreter;
+
+
+import org.apache.airavata.workflow.tracking.NotifierFactory;
+import org.apache.airavata.workflow.tracking.WorkflowNotifier;
+import org.apache.airavata.workflow.tracking.common.InvocationContext;
+import org.apache.airavata.workflow.tracking.common.InvocationEntity;
+import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+import org.apache.axis2.addressing.EndpointReference;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.net.URI;
+import java.util.Properties;
+
+public class NotificationSender {
+
+ protected WorkflowNotifier notifier;
+
+ protected String brokerURL;
+
+ protected String topic;
+
+ protected URI workflowID;
+
+ protected InvocationEntity initiator;
+
+ protected InvocationEntity receiver;
+
+ protected InvocationContext invocationContext;
+
+ protected EndpointReference eventSink;
+
+ protected WorkflowTrackingContext context;
+
+ /**
+ * Constructs a NotificationSender.
+ *
+ * @param brokerURL
+ * @param topic
+ */
+ public NotificationSender(URI brokerURL, String topic) {
+ this(brokerURL.toString(), topic);
+ }
+
+ /**
+ * Creates a NotificationSender.
+ *
+ * @param brokerURL The location of notification brokerUrl.
+ * @param topic The notification topic.
+ */
+ public NotificationSender(String brokerURL, String topic) {
+ this.topic = topic;
+ this.brokerURL = brokerURL;
+ this.workflowID = URI.create(this.convertToJavaIdentifier(this.topic));
+ this.eventSink = new EndpointReference(this.brokerURL);
+ Properties props = new Properties();
+
+ this.notifier = NotifierFactory.createNotifier();
+ URI initiatorWorkflowID = null;
+ URI initiatorServiceID = URI.create(this.convertToJavaIdentifier(topic));
+ String initiatorWorkflowNodeID = null;
+ Integer initiatorWorkflowTimeStep = null;
+ this.context = this.notifier.createTrackingContext(props, brokerURL, initiatorWorkflowID,
+ initiatorServiceID, initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
+ this.context.setTopic(topic);
+ this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
+ initiatorWorkflowTimeStep);
+
+ URI receiverWorkflowID = this.workflowID;
+ URI receiverServiceID = this.workflowID;
+ String receiverWorkflowNodeID = null;
+ Integer receiverWorkflowTimeStep = null;
+ this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
+ receiverWorkflowTimeStep);
+ }
+
+ /**
+ * @return The event sink EPR.
+ */
+ public EndpointReference getEventSink() {
+ return this.eventSink;
+ }
+
+
+ public void workflowStarted(String message) {
+ this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator, message);
+ }
+
+
+ public void workflowFinished(String message) {
+ this.notifier.sendingResult(context, this.invocationContext, message);
+ this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
+ }
+
+ public void sendingPartialResults(Object[] args, String[] keywords) {
+ String message = "";
+ for (int i = 0; i < args.length; i++) {
+ if (i != 0) {
+ message += ", ";
+ }
+ message += keywords[i] + "=" + args[i];
+ }
+ this.notifier.sendingResult(context, this.invocationContext, message);
+ }
+
+
+ public void workflowTerminated() {
+ this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
+ }
+
+ /**
+ * Sends a START_INCOMPLETED notification message.
+ *
+ * @param message The message to send
+ */
+ public void workflowFailed(String message) {
+ workflowFailed(message, null);
+ }
+
+ /**
+ * Sends a START_INCOMPLETED notification message.
+ *
+ * @param e
+ */
+ public void workflowFailed(Throwable e) {
+ workflowFailed(null, e);
+ }
+
+ /**
+ * Sends a START_INCOMPLETED notification message.
+ *
+ * @param message The message to send
+ * @param e
+ */
+ public void workflowFailed(String message, Throwable e) {
+ this.notifier.sendingFault(context, this.invocationContext, message);
+ }
+
+ public void info(String message) {
+ this.notifier.info(context, message);
+ }
+
+ /**
+ * @param throwable
+ * @return The stackTrace in String
+ */
+ public static String getStackTraceInString(Throwable throwable) {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ PrintStream printStream = new PrintStream(byteArrayOutputStream);
+ throwable.printStackTrace(printStream);
+ printStream.flush();
+ return byteArrayOutputStream.toString();
+ }
+
+ public static String convertToJavaIdentifier(String name) {
+
+ final char REPLACE_CHAR = '_';
+
+ if (name == null || name.length() == 0) {
+ return "" + REPLACE_CHAR;
+ }
+
+ StringBuilder buf = new StringBuilder();
+
+ char c = name.charAt(0);
+ if (!Character.isJavaIdentifierStart(c)) {
+ // Add _ at the beggining instead of replacing it to _. This is
+ // more readable if the name is like 3D_Model.
+ buf.append(REPLACE_CHAR);
+ }
+
+ for (int i = 0; i < name.length(); i++) {
+ c = name.charAt(i);
+ if (Character.isJavaIdentifierPart(c)) {
+ buf.append(c);
+ } else {
+ buf.append(REPLACE_CHAR);
+ }
+ }
+
+ return buf.toString();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/RegistryServiceTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/RegistryServiceTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/RegistryServiceTest.java
new file mode 100644
index 0000000..b9b86be
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/RegistryServiceTest.java
@@ -0,0 +1,105 @@
+///*
+// *
+// * 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.interpreter;
+//
+//import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+//import org.apache.airavata.registry.api.exception.RegistryException;
+//import org.apache.airavata.commons.gfac.type.HostDescription;
+//import org.apache.airavata.commons.gfac.type.ServiceDescription;
+//import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+//import org.junit.After;
+//import org.junit.Before;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.ExpectedException;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+////FIXME: Add tests for new registry. Airavata-592
+//public class RegistryServiceTest {
+// @Rule
+// public ExpectedException exception = ExpectedException.none();
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// final Logger logger = LoggerFactory.getLogger(RegistryServiceTest.class);
+//
+// @Before
+// public void testExecute() throws RegistryException {
+//
+// }
+//
+// @After
+// public void cleanup() throws RegistryException {
+// }
+//
+// private HostDescription createHostDescription() {
+// HostDescription host = new HostDescription();
+// host.getType().setHostName("localhost");
+// host.getType().setHostAddress("localhost");
+// return host;
+// }
+//
+// private ServiceDescription createServiceDescription() {
+// ServiceDescription serv = new ServiceDescription();
+// serv.getType().setName("SimpleEcho");
+// return serv;
+// }
+//
+// private ApplicationDescription createAppDeploymentDescription() {
+// ApplicationDescription appDesc = new ApplicationDescription();
+// ApplicationDeploymentDescriptionType app = appDesc.getType();
+// ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory
+// .newInstance();
+// name.setStringValue("EchoLocal");
+// app.setApplicationName(name);
+// app.setExecutableLocation("/bin/echo");
+// app.setScratchWorkingDirectory("/tmp");
+// app.setStaticWorkingDirectory("/tmp");
+// app.setInputDataDirectory("/tmp/input");
+// app.setOutputDataDirectory("/tmp/output");
+// app.setStandardOutput("/tmp/echo.stdout");
+// app.setStandardError("/tmp/echo.stdout");
+// return appDesc;
+// }
+//
+// @Test
+// public void getFromRegistry() throws RegistryException {
+// }
+//
+// @Test
+// public void searchRegistry() throws RegistryException {
+// }
+//
+// @Test
+// public void deleteFromRegistry() throws RegistryException {
+//
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleForEachWorkflowTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleForEachWorkflowTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleForEachWorkflowTest.java
new file mode 100644
index 0000000..dbe8cae
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleForEachWorkflowTest.java
@@ -0,0 +1,72 @@
+///*
+// *
+// * 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.interpreter;
+//
+//import java.io.IOException;
+//import java.net.URISyntaxException;
+//import java.net.URL;
+//import java.util.UUID;
+//
+////import org.apache.airavata.registry.api.AiravataRegistry2;
+//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.interpreter.utils.WorkflowTestUtils;
+//import org.apache.airavata.xbaya.interpretor.SSWorkflowInterpreterInteractorImpl;
+//import org.apache.airavata.xbaya.interpretor.StandaloneNotificationSender;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//public class SimpleForEachWorkflowTest {
+// final Logger logger = LoggerFactory.getLogger(ForEachWorkflowTest.class);
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// @Test
+// public void testScheduleDynamically() throws IOException, URISyntaxException, WorkflowException {
+// logger.info("Running SimpleForEachWorkflowTest...");
+// URL systemResource = this.getClass().getClassLoader().getSystemResource("SimpleForEach.xwf");
+// Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
+// XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
+//// AiravataRegistry2 registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+//// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,true);
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,
+// UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, null,null,true);
+// workflowInterpreterConfiguration.setNotifier(new StandaloneNotificationSender(workflowInterpreterConfiguration.getTopic(),workflowInterpreterConfiguration.getWorkflow()));
+//
+// SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl();
+//
+// WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,ssWorkflowInterpreterInteractorImpl);
+// interpretor.scheduleDynamically();
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleMathWorkflowTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleMathWorkflowTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleMathWorkflowTest.java
new file mode 100644
index 0000000..fcfc44f
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleMathWorkflowTest.java
@@ -0,0 +1,73 @@
+///*
+// *
+// * 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.interpreter;
+//
+//import java.io.IOException;
+//import java.net.URISyntaxException;
+//import java.net.URL;
+//import java.util.UUID;
+//
+////import org.apache.airavata.registry.api.AiravataRegistry2;
+//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.interpreter.utils.WorkflowTestUtils;
+//import org.apache.airavata.xbaya.interpretor.SSWorkflowInterpreterInteractorImpl;
+//import org.apache.airavata.xbaya.interpretor.StandaloneNotificationSender;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//public class SimpleMathWorkflowTest {
+// final Logger logger = LoggerFactory.getLogger(SimpleMathWorkflowTest.class);
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// @Test
+// public void testScheduleDynamically() throws IOException, URISyntaxException, WorkflowException {
+// logger.info("Running SimpleMathWorkflowTest...");
+// URL systemResource = this.getClass().getClassLoader().getSystemResource("SimpleMath.xwf");
+// Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
+// XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
+//// AiravataRegistry2 registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+//// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,true);
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,
+// UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, null,null,true);
+// workflowInterpreterConfiguration.setNotifier(new StandaloneNotificationSender(workflowInterpreterConfiguration.getTopic(),workflowInterpreterConfiguration.getWorkflow()));
+// SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl();
+//
+// WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,ssWorkflowInterpreterInteractorImpl);
+// interpretor.scheduleDynamically();
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTest.java
new file mode 100644
index 0000000..7b016cd
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTest.java
@@ -0,0 +1,74 @@
+///*
+// *
+// * 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.interpreter;
+//
+//import java.io.IOException;
+//import java.net.URISyntaxException;
+//import java.net.URL;
+//import java.util.UUID;
+//
+////import org.apache.airavata.registry.api.AiravataRegistry2;
+//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+//import org.apache.airavata.workflow.model.graph.system.InputNode;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.interpreter.utils.WorkflowTestUtils;
+//import org.apache.airavata.xbaya.interpretor.SSWorkflowInterpreterInteractorImpl;
+//import org.apache.airavata.xbaya.interpretor.StandaloneNotificationSender;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//public class WorkflowTest{
+// final Logger logger = LoggerFactory.getLogger(WorkflowTest.class);
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// @Test
+// public void testScheduleDynamically() throws IOException, URISyntaxException, WorkflowException {
+// logger.info("Running WorkflowTest...");
+// URL systemResource = this.getClass().getClassLoader().getSystemResource("SimpleEcho.xwf");
+// Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
+// ((InputNode) workflow.getGraph().getNode("input")).setDefaultValue("1");
+// XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
+//// AiravataRegistry2 registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+//// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,true);
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,
+// UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, null,null,true);
+// workflowInterpreterConfiguration.setNotifier(new StandaloneNotificationSender(workflowInterpreterConfiguration.getTopic(),workflowInterpreterConfiguration.getWorkflow()));
+// SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl();
+//
+// WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration, ssWorkflowInterpreterInteractorImpl);
+// interpretor.scheduleDynamically();
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTrackingTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTrackingTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTrackingTest.java
new file mode 100644
index 0000000..723699f
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTrackingTest.java
@@ -0,0 +1,105 @@
+///*
+// *
+// * 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.interpreter;
+//
+//
+//import junit.framework.Assert;
+//import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+//import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+//import org.apache.airavata.xbaya.interpreter.utils.ConfigKeys;
+//import org.apache.airavata.xbaya.interpreter.utils.TestUtilServer;
+//import org.apache.axiom.soap.SOAPEnvelope;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//import java.util.Properties;
+//
+//public class WorkflowTrackingTest implements ConsumerNotificationHandler{
+// final static Logger logger = LoggerFactory.getLogger(ConsumerNotificationHandler.class);
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// public void handleNotification(SOAPEnvelope msgEnvelope) {
+// logger.info("Received " + msgEnvelope);
+// String message = "<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header><wsa:Action xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">http://org.apache.airavata/WseNotification</wsa:Action><wsa:MessageID xmlns:wsa=\"http://www.w3.org/2005/08/addressing\" /><wsa:To xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">http://140.182.151.20:61436/axis2/services/ConsumerService/</wsa:To><wsnt:Topic xmlns:wsnt=\"http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification\" xmlns:ns2=\"http://tutorial.globus.org/auction\" Dialect=\"http://www.ibm.com/xmlns/stdwip/web-services/WS-Topics/TopicExpression/simple\">ns2:abc</wsnt:Topic></soapenv:Header><soapenv:Body><wor:workflowInvoked xmlns:wor=\"http://airavata.apache.org/schemas/wft/2011/08\" infoModelVersion=\"2.6\"><wor:notificationSource wor:serviceID=\"abc\" /><wor:timestamp>2011-12-20T14:47:33.736-05:00</wor:timestamp><wor:description>Workflow S
tarted</wor:description><wor:annotation /><wor:initiator wor:serviceID=\"abc\" /></wor:workflowInvoked></soapenv:Body></soapenv:Envelope>";
+// Assert.assertEquals(message,msgEnvelope);
+// }
+//
+// private static Properties getDefaults() {
+// Properties defaults = new Properties();
+// defaults.setProperty(ConfigKeys.MSGBOX_SERVICE_URL,
+// "http://localhost:8080/axis2/services/MsgBoxService");
+// defaults.setProperty(ConfigKeys.MSGBROKER_SERVICE_URL,
+// "http://localhost:8080/axis2/services/EventingService");
+// defaults.setProperty(ConfigKeys.TOPIC, "abc");
+// return defaults;
+// }
+//
+// protected void setUp() throws Exception {
+// TestUtilServer.start(null, null);
+// }
+//
+// protected void tearDown() throws Exception {
+// TestUtilServer.stop();
+// }
+//
+// @Test
+// public void WorkflowTrackingtest() throws Exception{
+// logger.info("Running WorkflowTrackingTest...");
+// setUp();
+// Properties configurations = new Properties(getDefaults());
+// WseMsgBrokerClient brokerClient = new WseMsgBrokerClient();
+// String brokerLocation = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
+// brokerClient.init(brokerLocation);
+// String topic = configurations.getProperty(ConfigKeys.TOPIC);
+// NotificationSender sender = null;
+// sender = new NotificationSender(brokerLocation, topic);
+//
+// int consumerPort = TestUtilServer.getAvailablePort();
+//
+// String[] consumerEPRs = brokerClient.startConsumerService(consumerPort, this);
+// // subscribing to the above created messsage box with configured topic
+// String subscriptionID = brokerClient.subscribe(consumerEPRs[0], topic, null);
+//
+// sender.workflowStarted("Workflow Started");
+//
+// //Here we simply assume the workflow invocation is the invoke of the subscribe operation of EventingService and result
+// // Is considered as the subscriptionID got from subscribe operation
+// try {
+// Thread.sleep(10000L);
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
+// brokerClient.unSubscribe(subscriptionID);
+// Assert.assertEquals(brokerLocation,"http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService");
+// tearDown();
+// }
+//}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaClientTest.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaClientTest.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaClientTest.java
new file mode 100644
index 0000000..f6a7f85
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaClientTest.java
@@ -0,0 +1,80 @@
+/*
+ *
+ * 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.interpreter;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.ListenerManager;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.MethodRule;
+import org.junit.rules.TestWatchman;
+import org.junit.runners.model.FrameworkMethod;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class XBayaClientTest {
+ final static Logger logger = LoggerFactory.getLogger(XBayaClientTest.class);
+
+ @Rule
+ public MethodRule watchman = new TestWatchman() {
+ public void starting(FrameworkMethod method) {
+ logger.info("{} being run...", method.getName());
+ }
+ };
+
+ @Test
+ public void testInvokeWorkflowString() {
+// try {
+// ListenerManager manager = axis2ServiceStarter();
+// XBayaClient xBayaClient = new XBayaClient("xbaya1.properties");
+// xBayaClient.loadWorkflowFromaFile("/Users/lahirugunathilake/localsimplemath.xwf");
+// NameValue[] nameValues = xBayaClient.setInputs("xbaya1.properties");
+// String s = xBayaClient.runWorkflow("test",nameValues,"admin");
+// org.junit.Assert.assertEquals("test",s);
+
+// manager.stop();*/
+// } catch (URISyntaxException e) {
+// TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (IOException e) {
+// TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+ }
+
+ private ListenerManager axis2ServiceStarter() throws AxisFault {
+ try {
+ ConfigurationContext configContext = ConfigurationContextFactory.createBasicConfigurationContext
+ ("axis2_default.xml");
+ AxisService service = AxisService.createService(EchoService.class.getName(), configContext.getAxisConfiguration());
+ configContext.deployService(service);
+ ListenerManager manager = new ListenerManager();
+ manager.init(configContext);
+ manager.start();
+ return manager;
+ } catch (Exception e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaConsolidatedTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaConsolidatedTestSuite.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaConsolidatedTestSuite.java
new file mode 100644
index 0000000..cab7f51
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/XBayaConsolidatedTestSuite.java
@@ -0,0 +1,67 @@
+///*
+// *
+// * 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.interpreter;
+//
+//import org.apache.airavata.xbaya.interpreter.utils.WorkflowTestUtils;
+//import org.apache.axis2.AxisFault;
+//import org.apache.axis2.engine.ListenerManager;
+//import org.junit.AfterClass;
+//import org.junit.BeforeClass;
+//import org.junit.Rule;
+//import org.junit.rules.MethodRule;
+//import org.junit.rules.TestWatchman;
+//import org.junit.runner.RunWith;
+//import org.junit.runners.Suite;
+//import org.junit.runners.model.FrameworkMethod;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//
+//@RunWith(Suite.class)
+//@Suite.SuiteClasses({XBayaClientTest.class, SimpleMathWorkflowTest.class, WorkflowTest.class,
+// ComplexMathWorkflowTest.class, CrossProductWorkflowTest.class, ForEachWorkflowTest.class,
+// SimpleForEachWorkflowTest.class, ComplexForEachWorkflowTest.class,
+// WorkflowTrackingTest.class, RegistryServiceTest.class})
+//public class XBayaConsolidatedTestSuite {
+// private static ListenerManager manager = null;
+//
+// final static Logger logger = LoggerFactory.getLogger(XBayaConsolidatedTestSuite.class);
+//
+// @Rule
+// public MethodRule watchman = new TestWatchman() {
+// public void starting(FrameworkMethod method) {
+// logger.info("{} being run...", method.getName());
+// }
+// };
+//
+// @BeforeClass
+// public static void startServer() throws AxisFault {
+// logger.info("Starting simple Axis2 Server...");
+// manager = WorkflowTestUtils.axis2ServiceStarter();
+// }
+//
+// @AfterClass
+// public static void stopServer() throws AxisFault {
+// logger.info("Stopping simple Axis2 Server...");
+// manager.stop();
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/ConfigKeys.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/ConfigKeys.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/ConfigKeys.java
new file mode 100644
index 0000000..77a2722
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/utils/ConfigKeys.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.interpreter.utils;
+
+
+public class ConfigKeys {
+
+ public static final String AXIS2_REPO = "axis2.repository";
+ public static final String CONFIG_FILE_NAME = "configuration.properties";
+ public static final String MSGBOX_SERVICE_URL = "msgbox.service.url";
+ public static final String MSGBROKER_SERVICE_URL = "msgbroker.service.url";
+ public static final String MSGBOX_ID = "msgbox.id";
+ public static final String TOPIC = "abc";
+
+
+}
\ No newline at end of file
[7/9] introducing workflow support in airavata api + other related
modules
Posted by sa...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/a8974b7c/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/workflow/ParameterListModel.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/workflow/ParameterListModel.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/workflow/ParameterListModel.java
new file mode 100644
index 0000000..b9ae5b6
--- /dev/null
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/core/workflow/ParameterListModel.java
@@ -0,0 +1,88 @@
+/*
+ *
+ * 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.core.workflow;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.workflow.model.graph.system.ParameterNode;
+
+public class ParameterListModel extends AbstractListModel {
+
+ private List<? extends ParameterNode> parameterNodes;
+
+ /**
+ * Constructs a ParameterListModel.
+ *
+ * @param parameterNodes
+ * @param nodes
+ */
+ public ParameterListModel(List<? extends ParameterNode> parameterNodes) {
+ this.parameterNodes = parameterNodes;
+ }
+
+ /**
+ * @see javax.swing.ListModel#getElementAt(int)
+ */
+ public Object getElementAt(int index) {
+ return this.parameterNodes.get(index).getName();
+ }
+
+ /**
+ * @see javax.swing.ListModel#getSize()
+ */
+ public int getSize() {
+ return this.parameterNodes.size();
+ }
+
+ /**
+ * Moves the node at the index up.
+ *
+ * @param index
+ */
+ public void up(int index) {
+ if (index < 1 || index >= this.parameterNodes.size()) {
+ throw new WorkflowRuntimeException("Illegal index: " + index);
+ }
+ swap(index - 1, index);
+ }
+
+ /**
+ * Moves the node at the index down.
+ *
+ * @param index
+ */
+ public void down(int index) {
+ if (index < 0 || index >= this.parameterNodes.size() - 1) {
+ throw new WorkflowRuntimeException("Illegal index: " + index);
+ }
+ swap(index, index + 1);
+ }
+
+ private void swap(int index0, int index1) {
+ Collections.swap(this.parameterNodes, index0, index1);
+ fireContentsChanged(this, index0, index1);
+ }
+}
\ 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/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;
+ }
+}