airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: Set experiment output data type when launching workflow via XBaya
Date Mon, 17 Nov 2014 17:56:21 GMT
Repository: airavata
Updated Branches:
  refs/heads/master f348ef4c5 -> 5c139f2ce


Set experiment output data type when launching workflow via XBaya


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/5c139f2c
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/5c139f2c
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/5c139f2c

Branch: refs/heads/master
Commit: 5c139f2ce72652e45cfef6b0cbbb1d96c3f2b313
Parents: f348ef4
Author: shamrath <shameerainfo@gmail.com>
Authored: Mon Nov 17 12:56:14 2014 -0500
Committer: shamrath <shameerainfo@gmail.com>
Committed: Mon Nov 17 12:56:14 2014 -0500

----------------------------------------------------------------------
 .../org/apache/airavata/common/utils/JSONUtil.java    |  9 ++++++---
 .../apache/airavata/workflow/model/wf/Workflow.java   |  4 +++-
 .../experiment/WorkflowInterpreterLaunchWindow.java   | 14 +++++++++++++-
 3 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/5c139f2c/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/JSONUtil.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/JSONUtil.java
b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/JSONUtil.java
index bb72290..7946acc 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/JSONUtil.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/JSONUtil.java
@@ -43,9 +43,7 @@ public class JSONUtil {
 
 
     public static void saveJSON(JsonElement jsonElement, File file) throws IOException {
-        Gson gson = new GsonBuilder().setPrettyPrinting().create();
-        IOUtil.writeToFile(gson.toJson(jsonElement), file);
-
+        IOUtil.writeToFile(jsonElementToString(jsonElement), file);
     }
 
     public static JsonObject stringToJSONObject(String workflowString) {
@@ -68,6 +66,11 @@ public class JSONUtil {
 
     }
 
+    public static String jsonElementToString(JsonElement jsonElement) {
+        Gson gson = new GsonBuilder().setPrettyPrinting().create();
+        return gson.toJson(jsonElement);
+    }
+
     public static boolean isEqual(JsonObject originalJsonObject, JsonObject newJsonObject)
{
         // TODO - Implement this method
         if (originalJsonObject == null && newJsonObject == null) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/5c139f2c/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 a886e75..a1c0103 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
@@ -41,6 +41,7 @@ import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonPrimitive;
 import org.apache.airavata.common.exception.UtilsException;
+import org.apache.airavata.common.utils.JSONUtil;
 import org.apache.airavata.common.utils.WSDLUtil;
 import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.workflow.model.component.Component;
@@ -174,7 +175,8 @@ public class Workflow implements Cloneable {
     public Workflow(String workflowString) throws GraphException, ComponentException {
         this();
         try {
-            XmlElement workflowElement = XMLUtil.stringToXmlElement(workflowString);
+//            XmlElement workflowElement = XMLUtil.stringToXmlElement(workflowString);
+            JsonObject workflowElement = JSONUtil.stringToJSONObject(workflowString);
             parse(workflowElement);
         } catch (RuntimeException e) {
             throw new GraphException(e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/5c139f2c/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 4294513..6b9ba7c 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
@@ -24,10 +24,12 @@ package org.apache.airavata.xbaya.ui.experiment;
 import org.apache.airavata.api.Airavata;
 import org.apache.airavata.api.Airavata.Client;
 import org.apache.airavata.api.client.AiravataClientFactory;
+import org.apache.airavata.common.utils.JSONUtil;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.model.appcatalog.appinterface.DataType;
 import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
 import org.apache.airavata.model.error.AiravataClientConnectException;
 import org.apache.airavata.model.error.AiravataClientException;
 import org.apache.airavata.model.error.AiravataSystemException;
@@ -40,6 +42,7 @@ import org.apache.airavata.model.workspace.experiment.UserConfigurationData;
 import org.apache.airavata.orchestrator.client.OrchestratorClientFactory;
 import org.apache.airavata.orchestrator.cpi.OrchestratorService;
 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.wf.Workflow;
 import org.apache.airavata.xbaya.ThriftClientData;
@@ -266,7 +269,7 @@ public class WorkflowInterpreterLaunchWindow {
 		workflowClone.setName(workflowClone.getName()+UUID.randomUUID().toString());
 		org.apache.airavata.model.Workflow w = new org.apache.airavata.model.Workflow();
 		w.setName(workflowClone.getName());
-		w.setGraph(XMLUtil.xmlElementToString(workflowClone.toXML()));
+        w.setGraph(JSONUtil.jsonElementToString(workflowClone.toJSON()));
 		w.setTemplateId(airavataClient.registerWorkflow(w));
         String instanceName = this.instanceNameTextField.getText();
         if (instanceName.trim().equals("")){
@@ -308,6 +311,15 @@ public class WorkflowInterpreterLaunchWindow {
 			experiment.addToExperimentInputs(elem );
         }
 
+        final List<OutputNode> outputNodes = GraphUtil.getOutputNodes(this.workflow.getGraph());
+        OutputDataObjectType outputDataObjectType = null;
+        for (OutputNode outputNode : outputNodes) {
+            outputDataObjectType = new OutputDataObjectType();
+            outputDataObjectType.setName(outputNode.getName());
+            outputDataObjectType.setType(DataType.STRING);
+            experiment.addToExperimentOutputs(outputDataObjectType);
+        }
+
         // Add scheduling configurations
         if (host != null && host.getSelectedIndex() >= 0) {
             String selectedHostName = host.getSelectedItem().toString();


Mime
View raw message