airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1515683 - in /airavata/trunk/modules: commons/gfac-schema/ commons/gfac-schema/src/main/java/org/apache/airavata/commons/gfac/type/ commons/utils/src/main/java/org/apache/airavata/common/utils/ gfac-core/src/main/java/org/apache/airavata/g...
Date Tue, 20 Aug 2013 01:26:49 GMT
Author: samindaw
Date: Tue Aug 20 01:26:48 2013
New Revision: 1515683

URL: http://svn.apache.org/r1515683
Log:
updating delimiter use & data array creation using manual parsing

Modified:
    airavata/trunk/modules/commons/gfac-schema/pom.xml
    airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/commons/gfac/type/MappingFactory.java
    airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/OutputUtils.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java

Modified: airavata/trunk/modules/commons/gfac-schema/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/gfac-schema/pom.xml?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/commons/gfac-schema/pom.xml (original)
+++ airavata/trunk/modules/commons/gfac-schema/pom.xml Tue Aug 20 01:26:48 2013
@@ -26,6 +26,11 @@
 
     <dependencies>
         <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-common-utils</artifactId>
+       		<version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.xmlbeans</groupId>
             <artifactId>xmlbeans</artifactId>
             <version>${xmlbeans.version}</version>

Modified: airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/commons/gfac/type/MappingFactory.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/commons/gfac/type/MappingFactory.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/commons/gfac/type/MappingFactory.java
(original)
+++ airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/commons/gfac/type/MappingFactory.java
Tue Aug 20 01:26:48 2013
@@ -21,12 +21,30 @@
 
 package org.apache.airavata.commons.gfac.type;
 
-import org.apache.airavata.schemas.gfac.*;
-
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.schemas.gfac.BooleanArrayType;
+import org.apache.airavata.schemas.gfac.BooleanParameterType;
+import org.apache.airavata.schemas.gfac.DataType;
+import org.apache.airavata.schemas.gfac.DoubleArrayType;
+import org.apache.airavata.schemas.gfac.DoubleParameterType;
+import org.apache.airavata.schemas.gfac.FileArrayType;
+import org.apache.airavata.schemas.gfac.FileParameterType;
+import org.apache.airavata.schemas.gfac.FloatArrayType;
+import org.apache.airavata.schemas.gfac.FloatParameterType;
+import org.apache.airavata.schemas.gfac.IntegerArrayType;
+import org.apache.airavata.schemas.gfac.IntegerParameterType;
+import org.apache.airavata.schemas.gfac.StdErrParameterType;
+import org.apache.airavata.schemas.gfac.StdOutParameterType;
+import org.apache.airavata.schemas.gfac.StringArrayType;
+import org.apache.airavata.schemas.gfac.StringParameterType;
+import org.apache.airavata.schemas.gfac.URIArrayType;
+import org.apache.airavata.schemas.gfac.URIParameterType;
+
+import com.sun.org.apache.xpath.internal.operations.Quo;
+
 /*
  * TODO use XML meta data instead of static coding
  * 
@@ -101,7 +119,7 @@ public class MappingFactory {
         } else if (param.hasType(DataType.URI)) {
             return String.valueOf(((URIParameterType) param.getType()).getValue());
         } else if (param.hasType(DataType.STRING_ARRAY)) {
-            return join(Arrays.asList(((StringArrayType) param.getType()).getValueArray()),
",");
+            return join(Arrays.asList(((StringArrayType) param.getType()).getValueArray()),
StringUtil.DELIMETER);
         } else if (param.hasType(DataType.STD_OUT)) {
             return String.valueOf(((StdOutParameterType) param.getType()).getValue());
         } else if (param.hasType(DataType.STD_ERR)) {
@@ -114,11 +132,11 @@ public class MappingFactory {
         } else if (param.hasType(DataType.BOOLEAN_ARRAY)) {
             return String.valueOf(((BooleanArrayType) param.getType()).getValueArray());
         } else if (param.hasType(DataType.FILE_ARRAY)) {
-            return join(Arrays.asList(((FileArrayType) param.getType()).getValueArray()),
",");
+            return join(Arrays.asList(((FileArrayType) param.getType()).getValueArray()),
StringUtil.DELIMETER );
         } else if (param.hasType(DataType.FLOAT_ARRAY)) {
             return String.valueOf(((FloatArrayType) param.getType()).getValueArray());
         } else if (param.hasType(DataType.URI_ARRAY)) {
-            return join(Arrays.asList(((URIArrayType) param.getType()).getValueArray()),
",");
+            return join(Arrays.asList(((URIArrayType) param.getType()).getValueArray()),
StringUtil.DELIMETER );
         }
         return null;
     }
@@ -156,7 +174,7 @@ public class MappingFactory {
         for (String s : list) {
 
             sb.append(loopDelim);
-            sb.append(s);
+            sb.append(StringUtil.quoteString(s));
 
             loopDelim = delim;
         }

Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java
(original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java
Tue Aug 20 01:26:48 2013
@@ -27,33 +27,43 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class StringUtil {
-	private static final String DELIMETER=",";
-	private static final String QUOTE="\"";
+	public static final String DELIMETER=",";
+	public static final String QUOTE="\"";
 	
 	private static boolean isQuoted(String s){
-		//chk if we need quotes
+		//Check if we need quotes
 		if (s.contains(DELIMETER)){
-			//chk if its already quoted
+			//Check if its already quoted
 			s=s.replaceAll("\"\"", "");
 			return (s.substring(0,1).equals(QUOTE) && s.subSequence(s.length()-1, s.length()).equals(QUOTE));
 		}
-		//no delimeters present, so already in proper form
+		//no delimiters present, so already in proper form
 		return true;
 	}
 	
-	public static String createDelimeteredString(String[] list){
+	/**
+	 * Create a delimiter separated string out of a list
+	 * @param list
+	 * @return
+	 */
+	public static String createDelimiteredString(String[] list){
 		String s=null;
 		for (String ss : list) {
 			ss=quoteString(ss);
 			if (s==null){
 				s=ss;
 			}else{
-				s+=","+ss;
+				s+=DELIMETER +ss;
 			}
 		}
 		return s;
 	}
 	
+	/**
+	 * Return a proper quoted string if the string contains the delimiter character
+	 * @param s
+	 * @return
+	 */
 	public static String quoteString(String s){
 		if (isQuoted(s)){
 			return s;
@@ -62,6 +72,11 @@ public class StringUtil {
 		}
 	}
 	
+	/**
+	 * Parse the delimitered string and return elements as a string array 
+	 * @param s
+	 * @return
+	 */
 	public static String[] getElementsFromString(String s) {
 		List<String> list=new ArrayList<String>();
 		String currentItem="";
@@ -70,24 +85,30 @@ public class StringUtil {
 		for(int i=0;i<s.length();i++){
 			String c=s.substring(i,i+1);
 			if (c.equals(DELIMETER)){
-				if (!insideQuote) {
+				//if not inside a quoted string ignore the delimiter character
+				if (insideQuote) {
+					currentItem+=c;
+				}else{
 					list.add(currentItem);
 					currentItem = "";
-				}else{
-					currentItem+=c;
 				}
 			}else if (c.equals(QUOTE)){
 				if (QUOTE.equals(previousChar)){
+					//which means previousChar was an escape character, not a quote for the string
+					currentItem+=QUOTE+QUOTE;
 					if (insideQuote){
+						//mistakenly thought previous char was opening quote char, thus need to make this false
 						insideQuote=false;
 					}else{
-						currentItem+=QUOTE+QUOTE;
+						//mistakenly thought previous char was closing quote char, thus need to make this true
 						insideQuote=true;
 					}
 				} else{
 					if (insideQuote){
+						//quote ended
 						insideQuote=false;
 					}else{
+						//quote beginning
 						insideQuote=true;
 					}
 				}

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
Tue Aug 20 01:26:48 2013
@@ -28,6 +28,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.*;
 
+import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.commons.gfac.type.MappingFactory;
 import org.apache.airavata.gfac.GFacException;
@@ -65,7 +66,7 @@ public class GridFTPInputHandler impleme
                 if ("URI".equals(actualParameter.getType().getType().toString())) {
                     ((URIParameterType) actualParameter.getType()).setValue(stageInputFiles(jobExecutionContext,
paramValue));
                 } else if ("URIArray".equals(actualParameter.getType().getType().toString()))
{
-                    List<String> split = Arrays.asList(paramValue.split(","));
+                    List<String> split = Arrays.asList(StringUtil.getElementsFromString(paramValue));
                     List<String> newFiles = new ArrayList<String>();
                     for (String paramValueEach : split) {
                         newFiles.add(stageInputFiles(jobExecutionContext, paramValueEach));

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
Tue Aug 20 01:26:48 2013
@@ -35,6 +35,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.commons.gfac.type.ApplicationDescription;
 import org.apache.airavata.commons.gfac.type.MappingFactory;
@@ -281,7 +282,7 @@ public class GridFTPOutputHandler implem
                                 MappingFactory.toString(actualParameter), ftp, gssCred, endpoint));
                     }
                 } else if ("URIArray".equals(actualParameter.getType().getType().toString()))
{
-                    List<String> split = Arrays.asList(MappingFactory.toString(actualParameter).split(","));
+                    List<String> split = Arrays.asList(StringUtil.getElementsFromString(MappingFactory.toString(actualParameter)));
                     List<String> newFiles = new ArrayList<String>();
                     for (String endpoint : gridFTPEndpointArray) {
                         for (String paramValueEach : split) {

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
Tue Aug 20 01:26:48 2013
@@ -26,6 +26,7 @@ import java.util.*;
 
 import net.schmizz.sshj.xfer.scp.SCPFileTransfer;
 
+import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.commons.gfac.type.MappingFactory;
 import org.apache.airavata.gfac.GFacException;
@@ -59,7 +60,7 @@ public class SCPInputHandler implements 
 	                if ("URI".equals(actualParameter.getType().getType().toString())) {
 	                    ((URIParameterType) actualParameter.getType()).setValue(stageInputFiles(jobExecutionContext,
paramValue));
 	                } else if ("URIArray".equals(actualParameter.getType().getType().toString()))
{
-	                    List<String> split = Arrays.asList(paramValue.split(","));
+	                    List<String> split = Arrays.asList(StringUtil.getElementsFromString(paramValue));
 	                    List<String> newFiles = new ArrayList<String>();
 	                    for (String paramValueEach : split) {
 	                        newFiles.add(stageInputFiles(jobExecutionContext, paramValueEach));

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
Tue Aug 20 01:26:48 2013
@@ -23,6 +23,7 @@ package org.apache.airavata.gfac.utils;
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.credential.store.store.CredentialReader;
 import org.apache.airavata.gfac.Constants;
@@ -217,7 +218,7 @@ public class GFacUtils {
             Iterator value = element.getChildrenWithLocalName("value");
             int i = 0;
             if (!"".equals(element.getText())) {
-                String[] list = element.getText().split(",");
+                String[] list = StringUtil.getElementsFromString(element.getText());
                 for (String arrayValue : list) {
                     ((StringArrayType) actualParameter.getType()).insertValue(i++, arrayValue);
                 }
@@ -232,7 +233,7 @@ public class GFacUtils {
             Iterator value = element.getChildrenWithLocalName("value");
             int i = 0;
             if (!"".equals(element.getText())) {
-                String[] list = element.getText().split(",");
+                String[] list = StringUtil.getElementsFromString(element.getText());
                 for (String arrayValue : list) {
                     ((DoubleArrayType) actualParameter.getType()).insertValue(i++, new Double(arrayValue));
                 }
@@ -248,7 +249,7 @@ public class GFacUtils {
             Iterator value = element.getChildrenWithLocalName("value");
             int i = 0;
             if (!"".equals(element.getText())) {
-                String[] list = element.getText().split(",");
+                String[] list = StringUtil.getElementsFromString(element.getText());
                 for (String arrayValue : list) {
                     ((IntegerArrayType) actualParameter.getType()).insertValue(i++, new Integer(arrayValue));
                 }
@@ -263,7 +264,7 @@ public class GFacUtils {
             Iterator value = element.getChildrenWithLocalName("value");
             int i = 0;
             if (!"".equals(element.getText())) {
-                String[] list = element.getText().split(",");
+                String[] list = StringUtil.getElementsFromString(element.getText());
                 for (String arrayValue : list) {
                     ((FloatArrayType) actualParameter.getType()).insertValue(i++, new Float(arrayValue));
                 }
@@ -279,7 +280,7 @@ public class GFacUtils {
             Iterator value = element.getChildrenWithLocalName("value");
             int i = 0;
             if (!"".equals(element.getText())) {
-                String[] list = element.getText().split(",");
+                String[] list = StringUtil.getElementsFromString(element.getText());
                 for (String arrayValue : list) {
                     ((BooleanArrayType) actualParameter.getType()).insertValue(i++, new Boolean(arrayValue));
                 }
@@ -295,7 +296,7 @@ public class GFacUtils {
             Iterator value = element.getChildrenWithLocalName("value");
             int i = 0;
             if (!"".equals(element.getText())) {
-                String[] list = element.getText().split(",");
+                String[] list = StringUtil.getElementsFromString(element.getText());
                 for (String arrayValue : list) {
                     ((FileArrayType) actualParameter.getType()).insertValue(i++, arrayValue);
                 }
@@ -311,7 +312,7 @@ public class GFacUtils {
             Iterator value = element.getChildrenWithLocalName("value");
             int i = 0;
             if (!"".equals(element.getText())) {
-                String[] list = element.getText().split(",");
+                String[] list = StringUtil.getElementsFromString(element.getText());
                 for (String arrayValue : list) {
                     ((URIArrayType) actualParameter.getType()).insertValue(i++, arrayValue);
                 }
@@ -352,7 +353,7 @@ public class GFacUtils {
             ((URIParameterType) actualParameter.getType()).setValue(inputVal);
         } else if ("StringArray".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(StringArrayType.type);
-            Iterator iterator = Arrays.asList(inputVal.split(",")).iterator();
+            Iterator iterator = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
             int i = 0;
             while (iterator.hasNext()) {
                 innerelement = (OMElement) iterator.next();
@@ -360,7 +361,7 @@ public class GFacUtils {
             }
         } else if ("DoubleArray".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(DoubleArrayType.type);
-            Iterator value = Arrays.asList(inputVal.split(",")).iterator();
+            Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
             int i = 0;
             while (value.hasNext()) {
                 innerelement = (OMElement) value.next();
@@ -368,7 +369,7 @@ public class GFacUtils {
             }
         } else if ("IntegerArray".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(IntegerArrayType.type);
-            Iterator value = Arrays.asList(inputVal.split(",")).iterator();
+            Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
             int i = 0;
             while (value.hasNext()) {
                 innerelement = (OMElement) value.next();
@@ -376,7 +377,7 @@ public class GFacUtils {
             }
         } else if ("FloatArray".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(FloatArrayType.type);
-            Iterator value = Arrays.asList(inputVal.split(",")).iterator();
+            Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
             int i = 0;
             while (value.hasNext()) {
                 innerelement = (OMElement) value.next();
@@ -384,7 +385,7 @@ public class GFacUtils {
             }
         } else if ("BooleanArray".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(BooleanArrayType.type);
-            Iterator value = Arrays.asList(inputVal.split(",")).iterator();
+            Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
             int i = 0;
             while (value.hasNext()) {
                 innerelement = (OMElement) value.next();
@@ -392,7 +393,7 @@ public class GFacUtils {
             }
         } else if ("FileArray".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(FileArrayType.type);
-            Iterator value = Arrays.asList(inputVal.split(",")).iterator();
+            Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
             int i = 0;
             while (value.hasNext()) {
                 innerelement = (OMElement) value.next();
@@ -400,7 +401,7 @@ public class GFacUtils {
             }
         } else if ("URIArray".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(URIArrayType.type);
-            Iterator value = Arrays.asList(inputVal.split(",")).iterator();
+            Iterator value = Arrays.asList(StringUtil.getElementsFromString(inputVal)).iterator();
             int i = 0;
             while (value.hasNext()) {
                 innerelement = (OMElement) value.next();

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/OutputUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/OutputUtils.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/OutputUtils.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/OutputUtils.java
Tue Aug 20 01:26:48 2013
@@ -26,6 +26,7 @@ import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.commons.gfac.type.MappingFactory;
 import org.apache.airavata.gfac.handler.GFacHandlerException;
@@ -94,10 +95,10 @@ public class OutputUtils {
         Pattern pattern = Pattern.compile(regex);
         Matcher matcher = pattern.matcher(stdout);
         while (matcher.find()) {
-            match.append(matcher.group(1) + ",");
+            match.append(matcher.group(1) + StringUtil.DELIMETER);
         }
         if (match != null) {
-            return match.toString().split(",");
+            return StringUtil.getElementsFromString(match.toString());
         } else {
             throw new Exception("Data for the output parameter '" + outParam + "' was not
found");
         }

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java
(original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java
Tue Aug 20 01:26:48 2013
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus.State;
 
 import java.util.ArrayList;
@@ -213,7 +214,7 @@ public class NodeExecutionData {
 	private static List<NameValue> getIOParameterData(String data){
 		List<NameValue> parameters=new ArrayList<NameValue>();
 		if (data!=null) {
-			String[] pairs = data.split(",");
+			String[] pairs = StringUtil.getElementsFromString(data);
 			for (String paras : pairs) {
 				String name=paras.trim();
 				String value="";
@@ -222,9 +223,9 @@ public class NodeExecutionData {
 				if (i!=-1){
 					value=name.substring(i+1);
 					name=name.substring(0,i);
-					parameters.add(new NameValue(name,value));
+					parameters.add(new NameValue(name,StringUtil.quoteString(value)));
 				}else{
-					parameters.get(parameters.size()-1).value=parameters.get(parameters.size()-1).value+","+name;
+					parameters.get(parameters.size()-1).value=parameters.get(parameters.size()-1).value+","+StringUtil.quoteString(name);
 				}
 				
 			}

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
Tue Aug 20 01:26:48 2013
@@ -42,6 +42,7 @@ import javax.xml.xpath.XPathFactory;
 
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.common.utils.Pair;
+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.common.workflow.execution.context.WorkflowContextHeaderBuilder;
@@ -1217,7 +1218,7 @@ public class WorkflowInterpreter {
 		if (inputNumber.length == 1) {
 			inputArray = listOfValues.toArray(new String[listOfValues.size()]);
 		} else {
-			inputArray = input.split(",");
+			inputArray = StringUtil.getElementsFromString(input);
 		}
 		int index = 0;
 		for (DataPort port : inputPorts) {
@@ -1265,7 +1266,7 @@ public class WorkflowInterpreter {
 			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) + "," + listOfValues.get(inputNumbers[0] + j));
+						inputValues.add(listOfValues.get(i) + StringUtil.DELIMETER + listOfValues.get(inputNumbers[0]
+ j));
 					}
 				}
 
@@ -1300,9 +1301,9 @@ public class WorkflowInterpreter {
 				for (int i = 0; i < inputSize; i++) {
 					String inputValue = "";
 					for (String[] array : finalInputList) {
-						inputValue = inputValue + "," + array[i];
+						inputValue = inputValue + StringUtil.DELIMETER + StringUtil.quoteString(array[i]);
 					}
-					inputValue = inputValue.replaceFirst(",", "");
+					inputValue = inputValue.replaceFirst(StringUtil.DELIMETER , "");
 					inputValues.add(inputValue);
 				}
 

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java
Tue Aug 20 01:26:48 2013
@@ -20,6 +20,7 @@
 */
 package org.apache.airavata.xbaya.invoker;
 
+import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
 import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
@@ -41,7 +42,7 @@ public class WorkflowInputUtil {
                     append(getValueElement(input)).append("</").append(port.getName()).append(">");
         }else if(paramType.endsWith("ArrayType")){
             inputString.append(port.getName()).append(">");
-            String[] valueList = input.split(",");
+            String[] valueList = StringUtil.getElementsFromString(input);
             for(String inputValue:valueList){
                 inputString.append(getValueElement(inputValue));
             }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
Tue Aug 20 01:26:48 2013
@@ -41,6 +41,7 @@ import javax.swing.SwingConstants;
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.client.api.exception.DescriptorAlreadyExistsException;
+import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.common.utils.SwingUtil;
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.schemas.gfac.Ec2HostType;
@@ -310,31 +311,20 @@ public class HostDescriptionDialog exten
         SwingUtil.layoutToGrid(globusPanel.getSwingComponent(), 2, 2, SwingUtil.WEIGHT_NONE,
1);
         return globusPanel;
 	}
-    private String arrayToString(String[] list) {
-    	String result="";
-		for (String s : list) {
-			if (result.equals("")){
-				result=s;
-			}else{
-				result+=","+s;
-			}
-		}
-		return result;
-	}
     private void loadData() {
     	HostDescriptionType t = getOriginalHostDescription().getType();
     	hostIdTextField.setText(t.getHostName());
 		hostAddressTextField.setText(t.getHostAddress());
 		if (t instanceof GlobusHostType){
 			cmbResourceProtocol.setSelectedItem(REMOTE_PROTOCOL_STR_GLOBUS);
-			gateKeeperTextField.setText(arrayToString(((GlobusHostType) t).getGlobusGateKeeperEndPointArray()));
-			gridFTPTextField.setText(arrayToString(((GlobusHostType) t).getGridFTPEndPointArray()));
+			gateKeeperTextField.setText(StringUtil.createDelimiteredString(((GlobusHostType) t).getGlobusGateKeeperEndPointArray()));
+			gridFTPTextField.setText(StringUtil.createDelimiteredString(((GlobusHostType) t).getGridFTPEndPointArray()));
 		}else if (t instanceof SSHHostType){
 			cmbResourceProtocol.setSelectedItem(REMOTE_PROTOCOL_STR_SSH);
 		}else if (t instanceof UnicoreHostType){
 			cmbResourceProtocol.setSelectedItem(REMOTE_PROTOCOL_STR_UNICORE);
-			gateKeeperTextField.setText(arrayToString(((UnicoreHostType) t).getUnicoreBESEndPointArray()));
-			gridFTPTextField.setText(arrayToString(((UnicoreHostType) t).getGridFTPEndPointArray()));
+			gateKeeperTextField.setText(StringUtil.createDelimiteredString(((UnicoreHostType) t).getUnicoreBESEndPointArray()));
+			gridFTPTextField.setText(StringUtil.createDelimiteredString(((UnicoreHostType) t).getGridFTPEndPointArray()));
 		}else if (t instanceof Ec2HostType){
 			cmbResourceProtocol.setSelectedItem(REMOTE_PROTOCOL_STR_AMAZON_EC2);
 		}

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
Tue Aug 20 01:26:48 2013
@@ -189,7 +189,7 @@ public class InterpreterUtil {
                 if (object2 instanceof XmlElement) {
 
                     if (((XmlElement) object2).children().iterator().hasNext()) {
-                        outputVal = outputVal + "," + ((XmlElement) object2).children().iterator().next().toString();
+                        outputVal = outputVal + StringUtil.DELIMETER  + StringUtil.quoteString(((XmlElement)
object2).children().iterator().next().toString());
                     }
                 }
             }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java?rev=1515683&r1=1515682&r2=1515683&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
Tue Aug 20 01:26:48 2013
@@ -38,6 +38,7 @@ 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.model.exceptions.WorkflowException;
 import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
 import org.apache.airavata.workflow.model.graph.DataPort;
@@ -174,7 +175,7 @@ public class XBayaUtil {
 							"Unable to find input for the node:"
 									+ forEachNode.getID());
 				}
-				String[] vals = returnValForProvenance.toString().split(",");
+				String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
 				listOfValues.addAll(Arrays.asList(vals));
 			}
 		} else {
@@ -275,9 +276,9 @@ public class XBayaUtil {
 				Object object2 = valItr.next();
 				if (object2 instanceof XmlElement) {
 					outputVal = outputVal
-							+ ","
-							+ ((XmlElement) object2).children().iterator()
-									.next().toString();
+							+ StringUtil.DELIMETER 
+							+ StringUtil.quoteString(((XmlElement) object2).children().iterator()
+									.next().toString());
 				}
 			}
 			outputVal = ((String) outputVal).substring(1,



Mime
View raw message