airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1389469 - in /airavata/trunk/modules: commons/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ xbaya-gui/src/main/java/org...
Date Mon, 24 Sep 2012 16:14:59 GMT
Author: samindaw
Date: Mon Sep 24 16:14:58 2012
New Revision: 1389469

URL: http://svn.apache.org/viewvc?rev=1389469&view=rev
Log:
fixing registry browser to load experiments

Added:
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/NodeParameter.java
      - copied, changed from r1389434, airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameter.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowNodeElement.java
      - copied, changed from r1389341, airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowService.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNodeElementNode.java
      - copied, changed from r1389341, airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowServiceNode.java
Removed:
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameter.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowService.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowServiceNode.java
Modified:
    airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/WorkflowInstanceNodeData.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InputParameters.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/OutputParameters.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameters.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflow.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiment.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiments.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataTreeNodeFactory.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java

Modified: airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/WorkflowInstanceNodeData.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/WorkflowInstanceNodeData.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/WorkflowInstanceNodeData.java
(original)
+++ airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/WorkflowInstanceNodeData.java
Mon Sep 24 16:14:58 2012
@@ -21,6 +21,7 @@
 
 package org.apache.airavata.registry.api.workflow;
 
+import java.util.ArrayList;
 import java.util.List;
 
 public class WorkflowInstanceNodeData{
@@ -41,8 +42,35 @@ public class WorkflowInstanceNodeData{
 	public void setWorkflowInstanceNode(WorkflowInstanceNode workflowInstanceNode) {
 		this.workflowInstanceNode = workflowInstanceNode;
 	}
-
+	
+	private static class NameValue{
+		String name;
+		String value;
+		public NameValue(String name, String value) {
+			this.name=name;
+			this.value=value;
+		}
+	}
+	
+	private static List<NameValue> getIOParameterData(String data){
+		List<NameValue> parameters=new ArrayList<NameValue>();
+		String[] pairs = data.split(",");
+		for (String paras : pairs) {
+			String[] nameVals = paras.trim().split("=");
+			NameValue pair = new NameValue(nameVals[0].trim(),nameVals[1].trim());
+			parameters.add(pair);
+		}
+		return parameters;
+	}
+	
 	public List<WorkflowInstanceNodePortData> getInputData() {
+		if (inputData==null){
+			inputData=new ArrayList<WorkflowInstanceNodePortData>();
+			List<NameValue> data = getIOParameterData(getInput());
+			for (NameValue nameValue : data) {
+				inputData.add(new WorkflowInstanceNodePortData(getWorkflowInstanceNode(), nameValue.name,
nameValue.value));
+			}
+		}
 		return inputData;
 	}
 
@@ -51,6 +79,13 @@ public class WorkflowInstanceNodeData{
 	}
 
 	public List<WorkflowInstanceNodePortData> getOutputData() {
+		if (outputData==null){
+			outputData=new ArrayList<WorkflowInstanceNodePortData>();
+			List<NameValue> data = getIOParameterData(getOutput());
+			for (NameValue nameValue : data) {
+				outputData.add(new WorkflowInstanceNodePortData(getWorkflowInstanceNode(), nameValue.name,
nameValue.value));
+			}
+		}
 		return outputData;
 	}
 

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
Mon Sep 24 16:14:58 2012
@@ -1157,7 +1157,7 @@ public class AiravataJPARegistry extends
 		List<String> result=new ArrayList<String>();
 		List<ExperimentResource> experiments = jpa.getWorker().getExperiments();
 		for (ExperimentResource resource : experiments) {
-			if (resource.getData().getUserName().equals(user)){
+			if (user==null || resource.getData().getUserName().equals(user)){
 				result.add(resource.getExpID());
 			}
 		}

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InputParameters.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InputParameters.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InputParameters.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/InputParameters.java
Mon Sep 24 16:14:58 2012
@@ -25,7 +25,7 @@ import org.apache.airavata.schemas.gfac.
 
 public class InputParameters extends ServiceParameters {
 
-	public InputParameters(ServiceParameter[] parameters) {
+	public InputParameters(NodeParameter[] parameters) {
 		super(parameters);
 	}
 	

Copied: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/NodeParameter.java
(from r1389434, airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameter.java)
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/NodeParameter.java?p2=airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/NodeParameter.java&p1=airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameter.java&r1=1389434&r2=1389469&rev=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameter.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/NodeParameter.java
Mon Sep 24 16:14:58 2012
@@ -24,15 +24,15 @@ package org.apache.airavata.xbaya.model.
 import org.apache.airavata.schemas.gfac.Parameter;
 
 
-public class ServiceParameter {
+public class NodeParameter {
 	private Parameter parameter;
 	private Object value;
 	
-	public ServiceParameter(Parameter parameter) {
+	public NodeParameter(Parameter parameter) {
 		this(parameter,null);
 	}
 	
-	public ServiceParameter(Parameter parameter, Object value) {
+	public NodeParameter(Parameter parameter, Object value) {
 		setParameter(parameter);
 		setValue(value);
 	}

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/OutputParameters.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/OutputParameters.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/OutputParameters.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/OutputParameters.java
Mon Sep 24 16:14:58 2012
@@ -25,7 +25,7 @@ import org.apache.airavata.schemas.gfac.
 
 public class OutputParameters extends ServiceParameters {
 
-	public OutputParameters(ServiceParameter[] parameters) {
+	public OutputParameters(NodeParameter[] parameters) {
 		super(parameters);
 	}
 	

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameters.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameters.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameters.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/ServiceParameters.java
Mon Sep 24 16:14:58 2012
@@ -28,30 +28,30 @@ import java.util.List;
 import org.apache.airavata.schemas.gfac.Parameter;
 
 public class ServiceParameters {
-	private List<ServiceParameter> parameters;
+	private List<NodeParameter> parameters;
 	
 	public ServiceParameters(Parameter[] parameters) {
 		if (parameters!=null) {
-			List<ServiceParameter> serviceParaList = new ArrayList<ServiceParameter>();
+			List<NodeParameter> serviceParaList = new ArrayList<NodeParameter>();
 			for (Parameter parameter : parameters) {
-				serviceParaList.add(new ServiceParameter(parameter));
+				serviceParaList.add(new NodeParameter(parameter));
 			}
 			setParameters(serviceParaList);
 		}
 	}
 	
-	public ServiceParameters(ServiceParameter[] parameters) {
+	public ServiceParameters(NodeParameter[] parameters) {
 		if (parameters!=null) {
 			setParameters(Arrays.asList(parameters));
 		}
 	}
-	public List<ServiceParameter> getParameters() {
+	public List<NodeParameter> getParameters() {
 		if (parameters==null){
-			parameters=new ArrayList<ServiceParameter>();
+			parameters=new ArrayList<NodeParameter>();
 		}
 		return parameters;
 	}
-	public void setParameters(List<ServiceParameter> parameters) {
+	public void setParameters(List<NodeParameter> parameters) {
 		this.parameters = parameters;
 	}
 }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflow.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflow.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflow.java
Mon Sep 24 16:14:58 2012
@@ -24,45 +24,67 @@ package org.apache.airavata.xbaya.model.
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.airavata.common.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.registry.api.workflow.WorkflowInstance;
+import org.apache.airavata.registry.api.workflow.WorkflowInstanceData;
+import org.apache.airavata.registry.api.workflow.WorkflowInstanceNodeData;
+
 public class XBayaWorkflow {
-	private List<XBayaWorkflowService> workflowServices;
-	private String workflowId;
-	private String workflowName;
+	private List<XBayaWorkflowNodeElement> workflowServices;
+	private WorkflowInstance workflowInstance;
+	private AiravataRegistry2 registry;
 	
-	public XBayaWorkflow(String workflowId, String workflowName, List<XBayaWorkflowService>
workflowServices) {
-		setWorkflowId(workflowId);
-		setWorkflowName(workflowName);
-		setWorkflowServices(workflowServices);
+	public XBayaWorkflow(WorkflowInstance workflowInstance, AiravataRegistry2 registry) {
+		setWorkflowInstance(workflowInstance);
+		setRegistry(registry);
 	}
 
-	public List<XBayaWorkflowService> getWorkflowServices() {
+	public List<XBayaWorkflowNodeElement> getWorkflowServices() {
 		if (workflowServices==null){
-			workflowServices=new ArrayList<XBayaWorkflowService>();
+			workflowServices=new ArrayList<XBayaWorkflowNodeElement>();
+			try {
+				WorkflowInstanceData workflowInstanceData = getRegistry().getWorkflowInstanceData(getWorkflowId());
+				List<WorkflowInstanceNodeData> nodeDataList = workflowInstanceData.getNodeDataList();
+				for (WorkflowInstanceNodeData nodeData : nodeDataList) {
+					workflowServices.add(new XBayaWorkflowNodeElement(nodeData.getWorkflowInstanceNode().getNodeId(),
nodeData));
+				}
+			} catch (RegistryException e) {
+				e.printStackTrace();
+			}
 		}
 		return workflowServices;
 	}
 
-	public void setWorkflowServices(List<XBayaWorkflowService> workflowServices) {
+	public void setWorkflowNodes(List<XBayaWorkflowNodeElement> workflowServices) {
 		this.workflowServices = workflowServices;
 	}
 	
-	public void add(XBayaWorkflowService workflowService){
+	public void add(XBayaWorkflowNodeElement workflowService){
 		getWorkflowServices().add(workflowService);
 	}
 
 	public String getWorkflowName() {
-		return workflowName;
+		return getWorkflowInstance().getTemplateName();
 	}
 
-	public void setWorkflowName(String workflowName) {
-		this.workflowName = workflowName;
+	public String getWorkflowId() {
+		return getWorkflowInstance().getWorkflowInstanceId();
 	}
 
-	public String getWorkflowId() {
-		return workflowId;
+	public AiravataRegistry2 getRegistry() {
+		return registry;
+	}
+
+	public void setRegistry(AiravataRegistry2 registry) {
+		this.registry = registry;
+	}
+
+	public WorkflowInstance getWorkflowInstance() {
+		return workflowInstance;
 	}
 
-	public void setWorkflowId(String workflowId) {
-		this.workflowId = workflowId;
+	public void setWorkflowInstance(WorkflowInstance workflowInstance) {
+		this.workflowInstance = workflowInstance;
 	}
 }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiment.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiment.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiment.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiment.java
Mon Sep 24 16:14:58 2012
@@ -24,18 +24,31 @@ package org.apache.airavata.xbaya.model.
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.airavata.common.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.registry.api.workflow.WorkflowInstance;
+
 public class XBayaWorkflowExperiment {
 	private List<XBayaWorkflow> workflows;
 	private String experimentId;
+	private AiravataRegistry2 registry;
 	
-	public XBayaWorkflowExperiment(String experimentId, List<XBayaWorkflow> workflows)
{
-		setWorkflows(workflows);
+	public XBayaWorkflowExperiment(String experimentId, AiravataRegistry2 registry) {
 		setExperimentId(experimentId);
+		setRegistry(registry);
 	}
 
 	public List<XBayaWorkflow> getWorkflows() {
 		if (workflows==null){
 			workflows=new ArrayList<XBayaWorkflow>();
+			try {
+				List<WorkflowInstance> experimentWorkflowInstances = getRegistry().getExperimentWorkflowInstances(getExperimentId());
+				for (WorkflowInstance workflowInstance : experimentWorkflowInstances) {
+					workflows.add(new XBayaWorkflow(workflowInstance, getRegistry()));
+				}
+			} catch (RegistryException e) {
+				e.printStackTrace();
+			}
 		}
 		return workflows;
 	}
@@ -55,4 +68,12 @@ public class XBayaWorkflowExperiment {
 	public void setExperimentId(String experimentId) {
 		this.experimentId = experimentId;
 	}
+
+	public AiravataRegistry2 getRegistry() {
+		return registry;
+	}
+
+	public void setRegistry(AiravataRegistry2 registry) {
+		this.registry = registry;
+	}
 }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiments.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiments.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiments.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowExperiments.java
Mon Sep 24 16:14:58 2012
@@ -21,22 +21,13 @@
 
 package org.apache.airavata.xbaya.model.registrybrowser;
 
-import java.io.IOException;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.xml.parsers.ParserConfigurationException;
-
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.workflow.WorkflowInstanceData;
-import org.apache.airavata.registry.api.workflow.WorkflowNodeIOData;
-import org.apache.airavata.schemas.gfac.Parameter;
-import org.apache.airavata.xbaya.interpretor.NameValue;
-import org.apache.airavata.xbaya.util.XBayaUtil;
-import org.xml.sax.SAXException;
 
 public class XBayaWorkflowExperiments {
 	private AiravataRegistry2 registry;
@@ -49,92 +40,19 @@ public class XBayaWorkflowExperiments {
 		Map<String, XBayaWorkflowExperiment> experiments=new HashMap<String,XBayaWorkflowExperiment>();
     	try {
     		initializeExperimentMap(experiments);
-			List<WorkflowNodeIOData> workflowInput = getRegistry().searchWorkflowInstanceNodeInput(null,
null, null);
-			List<WorkflowNodeIOData> workflowOutput = getRegistry().searchWorkflowInstanceNodeOutput(null,
null, null);
-//			createChildren(experiments, workflowInput, true);
-//			createChildren(experiments, workflowOutput, false);
 		} catch (RegistryException e) {
 			e.printStackTrace();
 		}
     	return Arrays.asList(experiments.values().toArray(new XBayaWorkflowExperiment[]{}));
 	}
 	
-	public void initializeExperimentMap(Map<String, XBayaWorkflowExperiment> experiments){
-		try {
-			List<String> workflowExecutionIdByUser = getRegistry().getExperimentIdByUser(".*");
-			for (String expId : workflowExecutionIdByUser) {
-				XBayaWorkflowExperiment xBayaWorkflowExperiment = new XBayaWorkflowExperiment(expId,
null);
-				WorkflowInstanceData workflowInstanceData = getRegistry().getWorkflowInstanceData(expId);
-				xBayaWorkflowExperiment.add(new XBayaWorkflow(expId,workflowInstanceData.getWorkflowName(),null));
-				experiments.put(expId,xBayaWorkflowExperiment);
-			}
-		} catch (RegistryException e) {
-			e.printStackTrace();
+	public void initializeExperimentMap(Map<String, XBayaWorkflowExperiment> experiments)
throws RegistryException{
+		List<String> experimentIdByUser = getRegistry().getExperimentIdByUser(null);
+		for (String id : experimentIdByUser) {
+			experiments.put(id, new XBayaWorkflowExperiment(id, getRegistry()));
 		}
 	}
 	
-	private void createChildren(
-			Map<String, XBayaWorkflowExperiment> experiments,
-			List<WorkflowNodeIOData> workflowIO, boolean inputData) {
-		for (WorkflowNodeIOData workflowIOData : workflowIO) {
-			if (!experiments.containsKey(workflowIOData.getExperimentId())){
-				experiments.put(workflowIOData.getExperimentId(),new XBayaWorkflowExperiment(workflowIOData.getExperimentId(),
null));
-			}
-			XBayaWorkflowExperiment xBayaWorkflowExperiment = experiments.get(workflowIOData.getExperimentId());
-			XBayaWorkflow xbayaWorkflow=null;
-			for(XBayaWorkflow workflow:xBayaWorkflowExperiment.getWorkflows()){
-				if (workflow.getWorkflowId().equals(workflowIOData.getWorkflowId())){
-					xbayaWorkflow=workflow;
-					break;
-				}
-			}
-			if (xbayaWorkflow==null){
-				xbayaWorkflow=new XBayaWorkflow(workflowIOData.getWorkflowId(),workflowIOData.getWorkflowName(),null);
-				xBayaWorkflowExperiment.add(xbayaWorkflow);
-			}
-			
-			XBayaWorkflowService workflowService=null;
-			for(XBayaWorkflowService service:xbayaWorkflow.getWorkflowServices()){
-				if (service.getServiceNodeId().equals(workflowIOData.getNodeId())){
-					workflowService=service;
-					break;
-				}
-			}
-			
-			if (workflowService==null){
-				workflowService=new XBayaWorkflowService(workflowIOData.getNodeId(),null,null);
-				xbayaWorkflow.add(workflowService);
-			}
-			try {
-				List<NameValue> parameterData = XBayaUtil.getIOParameterData(workflowIOData.getValue());
-				for (NameValue pair : parameterData) {
-					Parameter parameter = Parameter.Factory.newInstance();
-					parameter.setParameterName(pair.getName());
-					ServiceParameter serviceParameter = new ServiceParameter(parameter, pair.getValue());
-					if (inputData) {
-						workflowService.getInputParameters().getParameters()
-								.add(serviceParameter);
-					}else{
-						workflowService.getOutputParameters().getParameters()
-						.add(serviceParameter);
-					}
-				}
-			} catch (ParserConfigurationException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			} catch (SAXException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			
-			
-			//TODO setup parameters
-		}
-	}
-		
 	public AiravataRegistry2 getRegistry() {
 		return registry;
 	}

Copied: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowNodeElement.java
(from r1389341, airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowService.java)
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowNodeElement.java?p2=airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowNodeElement.java&p1=airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowService.java&r1=1389341&r2=1389469&rev=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowService.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/model/registrybrowser/XBayaWorkflowNodeElement.java
Mon Sep 24 16:14:58 2012
@@ -21,31 +21,52 @@
 
 package org.apache.airavata.xbaya.model.registrybrowser;
 
-public class XBayaWorkflowService {
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.airavata.registry.api.workflow.WorkflowInstanceNodeData;
+import org.apache.airavata.registry.api.workflow.WorkflowInstanceNodePortData;
+import org.apache.airavata.schemas.gfac.Parameter;
+
+public class XBayaWorkflowNodeElement {
 	private InputParameters inputParameters;
 	private OutputParameters outputParameters;
-	private String serviceNodeId;
+	private WorkflowInstanceNodeData nodeData;
+	private String nodeId;
 	
-	public XBayaWorkflowService(String serviceNodeId, InputParameters inputParameters, OutputParameters
outputParameters) {
-		setServiceNodeId(serviceNodeId);
-		setInputParameters(inputParameters);
-		setOutputParameters(outputParameters);
+	public XBayaWorkflowNodeElement(String nodeId, WorkflowInstanceNodeData nodeData) {
+		setNodeId(nodeId);
+		setNodeData(nodeData);
 	}
 
 	public OutputParameters getOutputParameters() {
 		if (outputParameters==null){
-			outputParameters=new OutputParameters((ServiceParameter[])null);
+			outputParameters=new OutputParameters((NodeParameter[])null);
+			outputParameters.getParameters().addAll(generateParameterList(nodeData.getOutputData()));
 		}
 		return outputParameters;
 	}
 
+	private List<NodeParameter> generateParameterList(
+			List<WorkflowInstanceNodePortData> outputData) {
+		List<NodeParameter> params=new ArrayList<NodeParameter>();
+		for (WorkflowInstanceNodePortData portData : outputData) {
+			Parameter parameter = Parameter.Factory.newInstance();
+			parameter.setParameterName(portData.getName());
+			NodeParameter serviceParameter = new NodeParameter(parameter, portData.getValue());
+			params.add(serviceParameter);
+		}
+		return params;
+	}
+
 	public void setOutputParameters(OutputParameters outputParameters) {
 		this.outputParameters = outputParameters;
 	}
 
 	public InputParameters getInputParameters() {
 		if (inputParameters==null){
-			inputParameters=new InputParameters((ServiceParameter[])null);
+			inputParameters=new InputParameters((NodeParameter[])null);
+			inputParameters.getParameters().addAll(generateParameterList(nodeData.getInputData()));
 		}
 		return inputParameters;
 	}
@@ -54,11 +75,19 @@ public class XBayaWorkflowService {
 		this.inputParameters = inputParameters;
 	}
 
-	public String getServiceNodeId() {
-		return serviceNodeId;
+	public String getNodeId() {
+		return nodeId;
+	}
+
+	public void setNodeId(String nodeId) {
+		this.nodeId = nodeId;
+	}
+
+	public WorkflowInstanceNodeData getNodeData() {
+		return nodeData;
 	}
 
-	public void setServiceNodeId(String serviceNodeId) {
-		this.serviceNodeId = serviceNodeId;
+	public void setNodeData(WorkflowInstanceNodeData nodeData) {
+		this.nodeData = nodeData;
 	}
 }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataTreeNodeFactory.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataTreeNodeFactory.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataTreeNodeFactory.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/AiravataTreeNodeFactory.java
Mon Sep 24 16:14:58 2012
@@ -42,12 +42,12 @@ import org.apache.airavata.xbaya.model.r
 import org.apache.airavata.xbaya.model.registrybrowser.MessageBoxURLs;
 import org.apache.airavata.xbaya.model.registrybrowser.OutputParameters;
 import org.apache.airavata.xbaya.model.registrybrowser.ServiceDescriptions;
-import org.apache.airavata.xbaya.model.registrybrowser.ServiceParameter;
+import org.apache.airavata.xbaya.model.registrybrowser.NodeParameter;
 import org.apache.airavata.xbaya.model.registrybrowser.ServiceParameters;
 import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflow;
 import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowExperiment;
 import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowExperiments;
-import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowService;
+import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowNodeElement;
 import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowTemplate;
 import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowTemplates;
 
@@ -89,8 +89,8 @@ public class AiravataTreeNodeFactory {
 			return new XBayaWorkflowTemplatesNode((XBayaWorkflowTemplates)o,parent);
 		}else if (o instanceof XBayaWorkflowTemplate){
 			return new XBayaWorkflowTemplateNode((XBayaWorkflowTemplate)o,parent);
-		}else if (o instanceof ServiceParameter){
-			return new ParameterNode((ServiceParameter)o,parent);
+		}else if (o instanceof NodeParameter){
+			return new ParameterNode((NodeParameter)o,parent);
 		}else if (o instanceof InputParameters){
 			return new InputParametersNode((InputParameters)o,parent);
 		}else if (o instanceof OutputParameters){
@@ -103,8 +103,8 @@ public class AiravataTreeNodeFactory {
 			return new XBayaWorkflowExperimentNode((XBayaWorkflowExperiment)o,parent);
 		}else if (o instanceof XBayaWorkflow){
 			return new XBayaWorkflowNode((XBayaWorkflow)o,parent);
-		}else if (o instanceof XBayaWorkflowService){
-			return new XBayaWorkflowServiceNode((XBayaWorkflowService)o,parent);
+		}else if (o instanceof XBayaWorkflowNodeElement){
+			return new XBayaWorkflowNodeElementNode((XBayaWorkflowNodeElement)o,parent);
 		}else{
 			return new DefaultMutableTreeNode(o);
 		}

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java?rev=1389469&r1=1389468&r2=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java
Mon Sep 24 16:14:58 2012
@@ -30,16 +30,16 @@ import javax.swing.Icon;
 import javax.swing.JTree;
 import javax.swing.tree.TreeNode;
 
-import org.apache.airavata.xbaya.model.registrybrowser.ServiceParameter;
+import org.apache.airavata.xbaya.model.registrybrowser.NodeParameter;
 import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
 import org.apache.airavata.xbaya.ui.actions.registry.browser.CopyAction;
 import org.apache.airavata.xbaya.ui.actions.registry.browser.ViewAction;
 import org.apache.airavata.xbaya.ui.dialogs.TextWindow;
 
 public class ParameterNode extends AbstractAiravataTreeNode {
-	private ServiceParameter parameter;
+	private NodeParameter parameter;
 	
-	public ParameterNode(ServiceParameter parameter, TreeNode parent) {
+	public ParameterNode(NodeParameter parameter, TreeNode parent) {
 		super(parent);
 		setParameter(parameter);
 	}
@@ -109,11 +109,11 @@ public class ParameterNode extends Abstr
 		return null;
 	}
 
-	public ServiceParameter getParameter() {
+	public NodeParameter getParameter() {
 		return parameter;
 	}
 
-	public void setParameter(ServiceParameter parameter) {
+	public void setParameter(NodeParameter parameter) {
 		this.parameter = parameter;
 	}
 }

Copied: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNodeElementNode.java
(from r1389341, airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowServiceNode.java)
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNodeElementNode.java?p2=airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNodeElementNode.java&p1=airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowServiceNode.java&r1=1389341&r2=1389469&rev=1389469&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowServiceNode.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNodeElementNode.java
Mon Sep 24 16:14:58 2012
@@ -30,25 +30,25 @@ import javax.swing.JTree;
 import javax.swing.tree.TreeNode;
 
 import org.apache.airavata.xbaya.model.registrybrowser.ServiceParameters;
-import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowService;
+import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowNodeElement;
 import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
 
-public class XBayaWorkflowServiceNode extends AbstractAiravataTreeNode {
-    private XBayaWorkflowService xbayaWorkflowService;
+public class XBayaWorkflowNodeElementNode extends AbstractAiravataTreeNode {
+    private XBayaWorkflowNodeElement xbayaWorkflowService;
 
-    public XBayaWorkflowServiceNode(XBayaWorkflowService xbayaWorkflowService, TreeNode parent)
{
+    public XBayaWorkflowNodeElementNode(XBayaWorkflowNodeElement xbayaWorkflowNodeElement,
TreeNode parent) {
         super(parent);
-        setXbayaWorkflowService(xbayaWorkflowService);
+        setXbayaWorkflowNodeElement(xbayaWorkflowNodeElement);
     }
 
     @Override
     protected List<TreeNode> getChildren() {
 		List<ServiceParameters> parameterTypeList=new ArrayList<ServiceParameters>();
-		if (getXbayaWorkflowService().getInputParameters()!=null && getXbayaWorkflowService().getInputParameters().getParameters().size()>0){
-			parameterTypeList.add(getXbayaWorkflowService().getInputParameters());
+		if (getXbayaWorkflowNodeElement().getInputParameters()!=null && getXbayaWorkflowNodeElement().getInputParameters().getParameters().size()>0){
+			parameterTypeList.add(getXbayaWorkflowNodeElement().getInputParameters());
 		}
-		if (getXbayaWorkflowService().getOutputParameters()!=null && getXbayaWorkflowService().getOutputParameters().getParameters().size()>0){
-			parameterTypeList.add(getXbayaWorkflowService().getOutputParameters());
+		if (getXbayaWorkflowNodeElement().getOutputParameters()!=null && getXbayaWorkflowNodeElement().getOutputParameters().getParameters().size()>0){
+			parameterTypeList.add(getXbayaWorkflowNodeElement().getOutputParameters());
 		}
 		return getTreeNodeList(parameterTypeList.toArray(), this);
     }
@@ -59,7 +59,7 @@ public class XBayaWorkflowServiceNode ex
 //        if (selected) {
 //			type = " <font color=\"#D3D3D3\">Service call</font>";
 //		}
-		return wrapAsHtml(getXbayaWorkflowService().getServiceNodeId(),type);
+		return wrapAsHtml(getXbayaWorkflowNodeElement().getNodeId(),type);
     }
 
     @Override
@@ -91,11 +91,11 @@ public class XBayaWorkflowServiceNode ex
         return null;
     }
 
-	public XBayaWorkflowService getXbayaWorkflowService() {
+	public XBayaWorkflowNodeElement getXbayaWorkflowNodeElement() {
 		return xbayaWorkflowService;
 	}
 
-	public void setXbayaWorkflowService(XBayaWorkflowService xbayaWorkflowService) {
-		this.xbayaWorkflowService = xbayaWorkflowService;
+	public void setXbayaWorkflowNodeElement(XBayaWorkflowNodeElement xbayaWorkflowNodeElement)
{
+		this.xbayaWorkflowService = xbayaWorkflowNodeElement;
 	}
 }



Mime
View raw message