airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1347774 - in /incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: interpretor/WorkflowInterpreter.java invoker/GenericInvoker.java provenance/ProvenanceReader.java
Date Thu, 07 Jun 2012 20:29:26 GMT
Author: lahiru
Date: Thu Jun  7 20:29:25 2012
New Revision: 1347774

URL: http://svn.apache.org/viewvc?rev=1347774&view=rev
Log:
fixing https://issues.apache.org/jira/browse/AIRAVATA-461.

Modified:
    incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceReader.java

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1347774&r1=1347773&r2=1347774&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
(original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
Thu Jun  7 20:29:25 2012
@@ -40,6 +40,7 @@ import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 
+import com.sun.tools.internal.ws.util.xml.XmlUtil;
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 import org.apache.airavata.common.utils.Pair;
 import org.apache.airavata.common.utils.WSDLUtil;
@@ -345,16 +346,15 @@ public class WorkflowInterpreter {
 						// recalculate the execution stack
 					}
 
-					// boolean nodeOutputLoadedFromProvenance = false;
+					boolean nodeOutputLoadedFromProvenance = false;
 					if (this.actOnProvenance) {
-						// nodeOutputLoadedFromProvenance =
-						// readProvenance(node);
-						// } else {
+						nodeOutputLoadedFromProvenance = readProvenance(node);
+						} else {
 						writeProvenanceLater(node);
 					}
-					// if (!nodeOutputLoadedFromProvenance) {
-					executeDynamically(node);
-					// }
+					if (!nodeOutputLoadedFromProvenance) {
+					    executeDynamically(node);
+					}
 					if (this.getWorkflow().getExecutionState() == XBayaExecutionState.STEP) {
 						this.getWorkflow().setExecutionState(
 								XBayaExecutionState.PAUSED);
@@ -474,12 +474,14 @@ public class WorkflowInterpreter {
 						+ inputTagname + ">");
 			}
 
-			XmlElement result = (XmlElement) new ProvenanceReader().read(
-					node.getID(), inputs);
-			if (null == result) {
-				writeProvenanceLater(node);
+            String output = ((String)new ProvenanceReader(node,this.topic,this.configuration
+								.getJcrComponentRegistry()
+								.getRegistry()).read());
+            if(output == null){
+                writeProvenanceLater(node);
 			} else {
-				SystemComponentInvoker invoker = new SystemComponentInvoker();
+            XmlElement result = XMLUtil.stringToXmlElement(output);
+            SystemComponentInvoker invoker = new SystemComponentInvoker();
 				List<DataPort> outPorts = node.getOutputPorts();
 				for (DataPort dataPort : outPorts) {
 

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java?rev=1347774&r1=1347773&r2=1347774&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java
(original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java
Thu Jun  7 20:29:25 2012
@@ -240,7 +240,7 @@ public class GenericInvoker implements I
         }
         if(builder.getWorkflowMonitoringContext() == null){
             builder.addWorkflowMonitoringContext(this.notifier.getEventSink().getAddress(),
-                    this.notifier.getWorkflowID().toASCIIString(),this.nodeID,this.messageBoxURL);
+                    this.topic,this.nodeID,this.messageBoxURL);
         } else {
             builder.getWorkflowMonitoringContext().setWorkflowInstanceId(this.notifier.getWorkflowID().toASCIIString());
         }

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceReader.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceReader.java?rev=1347774&r1=1347773&r2=1347774&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceReader.java
(original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/provenance/ProvenanceReader.java
Thu Jun  7 20:29:25 2012
@@ -20,78 +20,63 @@
 */
 package org.apache.airavata.xbaya.provenance;
 
+import org.apache.airavata.common.registry.api.exception.RegistryException;
 import org.apache.airavata.common.utils.Pair;
 import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.registry.api.AiravataRegistry;
+import org.apache.airavata.registry.api.WorkflowExecution;
+import org.apache.airavata.registry.api.workflow.WorkflowIOData;
+import org.apache.airavata.registry.api.workflow.WorkflowServiceIOData;
+import org.apache.airavata.xbaya.XBayaException;
+import org.apache.airavata.xbaya.graph.DataPort;
+import org.apache.airavata.xbaya.graph.ForEachExecutableNode;
+import org.apache.airavata.xbaya.graph.Node;
+import org.apache.airavata.xbaya.graph.system.EndForEachNode;
+import org.apache.airavata.xbaya.graph.system.ForEachNode;
+import org.apache.airavata.xbaya.graph.system.InputNode;
+import org.apache.airavata.xbaya.graph.ws.WSNode;
+import org.apache.airavata.xbaya.invoker.Invoker;
+import org.apache.airavata.xbaya.util.XBayaUtil;
 import org.xmlpull.infoset.XmlElement;
+import xsul5.XmlConstants;
 
 import java.io.File;
 import java.io.FileFilter;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
 
 public class ProvenanceReader {
 
     public String DEFAULT_LIBRARY_FOLDER_NAME = "provenance";
 
-	public ProvenanceReader() {
+    private String experimentId;
 
-	}
-
-	public Object read(final String nodeName, Pair<String, String>[] inputs)
-			throws Exception {
-
-		File directory = new File(DEFAULT_LIBRARY_FOLDER_NAME);
-		if (!directory.isDirectory()) {
-			return null;
-		}
-		File[] componentMatchFiles = directory.listFiles(new FileFilter() {
-
-			@Override
-			public boolean accept(File pathname) {
-				if (pathname.isDirectory()) {
-					return false;
-				} else {
-					String fileName = pathname.getName();
-					return -1 != fileName.indexOf(nodeName);
-				}
-			}
-		});
-
-		for (File file : componentMatchFiles) {
-			if (!file.isDirectory()) {
-				XmlElement xml = XMLUtil.loadXML(file);
-				XmlElement root = xml;
-				XmlElement wsnode;
-
-				XmlElement foreach;
-				if (null != (wsnode = root.element("wsnode"))) {
-					XmlElement inputElems = root.element("inputs");
-					Iterable inputValElems = inputElems.children();
-					for (Object object : inputValElems) {
-						if (object instanceof XmlElement) {
-							XmlElement inputElem = (XmlElement)object;
-							for (Pair<String, String> pair : inputs) {
-								String inputName = pair.getLeft();
-								//issue "x".equals("CreateCoordinatePortType_createCoordinate_in_0")
-								if(inputName.equals(inputElem.getName())){
-									//found the input now check whether values are the same
-									if(XMLUtil.isEqual(inputElem, XMLUtil.stringToXmlElement(pair.getRight()))){
-										//match found return output
-										XmlElement output = root.element("output");
-										return output.children().iterator().next();
-
-									}
-								}
-
-							}
-						}
-					}
+    private AiravataRegistry registry;
 
-				} else if (null != (foreach = root.element("foreach"))) {
+    private Node node;
 
-				}
-
-			}
-		}
-
-		return null;
+    public ProvenanceReader(Node node,String experimentId,AiravataRegistry registry) {
+       this.experimentId = experimentId;
+        this.registry = registry;
+        this.node = node;
 	}
+
+    public Object read() throws Exception {
+        try {
+            WorkflowExecution workflowExecution = registry.getWorkflowExecution(experimentId);
+            List<WorkflowServiceIOData> serviceOutput = workflowExecution.getServiceOutput();
+            if (serviceOutput.size() == 0) {
+                return null;
+            }
+            for (WorkflowServiceIOData data : serviceOutput) {
+                if (this.node.getID().equals(data.getNodeId())) {
+                    return data.getValue();
+                }
+            }
+            return null;
+        } catch (Exception e) {
+            return null;
+        }
+    }
 }



Mime
View raw message