airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramin...@apache.org
Subject svn commit: r1355239 - in /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: interpretor/DoWhileHandler.java invoker/SimpleInvoker.java
Date Fri, 29 Jun 2012 05:14:33 GMT
Author: raminder
Date: Fri Jun 29 05:14:32 2012
New Revision: 1355239

URL: http://svn.apache.org/viewvc?rev=1355239&view=rev
Log:
handled parsing of output XML to get output value. AIRAVATA-499

Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java?rev=1355239&r1=1355238&r2=1355239&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/DoWhileHandler.java
Fri Jun 29 05:14:32 2012
@@ -47,6 +47,7 @@ import org.apache.airavata.xbaya.ui.moni
 import org.apache.airavata.xbaya.util.InterpreterUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.xmlpull.infoset.XmlElement;
 
 public class DoWhileHandler implements Callable<Boolean> {
 	private static Logger log = LoggerFactory.getLogger(DoWhileHandler.class);
@@ -98,10 +99,17 @@ public class DoWhileHandler implements C
 		int i = 0;
 		for (DataPort port : inputPorts) {
 			Object inputVal1 = InterpreterUtil.findInputFromPort(port, invokerMap);
+			String outputVal = "";
 			if (null == inputVal1) {
 				throw new WorkFlowInterpreterException("Unable to find inputs for the node:" + doWhileNode.getID());
 			}
-			booleanExpression = booleanExpression.replaceAll("\\$" + i, "'" + inputVal1 + "'");
+			if (inputVal1 instanceof XmlElement) {
+
+				if (((XmlElement) inputVal1).children().iterator().hasNext()) {
+					outputVal = ((XmlElement) inputVal1).children().iterator().next().toString();
+				}
+			}
+			booleanExpression = booleanExpression.replaceAll("\\$" + i, "'" + outputVal + "'");
 			i++;
 		}
 		Boolean result = new Boolean(false);

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java?rev=1355239&r1=1355238&r2=1355239&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java
Fri Jun 29 05:14:32 2012
@@ -26,6 +26,8 @@ import java.util.Iterator;
 import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.workflow.model.exceptions.WorkflowException;
 import org.apache.jackrabbit.core.cache.ConcurrentCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.xmlpull.v1.builder.XmlElement;
 
 import xsul.wsdl.WsdlDefinitions;
@@ -40,6 +42,8 @@ import xsul.xwsif_runtime.WSIFRuntime;
 
 public class SimpleInvoker implements Invoker {
 
+    private static final Logger log = LoggerFactory.getLogger(GenericInvoker.class);
+
     protected WSIFClient client;
 
     private WsdlDefinitions definitions;
@@ -60,7 +64,7 @@ public class SimpleInvoker implements In
 
     /**
      * Constructs a SimpleInvoker.
-     * 
+     *
      * @param definitions
      */
     public SimpleInvoker(WsdlDefinitions definitions) {
@@ -196,6 +200,15 @@ public class SimpleInvoker implements In
                     String value = (String) child;
                     return value;
                 }
+                if (child instanceof XmlElement) {
+                	log.info("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.



Mime
View raw message