You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/04/14 20:31:13 UTC

[71/90] [abbrv] AIRAVATA-1124

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ServiceDescriptionNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ServiceDescriptionNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ServiceDescriptionNode.java
new file mode 100644
index 0000000..81a5589
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ServiceDescriptionNode.java
@@ -0,0 +1,142 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.registrybrowser.nodes;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.xbaya.model.registrybrowser.ApplicationDeploymentDescriptions;
+import org.apache.airavata.xbaya.model.registrybrowser.InputParameters;
+import org.apache.airavata.xbaya.model.registrybrowser.OutputParameters;
+import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.DeleteAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.EditAction;
+import org.apache.airavata.xbaya.ui.dialogs.descriptors.DeploymentDescriptionDialog;
+
+public class ServiceDescriptionNode extends AbstractAiravataTreeNode {
+	private ServiceDescription serviceDescription;
+
+	public ServiceDescriptionNode(ServiceDescription serviceDescription, TreeNode parent) {
+		super(parent);
+		setServiceDescription(serviceDescription);
+	}
+
+	@Override
+	protected List<TreeNode> getChildren() {
+		List<Object> parameterTypeList=new ArrayList<Object>();
+		if (getServiceDescription().getType().getInputParametersArray().length>0){
+			parameterTypeList.add(new InputParameters(getServiceDescription().getType().getInputParametersArray()));
+		}
+		if (getServiceDescription().getType().getOutputParametersArray().length>0){
+			parameterTypeList.add(new OutputParameters(getServiceDescription().getType().getOutputParametersArray()));
+		}
+		parameterTypeList.add(new ApplicationDeploymentDescriptions(getRegistry(),getServiceDescription().getType().getName()));
+		return getTreeNodeList(parameterTypeList.toArray(), this);
+	}
+
+    @Override
+    public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return getServiceDescription().getType().getName();
+    }
+
+    @Override
+    public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return JCRBrowserIcons.SERVICE_ICON;
+    }
+
+    public ServiceDescription getServiceDescription() {
+        return serviceDescription;
+    }
+
+    public void setServiceDescription(ServiceDescription serviceDescription) {
+        this.serviceDescription = serviceDescription;
+    }
+
+    @Override
+    public List<String> getSupportedActions() {
+        return Arrays.asList(EditAction.ID, DeleteAction.ID);
+    }
+
+    public boolean triggerAction(JTree tree, String action) throws Exception {
+        if (action.equals(DeleteAction.ID)) {
+        	return deleteServiceDescription(tree);
+        } else if (action.equals(EditAction.ID)) {
+        	return editServiceDescription(tree);
+        }
+        return super.triggerAction(tree, action);
+    }
+
+	private boolean editServiceDescription(JTree tree) {
+		DeploymentDescriptionDialog serviceDescriptionDialog = new DeploymentDescriptionDialog(getRegistry(),false,getServiceDescription(), null);
+    	serviceDescriptionDialog.open();
+//		ServiceDescriptionDialog serviceDescriptionDialog = new ServiceDescriptionDialog(getRegistry(),false,getServiceDescription());
+//		serviceDescriptionDialog.open();
+		if (serviceDescriptionDialog.isServiceCreated()) {
+		    refresh();
+		    reloadTreeNode(tree, this);
+		}
+		return true;
+	}
+
+    private boolean deleteServiceDescription(JTree tree) throws AiravataAPIInvocationException {
+        if (askQuestion("Application", "Are you sure that you want to remove the applications associated with \""
+                + getServiceDescription().getType().getName() + "\"?")) {
+            getRegistry().getApplicationManager().deleteServiceDescription(getServiceDescription().getType().getName());
+            ((AbstractAiravataTreeNode) getParent()).refresh();
+            reloadTreeNode(tree, getParent());
+        }
+        return true;
+    }
+
+    @Override
+    public String getActionCaption(AbstractBrowserActionItem action) {
+        if (action.getID().equals(DeleteAction.ID)) {
+            return "Remove";
+        } else if (action.getID().equals(EditAction.ID)) {
+            return "View/Edit";
+        }
+        return action.getDefaultCaption();
+    }
+
+    @Override
+    public Icon getActionIcon(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+    @Override
+    public String getActionDescription(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+	@Override
+	public String getDefaultAction() {
+		return EditAction.ID;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ServiceDescriptionsNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ServiceDescriptionsNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ServiceDescriptionsNode.java
new file mode 100644
index 0000000..dbfce2e
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ServiceDescriptionsNode.java
@@ -0,0 +1,137 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.registrybrowser.nodes;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.xbaya.model.registrybrowser.ServiceDescriptions;
+import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.AddAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.DeleteAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.RefreshAction;
+import org.apache.airavata.xbaya.ui.dialogs.descriptors.DeploymentDescriptionDialog;
+
+public class ServiceDescriptionsNode extends AbstractAiravataTreeNode {
+    private ServiceDescriptions serviceDescriptions;
+
+    public ServiceDescriptionsNode(ServiceDescriptions serviceDescriptions, TreeNode parent) {
+        super(parent);
+        setServiceDescriptions(serviceDescriptions);
+    }
+
+    @Override
+    protected List<TreeNode> getChildren() {
+        try {
+            return getTreeNodeList(getServiceDescriptions().getDescriptions().toArray(), this);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();
+            return emptyList();
+        } catch (RegistryException e) {
+            e.printStackTrace();
+            return emptyList();
+        }
+    }
+
+    @Override
+    public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return "Applications";
+    }
+
+    @Override
+    public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return JCRBrowserIcons.SERVICES_ICON;
+    }
+
+    public ServiceDescriptions getServiceDescriptions() {
+        return serviceDescriptions;
+    }
+
+    public void setServiceDescriptions(ServiceDescriptions serviceDescriptions) {
+        this.serviceDescriptions = serviceDescriptions;
+    }
+
+    @Override
+    public List<String> getSupportedActions() {
+        return Arrays.asList(AddAction.ID, RefreshAction.ID, DeleteAction.ID);
+    }
+
+    public boolean triggerAction(JTree tree, String action) throws Exception {
+        if (action.equals(DeleteAction.ID)) {
+            deleteServiceDescription(tree);
+            return true;
+        } else if (action.equals(AddAction.ID)) {
+        	DeploymentDescriptionDialog serviceDescriptionDialog = new DeploymentDescriptionDialog(null, getRegistry());
+        	serviceDescriptionDialog.open();
+//            ServiceDescriptionDialog serviceDescriptionDialog = new ServiceDescriptionDialog(getRegistry());
+//            serviceDescriptionDialog.open();
+            if (serviceDescriptionDialog.isServiceCreated()) {
+                refresh();
+                reloadTreeNode(tree, this);
+            }
+            return true;
+        }
+        return super.triggerAction(tree, action);
+    }
+
+    private void deleteServiceDescription(JTree tree) throws Exception {
+        if (askQuestion("Applications",
+                "Are you sure that you want to remove all applications defined in this registry?")) {
+            AiravataAPI registry = getRegistry();
+            List<ServiceDescription> descriptions = getServiceDescriptions().getDescriptions();
+            for (ServiceDescription descriptionWrap : descriptions) {
+                registry.getApplicationManager().deleteServiceDescription(descriptionWrap.getType().getName());
+            }
+            refresh();
+            reloadTreeNode(tree, this);
+        }
+    }
+
+    @Override
+    public String getActionCaption(AbstractBrowserActionItem action) {
+        if (action.getID().equals(DeleteAction.ID)) {
+            return "Remove all Applicatons";
+        } else if (action.getID().equals(AddAction.ID)) {
+            return "Register Application...";
+        }
+        return action.getDefaultCaption();
+    }
+
+    @Override
+    public Icon getActionIcon(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+    @Override
+    public String getActionDescription(AbstractBrowserActionItem action) {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowExperimentNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowExperimentNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowExperimentNode.java
new file mode 100644
index 0000000..d7294db
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowExperimentNode.java
@@ -0,0 +1,141 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.registrybrowser.nodes;
+
+import java.awt.*;
+import java.awt.datatransfer.StringSelection;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.workflow.ExperimentName;
+import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus;
+import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowExperiment;
+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.DeleteAction;
+
+public class XBayaWorkflowExperimentNode extends AbstractAiravataTreeNode {
+	private XBayaWorkflowExperiment experiment;
+	private String workflowExecutionName;
+	
+    public XBayaWorkflowExperimentNode(XBayaWorkflowExperiment experiment, TreeNode parent) {
+        super(parent);
+        setExperiment(experiment);
+    }
+
+    @Override
+    protected List<TreeNode> getChildren() {
+        return getTreeNodeList(getExperiment().getWorkflows().toArray(), this);
+    }
+
+    @Override
+    public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+    	if (workflowExecutionName==null) {
+			try {
+				workflowExecutionName = getRegistry().getProvenanceManager().getExperimentName(getExperiment().getExperimentId()).getInstanceName();
+			} catch (AiravataAPIInvocationException e) {
+				e.printStackTrace();
+			}
+			if (workflowExecutionName==null){
+				workflowExecutionName="["+getExperiment().getExperimentId()+"]";
+			}
+		}
+    	String caption=workflowExecutionName;
+    	try {
+			WorkflowExecutionStatus workflowExecutionStatus = getRegistry().getProvenanceManager().getWorkflowInstanceStatus(getExperiment().getExperimentId(), getExperiment().getExperimentId());
+			if (workflowExecutionStatus!=null && workflowExecutionStatus.getExecutionStatus()!=null){
+				caption += " - <i>" + workflowExecutionStatus.getExecutionStatus().toString()+"</i>";
+				if (workflowExecutionStatus.getStatusUpdateTime()!=null) {
+						caption += "<i> as of " + workflowExecutionStatus.getStatusUpdateTime().toString() + "</i>";
+				}
+			}
+		} catch (AiravataAPIInvocationException e) {
+			e.printStackTrace();
+		}
+		return wrapAsHtml(caption);
+    }
+
+    @Override
+    public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return JCRBrowserIcons.WORKFLOW_EXPERIMENT_ICON;
+    }
+
+    @Override
+    public List<String> getSupportedActions() {
+        return Arrays.asList(CopyAction.ID);
+    }
+
+    public boolean triggerAction(JTree tree, String action) throws Exception {
+        if (action.equals(CopyAction.ID)) {
+            Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(getExperimentInfo()), null);
+        }
+        return super.triggerAction(tree, action);
+    }
+
+    private String getExperimentName (){
+        String experimentId = getExperiment().getExperimentId();
+        try {
+            ExperimentName experimentName = getExperiment().getAiravataAPI().getProvenanceManager().getExperimentName(experimentId);
+            return experimentName.getInstanceName();
+        } catch (AiravataAPIInvocationException e) {
+            return null;
+        }
+    }
+
+    private String getExperimentInfo (){
+        String experimetName = getExperimentName();
+        String experimetID = getExperiment().getExperimentId();
+        return "[Experiment Name = " + experimetName + ", Experiment ID = " + experimetID + "]";
+    }
+
+    @Override
+    public String getActionCaption(AbstractBrowserActionItem action) {
+        if (action.getID().equals(CopyAction.ID)) {
+            return "Copy Experiment Info to clipboard";
+        }
+        return action.getDefaultCaption();
+    }
+
+    @Override
+    public Icon getActionIcon(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+    @Override
+    public String getActionDescription(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+	public XBayaWorkflowExperiment getExperiment() {
+		return experiment;
+	}
+
+	public void setExperiment(XBayaWorkflowExperiment experiment) {
+		this.experiment = experiment;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowExperimentsNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowExperimentsNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowExperimentsNode.java
new file mode 100644
index 0000000..420dea3
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowExperimentsNode.java
@@ -0,0 +1,89 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.registrybrowser.nodes;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+
+import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowExperiments;
+import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.RefreshAction;
+
+public class XBayaWorkflowExperimentsNode extends AbstractAiravataTreeNode {
+	private XBayaWorkflowExperiments experiments;
+	
+    public XBayaWorkflowExperimentsNode(XBayaWorkflowExperiments experiments, TreeNode parent) {
+        super(parent);
+        setExperiments(experiments);
+    }
+
+    @Override
+    protected List<TreeNode> getChildren() {
+        return getTreeNodeList(getExperiments().getAllExperiments().toArray(), this);
+    }
+
+    @Override
+    public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return "Experiments";
+    }
+
+    @Override
+    public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return JCRBrowserIcons.WORKFLOW_EXPERIMENTS_ICON;
+    }
+
+    @Override
+    public List<String> getSupportedActions() {
+        return Arrays.asList(RefreshAction.ID);
+    }
+
+    public boolean triggerAction(JTree tree, String action) throws Exception {
+        return super.triggerAction(tree, action);
+    }
+
+    @Override
+    public String getActionCaption(AbstractBrowserActionItem action) {
+        return action.getDefaultCaption();
+    }
+
+    @Override
+    public Icon getActionIcon(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+    @Override
+    public String getActionDescription(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+	public XBayaWorkflowExperiments getExperiments() {
+		return experiments;
+	}
+
+	public void setExperiments(XBayaWorkflowExperiments experiments) {
+		this.experiments = experiments;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNode.java
new file mode 100644
index 0000000..1d38b80
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNode.java
@@ -0,0 +1,107 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.registrybrowser.nodes;
+
+import java.awt.*;
+import java.awt.datatransfer.StringSelection;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+
+import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflow;
+import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.CopyAction;
+
+public class XBayaWorkflowNode extends AbstractAiravataTreeNode {
+    private XBayaWorkflow xbayaWorkflow;
+
+    public XBayaWorkflowNode(XBayaWorkflow xbayaWorkflow, TreeNode parent) {
+        super(parent);
+        setXbayaWorkflow(xbayaWorkflow);
+    }
+
+    @Override
+    protected List<TreeNode> getChildren() {
+        return getTreeNodeList(getXbayaWorkflow().getWorkflowServices().toArray(),this);
+    }
+
+    @Override
+    public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+    	String caption=getXbayaWorkflow().getWorkflowId();
+    	if (getXbayaWorkflow().getWorkflowName()!=null){
+    		caption=getXbayaWorkflow().getWorkflowName()+" : "+caption;
+    	}
+        return caption;
+    }
+
+    @Override
+    public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return JCRBrowserIcons.WORKFLOW_ICON;
+    }
+
+    public XBayaWorkflow getXbayaWorkflow() {
+        return xbayaWorkflow;
+    }
+
+    public void setXbayaWorkflow(XBayaWorkflow xbayaWorkflow) {
+        this.xbayaWorkflow = xbayaWorkflow;
+    }
+
+    @Override
+    public List<String> getSupportedActions() {
+        return Arrays.asList(CopyAction.ID);
+    }
+
+    public boolean triggerAction(JTree tree, String action) throws Exception {
+        if (action.equals(CopyAction.ID)) {
+            Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(getWorkflowInfo()), null);
+        }
+        return super.triggerAction(tree, action);
+    }
+
+    private String getWorkflowInfo (){
+        String workflowName = getXbayaWorkflow().getWorkflowName();
+        String workflowId = getXbayaWorkflow().getWorkflowId();
+        return "[Worklfow Name = " + workflowName + ", Workflow Instance ID = " + workflowId + "]";
+    }
+
+    @Override
+    public String getActionCaption(AbstractBrowserActionItem action) {
+        if (action.getID().equals(CopyAction.ID)) {
+            return "Copy Workflow Info to clipboard";
+        }
+        return action.getDefaultCaption();
+    }
+
+    @Override
+    public Icon getActionIcon(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+    @Override
+    public String getActionDescription(AbstractBrowserActionItem action) {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNodeElementNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNodeElementNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNodeElementNode.java
new file mode 100644
index 0000000..5cf32de
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowNodeElementNode.java
@@ -0,0 +1,101 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.registrybrowser.nodes;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+
+import org.apache.airavata.xbaya.model.registrybrowser.ServiceParameters;
+import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowNodeElement;
+import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+
+public class XBayaWorkflowNodeElementNode extends AbstractAiravataTreeNode {
+    private XBayaWorkflowNodeElement xbayaWorkflowService;
+
+    public XBayaWorkflowNodeElementNode(XBayaWorkflowNodeElement xbayaWorkflowNodeElement, TreeNode parent) {
+        super(parent);
+        setXbayaWorkflowNodeElement(xbayaWorkflowNodeElement);
+    }
+
+    @Override
+    protected List<TreeNode> getChildren() {
+		List<ServiceParameters> parameterTypeList=new ArrayList<ServiceParameters>();
+		if (getXbayaWorkflowNodeElement().getInputParameters()!=null && getXbayaWorkflowNodeElement().getInputParameters().getParameters().size()>0){
+			parameterTypeList.add(getXbayaWorkflowNodeElement().getInputParameters());
+		}
+		if (getXbayaWorkflowNodeElement().getOutputParameters()!=null && getXbayaWorkflowNodeElement().getOutputParameters().getParameters().size()>0){
+			parameterTypeList.add(getXbayaWorkflowNodeElement().getOutputParameters());
+		}
+		return getTreeNodeList(parameterTypeList.toArray(), this);
+    }
+
+    @Override
+    public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        String type = getXbayaWorkflowNodeElement().getNodeData().getType().toString();
+//        if (selected) {
+//			type = " <font color=\"#D3D3D3\">Service call</font>";
+//		}
+		return wrapAsHtml(getXbayaWorkflowNodeElement().getNodeId()," [", type, "]");
+    }
+
+    @Override
+    public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return JCRBrowserIcons.WORKFLOW_SERVICE_ICON;
+    }
+
+    @Override
+    public List<String> getSupportedActions() {
+        return Arrays.asList();
+    }
+
+    public boolean triggerAction(JTree tree, String action) throws Exception {
+        return super.triggerAction(tree, action);
+    }
+
+    @Override
+    public String getActionCaption(AbstractBrowserActionItem action) {
+        return action.getDefaultCaption();
+    }
+
+    @Override
+    public Icon getActionIcon(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+    @Override
+    public String getActionDescription(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+	public XBayaWorkflowNodeElement getXbayaWorkflowNodeElement() {
+		return xbayaWorkflowService;
+	}
+
+	public void setXbayaWorkflowNodeElement(XBayaWorkflowNodeElement xbayaWorkflowNodeElement) {
+		this.xbayaWorkflowService = xbayaWorkflowNodeElement;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplateNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplateNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplateNode.java
new file mode 100644
index 0000000..0edc847
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplateNode.java
@@ -0,0 +1,130 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.registrybrowser.nodes;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.jcr.PathNotFoundException;
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.ServiceDescriptionRetrieveException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowTemplate;
+import org.apache.airavata.xbaya.registry.RegistryAccesser;
+import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.DeleteAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.ImportAction;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvas;
+
+public class XBayaWorkflowTemplateNode extends AbstractAiravataTreeNode {
+    private XBayaWorkflowTemplate xbayaWorkflow;
+
+    public XBayaWorkflowTemplateNode(XBayaWorkflowTemplate xbayaWorkflow, TreeNode parent) {
+        super(parent);
+        setXbayaWorkflow(xbayaWorkflow);
+    }
+
+    @Override
+    protected List<TreeNode> getChildren() {
+        return emptyList();
+    }
+
+    @Override
+    public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return getXbayaWorkflow().getWorkflowName();
+    }
+
+    @Override
+    public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return JCRBrowserIcons.WORKFLOW_TEMPLATE_ICON;
+    }
+
+    public XBayaWorkflowTemplate getXbayaWorkflow() {
+        return xbayaWorkflow;
+    }
+
+    public void setXbayaWorkflow(XBayaWorkflowTemplate xbayaWorkflow) {
+        this.xbayaWorkflow = xbayaWorkflow;
+    }
+
+    @Override
+    public List<String> getSupportedActions() {
+        return Arrays.asList(ImportAction.ID,DeleteAction.ID);
+    }
+
+    public boolean triggerAction(JTree tree, String action) throws Exception {
+        if (action.equals(DeleteAction.ID)) {
+            deleteHostDescription(tree);
+            return true;
+        } else if (action.equals(ImportAction.ID)) {
+        	Workflow workflow = new RegistryAccesser(getXBayaEngine()).getWorkflow(getXbayaWorkflow().getWorkflowName());
+            GraphCanvas newGraphCanvas = getXBayaEngine().getGUI().newGraphCanvas(true);
+            newGraphCanvas.setWorkflow(workflow);
+            getXBayaEngine().getGUI().getGraphCanvas().setWorkflowFile(null);
+            return true;
+        }
+        return super.triggerAction(tree, action);
+    }
+
+    private void deleteHostDescription(JTree tree) throws PathNotFoundException, ServiceDescriptionRetrieveException {
+        if (askQuestion("XBaya Workflow", "Are you sure that you want to remove the workflow \""
+                + getXbayaWorkflow().getWorkflowName() + "\"?")) {
+            try {
+				getRegistry().getWorkflowManager().removeWorkflow(getXbayaWorkflow().getWorkflowName());
+				((AbstractAiravataTreeNode) getParent()).refresh();
+				reloadTreeNode(tree, getParent());
+			} catch (AiravataAPIInvocationException e) {
+				e.printStackTrace();
+			}
+        }
+    }
+
+    @Override
+    public String getActionCaption(AbstractBrowserActionItem action) {
+        if (action.getID().equals(DeleteAction.ID)) {
+            return "Remove";
+        } else if (action.getID().equals(ImportAction.ID)) {
+            return "Import";
+        }
+        return action.getDefaultCaption();
+    }
+
+    @Override
+    public Icon getActionIcon(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+    @Override
+    public String getActionDescription(AbstractBrowserActionItem action) {
+        return null;
+    }
+    
+    @Override
+    public String getDefaultAction() {
+    	return ImportAction.ID;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplatesNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplatesNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplatesNode.java
new file mode 100644
index 0000000..f3b0c43
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/XBayaWorkflowTemplatesNode.java
@@ -0,0 +1,99 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.registrybrowser.nodes;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.JOptionPane;
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+
+import org.apache.airavata.xbaya.model.registrybrowser.XBayaWorkflowTemplates;
+import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.AddAction;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.RefreshAction;
+
+public class XBayaWorkflowTemplatesNode extends AbstractAiravataTreeNode {
+    private XBayaWorkflowTemplates xbayaWorkflows;
+
+    public XBayaWorkflowTemplatesNode(XBayaWorkflowTemplates xbayaWorkflows, TreeNode parent) {
+        super(parent);
+        setXbayaWorkflows(xbayaWorkflows);
+    }
+
+    @Override
+    protected List<TreeNode> getChildren() {
+        return getTreeNodeList(getXbayaWorkflows().getWorkflows().toArray(), this);
+    }
+
+    @Override
+    public String getCaption(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return "Workflow Templates";
+    }
+
+    @Override
+    public Icon getIcon(boolean selected, boolean expanded, boolean leaf, boolean hasFocus) {
+        return JCRBrowserIcons.WORKFLOW_TEMPLATES_ICON;
+    }
+
+    public XBayaWorkflowTemplates getXbayaWorkflows() {
+        return xbayaWorkflows;
+    }
+
+    public void setXbayaWorkflows(XBayaWorkflowTemplates xbayaWorkflows) {
+        this.xbayaWorkflows = xbayaWorkflows;
+    }
+
+    @Override
+    public List<String> getSupportedActions() {
+        return Arrays.asList(RefreshAction.ID);
+    }
+
+    public boolean triggerAction(JTree tree, String action) throws Exception {
+        if (action.equals(AddAction.ID)) {
+            JOptionPane.showMessageDialog(null, "TODO");
+            // TODO
+            return true;
+        }
+        return super.triggerAction(tree, action);
+    }
+
+    @Override
+    public String getActionCaption(AbstractBrowserActionItem action) {
+        if (action.getID().equals(AddAction.ID)) {
+            return "New workflow...";
+        }
+        return action.getDefaultCaption();
+    }
+
+    @Override
+    public Icon getActionIcon(AbstractBrowserActionItem action) {
+        return null;
+    }
+
+    @Override
+    public String getActionDescription(AbstractBrowserActionItem action) {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/scufl/script/ScuflScript.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/scufl/script/ScuflScript.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/scufl/script/ScuflScript.java
new file mode 100644
index 0000000..27442e4
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/scufl/script/ScuflScript.java
@@ -0,0 +1,539 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.scufl.script;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.workflow.model.component.ws.WSComponent;
+import org.apache.airavata.workflow.model.graph.DataPort;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
+import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+import org.apache.airavata.workflow.model.graph.system.EndifNode;
+import org.apache.airavata.workflow.model.graph.system.IfNode;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.graph.system.MemoNode;
+import org.apache.airavata.workflow.model.graph.system.OutputNode;
+import org.apache.airavata.workflow.model.graph.util.GraphUtil;
+import org.apache.airavata.workflow.model.graph.ws.WSGraph;
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.XBayaConfiguration;
+import org.xmlpull.infoset.impl.XmlElementWithViewsImpl;
+import org.xmlpull.v1.builder.XmlBuilderException;
+import org.xmlpull.v1.builder.XmlDocument;
+import org.xmlpull.v1.builder.XmlElement;
+import org.xmlpull.v1.builder.XmlInfosetBuilder;
+import org.xmlpull.v1.builder.XmlNamespace;
+
+import xsul.XmlConstants;
+import xsul5.wsdl.WsdlMessage;
+import xsul5.wsdl.WsdlMessagePart;
+import xsul5.wsdl.WsdlPort;
+import xsul5.wsdl.WsdlPortType;
+import xsul5.wsdl.WsdlPortTypeOperation;
+import xsul5.wsdl.WsdlService;
+
+public class ScuflScript {
+
+    private Workflow workflow;
+
+    private XBayaConfiguration configuration;
+
+    private WSGraph graph;
+
+    private ArrayList<String> arguments;
+
+    private List<InputNode> inputNodes;
+
+    private List<OutputNode> outputNodes;
+
+    private XmlInfosetBuilder builder = XmlConstants.BUILDER;
+
+    private LinkedList<Node> notYetInvokedNodes;
+
+    private LinkedList<Node> executingNodes;
+
+    private XmlNamespace scuflNS = builder.newNamespace("s", "http://org.embl.ebi.escience/xscufl/0.1alpha");
+
+    private Map<String, XmlElement> sources = new HashMap<String, XmlElement>();
+
+    private List<XmlElement> links = new ArrayList<XmlElement>();
+
+    private List<XmlElement> sinks = new ArrayList<XmlElement>();
+
+    private XmlDocument script;
+
+    public ScuflScript(Workflow workflow, XBayaConfiguration configuration) {
+        this.workflow = workflow;
+        this.configuration = configuration;
+        this.graph = this.workflow.getGraph();
+
+        this.arguments = new ArrayList<String>();
+
+        this.notYetInvokedNodes = new LinkedList<Node>();
+        for (Node node : this.graph.getNodes()) {
+            if (!(node instanceof MemoNode)) {
+                this.notYetInvokedNodes.add(node);
+            }
+        }
+        this.executingNodes = new LinkedList<Node>();
+        this.inputNodes = GraphUtil.getInputNodes(this.graph);
+        this.outputNodes = GraphUtil.getOutputNodes(this.graph);
+    }
+
+    public void create() throws GraphException {
+
+        XmlDocument doc = builder.newDocument();
+
+        XmlElement scufl = doc.addDocumentElement(scuflNS, "scufl");
+        scufl.addAttribute("version", "0.2");
+        scufl.addAttribute("log", "0");
+        XmlElement description = scufl.addElement(scuflNS, "workflowdescription");
+        description.addAttribute("lsid", "urn:lsid:net.sf.taverna:wfDefinition:" + UUID.randomUUID());
+        description.addAttribute("author", "");
+        description.addAttribute("title", workflow.getName());
+        writeServices(scufl);
+
+        writeSplitors(scufl);
+
+        // add links
+        for (XmlElement link : this.links) {
+            scufl.addElement(link);
+        }
+
+        // add source
+        for (String key : this.sources.keySet()) {
+            scufl.addElement(this.sources.get(key));
+        }
+
+        // add sinks
+        for (XmlElement sink : this.sinks) {
+            scufl.addElement(sink);
+        }
+
+        this.script = doc;
+
+    }
+
+    public String getScript() {
+        return builder.serializeToString(this.script);
+    }
+
+    /**
+     * @param scufl
+     * @throws GraphException
+     */
+    private void writeSplitors(XmlElement scufl) throws GraphException {
+
+        Collection<Node> nextNodes = getNextNodes();
+        while (nextNodes.size() > 0) {
+            for (Node node : nextNodes) {
+
+                if (node instanceof WSNode) {
+                    WSNode wsNode = (WSNode) node;
+                    node.getInputPorts();
+                    writeSplitorPerService(scufl, wsNode);
+
+                } else {
+                    // TODO conditions, loops might come here.
+                }
+                this.notYetInvokedNodes.remove(node);
+                nextNodes = getNextNodes();
+            }
+        }
+    }
+
+    /**
+     * @param scufl
+     * @param node
+     * @throws GraphException
+     */
+    private void writeSplitorPerService(XmlElement scufl, WSNode node) throws GraphException {
+        List<DataPort> inputPorts = node.getInputPorts();
+        XmlElement processor = scufl.addElement(scuflNS, "processor");
+        processor.addAttribute("name", getValidName(node) + "InputMessagePartXML");
+        XmlElement local = processor.addElement(scuflNS, "local");
+        local.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLInputSplitter");
+        XmlElement extensions = local.addElement(scuflNS, "extensions");
+
+        QName inputName = getInputElementName(node);
+        if (null == inputName) {
+            throw new GraphException("No Valid input type found for WS Node" + node.getName());
+        }
+        if (node.getOutputPorts().size() != 1) {
+            throw new GraphException("Number of out ports in WS node " + node.getName() + "is invalid:"
+                    + node.getOutputPorts().size());
+        }
+        DataPort outputPort = node.getOutputPort(0);
+
+        WSComponent component = node.getComponent();
+        String inputPartName = component.getInputPartName();
+        String inputTypeName = component.getInputTypeName();
+
+        XmlElement complexType = extensions.addElement(scuflNS, "complextype");
+        complexType.addAttribute("optional", "false");
+        complexType.addAttribute("unbounded", "false");
+        complexType.addAttribute("typename", inputTypeName);
+
+        String spliterName = inputPartName;
+        complexType.addAttribute("name", spliterName);
+        complexType.addAttribute("qname", inputName.toString());
+
+        XmlElement element = complexType.addElement(scuflNS, "elements");
+        for (DataPort port : inputPorts) {
+            if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
+                XmlElement baseType = element.addElement(scuflNS, "basetype");
+                baseType.addAttribute("optional", "false");
+                baseType.addAttribute("unbounded", "false");
+                baseType.addAttribute("typename", port.getType().getLocalPart());
+                baseType.addAttribute("name", port.getName());
+                baseType.addAttribute("qname", inputTypeName + "&gt;" + port.getName());
+
+            }
+            // all the sources are written here
+            // the links from input nodes to the spiters are done here
+            // links from the from node output splitter to the this service's
+            // inputsplitter is done here
+
+            if (port.getFromNode() instanceof InputNode) {
+                XmlElement source = builder.newFragment(scuflNS, "source");
+                source.addAttribute("name", port.getFromNode().getID());
+                if (!sourceExist(port.getFromNode().getID())) {
+                    this.sources.put(port.getFromNode().getID(), source);
+                }
+                XmlElement link = builder.newFragment(scuflNS, "link");
+                link.addAttribute("source", port.getFromNode().getID());
+                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
+                this.links.add(link);
+
+            } else if (port.getFromNode() instanceof WSNode) {
+                XmlElement link = builder.newFragment(scuflNS, "link");
+                if (port.getFromNode().getOutputPorts().size() != 1) {
+                    throw new GraphException("Number of out ports in from WS node " + port.getFromNode().getName()
+                            + "is invalid:" + node.getOutputPorts().size());
+                }
+                link.addAttribute("source", getValidName((WSNode) port.getFromNode()) + "OutputMessagePartXML:"
+                        + port.getFromNode().getOutputPort(0).getName());
+                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
+                this.links.add(link);
+            } else {
+                throw new GraphException("Unhandled from node type:" + port.getFromNode() + " for node"
+                        + node.getName());
+            }
+        }
+
+        // link from the spliter to the service
+
+        XmlElement link = builder.newFragment(scuflNS, "link");
+        link.addAttribute("source", getValidName(node) + "InputMessagePartXML:output");
+        link.addAttribute("sink", getValidName(node) + ":" + spliterName);
+        this.links.add(link);
+
+        // link from service out to the ouput spliter
+
+        link = builder.newFragment(scuflNS, "link");
+        link.addAttribute("source", getValidName(node) + ":" + node.getComponent().getOutputPartName());
+        link.addAttribute("sink", getValidName(node) + "OutputMessagePartXML:input");
+        this.links.add(link);
+
+        // /outspiltor
+        XmlElement outProcessor = scufl.addElement(scuflNS, "processor");
+        outProcessor.addAttribute("name", getValidName(node) + "OutputMessagePartXML");
+        XmlElement outLocal = outProcessor.addElement(scuflNS, "local");
+        outLocal.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLOutputSplitter");
+        XmlElement outExtensions = outLocal.addElement(scuflNS, "extensions");
+        XmlElement outComplextype = outExtensions.addElement(scuflNS, "complextype");
+        outComplextype.addAttribute("optional", "false");
+        outComplextype.addAttribute("unbounded", "false");
+        outComplextype.addAttribute("typename", component.getOutputTypeName());
+        outComplextype.addAttribute("name", component.getOutputPartName());
+        QName outputName = getOutputElementName(node);
+        if (null == outputName) {
+            throw new GraphException("No Valid output type found for WS Node" + node.getName());
+        }
+        outComplextype.addAttribute("qname", outputName.toString());
+        XmlElement elements = outComplextype.addElement(scuflNS, "elements");
+        XmlElement outBaseType = elements.addElement(scuflNS, "basetype");
+        outBaseType.addAttribute("optional", "false");
+        outBaseType.addAttribute("unbounded", "false");
+
+        outBaseType.addAttribute("typename", outputPort.getType().getLocalPart());
+        String Z = component.getOutputPort(0).getName();
+        outBaseType.addAttribute("name", Z);
+
+        outBaseType.addAttribute("qname", component.getOutputTypeName() + "&gt;" + Z);
+
+        List<DataPort> outputPorts = node.getOutputPorts();
+        for (DataPort port : outputPorts) {
+            List<Node> toNodes = port.getToNodes();
+            for (Node toNode : toNodes) {
+                if (toNode instanceof OutputNode) {
+                    if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
+                        XmlElement sink = builder.newFragment(scuflNS, "sink");
+                        sink.addAttribute("name", toNode.getID());
+                        sinks.add(sink);
+                        link = builder.newFragment(scuflNS, "link");
+                        link.addAttribute("source", getValidName(node) + "OutputMessagePartXML:" + outputPort.getName());
+                        link.addAttribute("sink", toNode.getID());
+                        this.links.add(link);
+                    }
+                }
+            }
+        }
+
+    }
+
+    private boolean sourceExist(String name) {
+        Set<String> keys = this.sources.keySet();
+        for (String string : keys) {
+            if (name.equals(string))
+                return true;
+        }
+        return false;
+    }
+
+    /**
+     * @param node
+     * @return
+     * @throws GraphException
+     */
+    private QName getInputElementName(WSNode node) throws GraphException {
+        WSComponent component = node.getComponent();
+        String portTypeName = component.getPortTypeQName().getLocalPart();
+        WsdlPortType portType = component.getWSDL().getPortType(portTypeName);
+        WsdlPortTypeOperation operation = portType.getOperation(component.getOperationName());
+        QName message = operation.getInput().getMessage();
+        WsdlMessage wsdlMessage = component.getWSDL().getMessage(message.getLocalPart());
+        Iterator<WsdlMessagePart> iterator = wsdlMessage.parts().iterator();
+        QName inputName = null;
+        if (iterator.hasNext()) {
+            inputName = iterator.next().getElement();
+        } else {
+            throw new GraphException("No input part found for WS Node" + node.getName());
+        }
+        return inputName;
+    }
+
+    private QName getOutputElementName(WSNode node) throws GraphException {
+        WSComponent component = node.getComponent();
+        String portTypeName = component.getPortTypeQName().getLocalPart();
+        WsdlPortType portType = component.getWSDL().getPortType(portTypeName);
+        WsdlPortTypeOperation operation = portType.getOperation(component.getOperationName());
+        QName message = operation.getOutput().getMessage();
+        WsdlMessage wsdlMessage = component.getWSDL().getMessage(message.getLocalPart());
+        Iterator<WsdlMessagePart> iterator = wsdlMessage.parts().iterator();
+        QName inputName = null;
+        if (iterator.hasNext()) {
+            inputName = iterator.next().getElement();
+        } else {
+            throw new GraphException("No output part found for WS Node" + node.getName());
+        }
+        return inputName;
+    }
+
+    private void writeServices(XmlElement scufl) throws GraphException {
+
+        Collection<NodeImpl> nextNodes = this.graph.getNodes();
+        for (NodeImpl node : nextNodes) {
+            if (node instanceof WSNode) {
+                WSNode wsNode = (WSNode) node;
+                createWSProcess(wsNode, scufl);
+            }
+        }
+    }
+
+    private XmlElement createWSProcess(WSNode node, XmlElement scufl) throws GraphException, XmlBuilderException {
+
+        XmlElement processor = scufl.addElement(scuflNS, "processor");
+        String name = getValidName(node);
+        processor.addAttribute("name", name);
+        XmlElement description = processor.addElement(scuflNS, "description");
+        String txt = node.getComponent().getDescription();
+        if (null == txt) {
+            description.addChild(name);
+        } else {
+            description.addChild(txt);
+        }
+
+        XmlElement arbitrarywsdl = processor.addElement(scuflNS, "arbitrarywsdl");
+        XmlElement wsdl = arbitrarywsdl.addElement(scuflNS, "wsdl");
+
+        String epr = getEPR(node);
+        if (null == epr) {
+            throw new GraphException("EPR not found for the WS-node:" + builder.serializeToString(node));
+        }
+        wsdl.addChild(epr + "?wsdl");
+
+        XmlElement operation = arbitrarywsdl.addElement(scuflNS, "operation");
+        operation.addChild(node.getOperationName());
+
+        return processor;
+
+    }
+
+    /**
+     * @param node
+     * @return
+     */
+    private String getValidName(WSNode node) {
+        return node.getID();
+        // String name = node.getName();
+        // if (name.indexOf(":") != -1) {
+        // name = name.substring(0, name.indexOf(":"));
+        // }
+        // return name;
+    }
+
+    /**
+     * @param wsNode
+     */
+    private String getEPR(WSNode wsNode) {
+        Iterable<WsdlService> services = wsNode.getComponent().getWSDL().services();
+        Iterator<WsdlService> iterator = services.iterator();
+        if (iterator.hasNext()) {
+            Iterable<WsdlPort> ports = iterator.next().ports();
+            Iterator<WsdlPort> portIterator = ports.iterator();
+            if (portIterator.hasNext()) {
+                WsdlPort port = portIterator.next();
+                Iterable children = port.xml().children();
+                Iterator childIterator = children.iterator();
+                while (childIterator.hasNext()) {
+                    Object next = childIterator.next();
+                    if (next instanceof XmlElementWithViewsImpl) {
+                        org.xmlpull.infoset.XmlAttribute epr = ((XmlElementWithViewsImpl) next).attribute("location");
+                        return epr.getValue();
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    public boolean validate(List<String> warnings) {
+        // Empty
+        if (this.graph.getNodes().size() == 0) {
+            String message = "The workflow is empty.";
+            warnings.add(message);
+        }
+
+        // Input ports need to be connected.
+        Collection<Port> inputPorts = GraphUtil.getPorts(this.graph, Port.Kind.DATA_IN);
+        for (Port inputPort : inputPorts) {
+            Collection<Port> fromPorts = inputPort.getFromPorts();
+            if (fromPorts.size() == 0) {
+                Node node = inputPort.getNode();
+                String message = node.getID() + " has an unconnected input " + inputPort.getName();
+                warnings.add(message);
+            }
+        }
+
+        // Input nodes need to be connected.
+        for (InputNode inputNode : this.inputNodes) {
+            if (inputNode.getPort().getToPorts().size() == 0) {
+                String message = inputNode.getID() + " is not connected to any service.";
+                warnings.add(message);
+            }
+        }
+
+        // Cycle
+        if (GraphUtil.containsCycle(this.graph)) {
+            String message = "There is a cycle in the workflow.";
+            warnings.add(message);
+        }
+
+        // Constants are not supported.
+        List<ConstantNode> constantNodes = GraphUtil.getNodes(this.graph, ConstantNode.class);
+        if (constantNodes.size() > 0) {
+            String message = "Constants are not supported for Scufl scripts.";
+            warnings.add(message);
+        }
+
+        // If/endif are not supported.
+        List<IfNode> ifNodes = GraphUtil.getNodes(this.graph, IfNode.class);
+        List<EndifNode> endifNodes = GraphUtil.getNodes(this.graph, EndifNode.class);
+        if (ifNodes.size() > 0 || endifNodes.size() > 0) {
+            String message = "If/endif are not supported for Scufl scripts.";
+            warnings.add(message);
+        }
+
+        if (warnings.size() > 0) {
+            return false;
+        } else {
+            // No error.
+            return true;
+        }
+    }
+
+    private Collection<Node> getNextNodes() throws GraphException {
+        Collection<Node> nextNodes = new ArrayList<Node>();
+        for (Node node : this.notYetInvokedNodes) {
+            if (isNextNode(node)) {
+                nextNodes.add(node);
+            }
+        }
+        return nextNodes;
+    }
+
+    private boolean isNextNode(Node node) throws GraphException {
+        if (node instanceof OutputNode) {
+            return false;
+        }
+        for (Port port : node.getInputPorts()) {
+            Collection<Node> fromNodes = port.getFromNodes();
+            if (fromNodes.isEmpty()) {
+                throw new GraphException("There is a port that is not connected to any.");
+            } else {
+                for (Node fromNode : fromNodes) {
+                    if (this.notYetInvokedNodes.contains(fromNode)) {
+                        // There is a node that should be executed before this
+                        // node.
+                        return false;
+                    }
+                }
+            }
+        }
+        Port port = node.getControlInPort();
+        if (port != null) {
+            Collection<Node> fromNodes = port.getFromNodes();
+            for (Node fromNode : fromNodes) {
+                if (this.notYetInvokedNodes.contains(fromNode)) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BPELScriptTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BPELScriptTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BPELScriptTestCase.java
new file mode 100644
index 0000000..bcfb604
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BPELScriptTestCase.java
@@ -0,0 +1,209 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.airavata.common.utils.IOUtil;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+import org.apache.airavata.workflow.model.gpel.script.BPELScript;
+import org.apache.airavata.workflow.model.gpel.script.BPELScriptType;
+import org.apache.airavata.workflow.model.gpel.script.WorkflowWSDL;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.XBayaConstants;
+import org.apache.airavata.xbaya.test.util.WorkflowCreator;
+import org.gpel.model.GpelProcess;
+import org.xmlpull.infoset.XmlElement;
+
+import xsul5.wsdl.WsdlDefinitions;
+
+public class BPELScriptTestCase extends XBayaTestCase {
+
+    // private static final Logger logger = LoggerFactory.getLogger();
+
+    private WorkflowCreator workflowCreator;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.workflowCreator = new WorkflowCreator();
+    }
+
+    /**
+     * @throws ComponentException
+     * @throws IOException
+     * @throws GraphException
+     * @throws ComponentRegistryException
+     */
+    public void testSimpleMath() throws ComponentException, IOException, GraphException, ComponentRegistryException {
+        Workflow workflow = this.workflowCreator.createSimpleMathWorkflow();
+        testWrokflow(workflow, "simple-math");
+    }
+
+    /**
+     * @throws ComponentException
+     * @throws IOException
+     * @throws GraphException
+     * @throws ComponentRegistryException
+     */
+    public void testMath() throws ComponentException, IOException, GraphException, ComponentRegistryException {
+        Workflow workflow = this.workflowCreator.createMathWorkflow();
+        testWrokflow(workflow, "math");
+    }
+
+    /**
+     * @throws ComponentException
+     * @throws IOException
+     * @throws GraphException
+     * @throws ComponentRegistryException
+     */
+    public void testComplexMath() throws ComponentException, IOException, GraphException, ComponentRegistryException {
+        Workflow workflow = this.workflowCreator.createComplexMathWorkflow();
+        testWrokflow(workflow, "complex-math");
+    }
+
+    /**
+     * @throws ComponentException
+     * @throws IOException
+     * @throws GraphException
+     * @throws ComponentRegistryException
+     */
+    public void testMathWithConstant() throws ComponentException, IOException, GraphException,
+            ComponentRegistryException {
+        Workflow workflow = this.workflowCreator.createMathWithConstWorkflow();
+        testWrokflow(workflow, "constant-test");
+    }
+
+    /**
+     * @throws ComponentException
+     * @throws GraphException
+     * @throws IOException
+     * @throws ComponentRegistryException
+     */
+    public void testArray() throws ComponentException, GraphException, IOException, ComponentRegistryException {
+        Workflow workflow = this.workflowCreator.createArrayWorkflow();
+        testWrokflow(workflow, "array-test");
+    }
+
+    /**
+     * @throws ComponentException
+     * @throws GraphException
+     * @throws IOException
+     * @throws ComponentRegistryException
+     */
+    public void testForEach() throws ComponentException, GraphException, IOException, ComponentRegistryException {
+        Workflow workflow = this.workflowCreator.createForEachWorkflow();
+        testWrokflow(workflow, "foreach-test");
+    }
+
+    /**
+     * @throws ComponentException
+     * @throws GraphException
+     * @throws IOException
+     * @throws ComponentRegistryException
+     */
+    public void testIf() throws ComponentException, GraphException, IOException, ComponentRegistryException {
+        Workflow workflow = this.workflowCreator.createIfWorkflow();
+        testWrokflow(workflow, "if-test");
+    }
+
+    /**
+     * @throws GraphException
+     * @throws ComponentException
+     * @throws IOException
+     * @throws ComponentRegistryException
+     */
+    public void testReceive() throws GraphException, ComponentException, IOException, ComponentRegistryException {
+        Workflow workflow = this.workflowCreator.createReceiveWorkflow();
+        testWrokflow(workflow, "receive-test");
+    }
+
+    /**
+     * @throws GraphException
+     * @throws ComponentException
+     * @throws IOException
+     * @throws ComponentRegistryException
+     */
+    public void testLoan() throws GraphException, ComponentException, IOException, ComponentRegistryException {
+        Workflow workflow = this.workflowCreator.createLoanWorkflow();
+        testWrokflow(workflow, "loan");
+    }
+
+    private void testWrokflow(Workflow workflow, String filename) throws GraphException, IOException,
+            ComponentException {
+
+        // This one is for debuggin in case something below fails.
+        XMLUtil.saveXML(workflow.toXML(), new File(this.temporalDirectory, filename + "-0.xwf"));
+
+        // Create BPEL
+        BPELScript bpel = new BPELScript(workflow);
+        bpel.create(BPELScriptType.GPEL);
+        GpelProcess gpelProcess = bpel.getGpelProcess();
+        WorkflowWSDL workflowWSDL = bpel.getWorkflowWSDL();
+        WsdlDefinitions definitions = workflowWSDL.getWsdlDefinitions();
+
+        File bpelFile = new File(this.temporalDirectory, filename + XBayaConstants.BPEL_SUFFIX);
+        File wsdlFile = new File(this.temporalDirectory, filename + XBayaConstants.WSDL_SUFFIX);
+        XMLUtil.saveXML(gpelProcess.xml(), bpelFile);
+        XMLUtil.saveXML(definitions.xml(), wsdlFile);
+
+        // Save the workflow
+        File workflowFile = new File(this.temporalDirectory, filename + XBayaConstants.WORKFLOW_FILE_SUFFIX);
+        XMLUtil.saveXML(workflow.toXML(), workflowFile);
+
+        // Read the workflow
+        XmlElement workflowElement = XMLUtil.loadXML(workflowFile);
+        workflow = new Workflow(workflowElement);
+
+        // Create BPEL again
+        bpel = new BPELScript(workflow);
+        bpel.create(BPELScriptType.GPEL);
+        gpelProcess = bpel.getGpelProcess();
+        workflowWSDL = bpel.getWorkflowWSDL();
+        definitions = workflowWSDL.getWsdlDefinitions();
+
+        File bpelFile2 = new File(this.temporalDirectory, filename + "-2" + XBayaConstants.BPEL_SUFFIX);
+        File wsdlFile2 = new File(this.temporalDirectory, filename + "-2" + XBayaConstants.WSDL_SUFFIX);
+        XMLUtil.saveXML(gpelProcess.xml(), bpelFile2);
+        XMLUtil.saveXML(definitions.xml(), wsdlFile2);
+
+        File workflowFile2 = new File(this.temporalDirectory, filename + "-2" + XBayaConstants.WORKFLOW_FILE_SUFFIX);
+        XMLUtil.saveXML(workflow.toXML(), workflowFile2);
+
+        // Compare
+        String workflowString = IOUtil.readFileToString(workflowFile);
+        String workflowString2 = IOUtil.readFileToString(workflowFile2);
+        assertEquals(workflowString, workflowString2);
+
+        String bpelString = IOUtil.readFileToString(bpelFile);
+        String bpelString2 = IOUtil.readFileToString(bpelFile2);
+        assertEquals(bpelString, bpelString2);
+
+        String wsdlString = IOUtil.readFileToString(wsdlFile);
+        String wsdlString2 = IOUtil.readFileToString(wsdlFile2);
+        assertEquals(wsdlString, wsdlString2);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BrowserTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BrowserTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BrowserTestCase.java
new file mode 100644
index 0000000..3d68557
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BrowserTestCase.java
@@ -0,0 +1,38 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.common.utils.BrowserLauncher;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+
+public class BrowserTestCase extends TestCase {
+
+    /**
+     * @throws WorkflowException
+     * 
+     */
+    public void testBrowserLauncher() throws Exception {
+        BrowserLauncher.openURL("http://www.google.com");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCTestCase.java
new file mode 100644
index 0000000..e6ae107
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCTestCase.java
@@ -0,0 +1,131 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test;
+
+import java.io.File;
+import java.net.URI;
+
+import junit.framework.TestSuite;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.gpel.DSCUtil;
+import org.apache.airavata.xbaya.file.XBayaPathConstants;
+import org.apache.airavata.xbaya.lead.LeadContextHeaderHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.v1.builder.XmlElement;
+
+import xsul.lead.LeadContextHeader;
+import xsul.util.XsulUtil;
+import xsul.wsif.WSIFMessage;
+import xsul.wsif.WSIFOperation;
+import xsul.wsif.WSIFPort;
+import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
+import xsul.xwsif_runtime.WSIFClient;
+import xsul.xwsif_runtime.WSIFRuntime;
+import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
+import xsul.xwsif_runtime_async_http.XsulSoapHttpWsaResponsesCorrelator;
+import xsul5.wsdl.WsdlDefinitions;
+import xsul5.wsdl.WsdlException;
+import xsul5.wsdl.WsdlResolver;
+
+public class DSCTestCase extends XBayaTestCase {
+
+    private static final String SAMPLE_AWSDL = XBayaPathConstants.WSDL_DIRECTORY + "/test/TestCMD_Example1_AWSDL.xml";
+
+    private static final Logger logger = LoggerFactory.getLogger(DSCTestCase.class);
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(new TestSuite(DSCTestCase.class));
+    }
+
+    /**
+     * @see org.apache.airavata.xbaya.test.XBayaTestCase#setUp()
+     */
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    /**
+     * @throws WsdlException
+     */
+    public void test() throws WsdlException {
+        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(new File(".").toURI(),
+                new File(SAMPLE_AWSDL).toURI());
+        URI dscURL = this.configuration.getDSCURL();
+        logger.info("dscURL: " + dscURL);
+        DSCUtil.convertToCWSDL(definitions, dscURL);
+
+        logger.info(definitions.xmlStringPretty());
+
+        // client
+        int clientPort = 0;
+        WSIFAsyncResponsesCorrelator correlator = new XsulSoapHttpWsaResponsesCorrelator(clientPort);
+        String serverLoc = ((XsulSoapHttpWsaResponsesCorrelator) correlator).getServerLocation();
+        logger.info("client is waiting at " + serverLoc);
+
+        // LEAD Context Header
+        // Create lead context.
+        LeadContextHeaderHelper leadContextHelper = new LeadContextHeaderHelper();
+        leadContextHelper.setXBayaConfiguration(this.configuration);
+        LeadContextHeader leadContext = leadContextHelper.getLeadContextHeader();
+        leadContext.setWorkflowId(URI.create("http://host/2005/11/09/workflowinstace"));
+        leadContext.setNodeId("decoder1");
+        leadContext.setTimeStep("5");
+        leadContext.setServiceInstanceId(URI.create("decoder-instance-10"));
+
+        XmlElement element3 = XMLUtil.xmlElement5ToXmlElement3(definitions.xml());
+        xsul.wsdl.WsdlDefinitions definitions3 = new xsul.wsdl.WsdlDefinitions(element3);
+
+        WSIFClient wclient = WSIFRuntime.getDefault().newClientFor(definitions3, "TestCMD_Example1SoapPort");
+        StickySoapHeaderHandler handler = new StickySoapHeaderHandler("use-lead-header", leadContext);
+
+        wclient.addHandler(handler);
+        wclient.useAsyncMessaging(correlator);
+        wclient.setAsyncResponseTimeoutInMs(33000L);
+
+        WSIFPort port = wclient.getPort();
+        WSIFOperation operation = port.createOperation("Run");
+        WSIFMessage inputMessage = operation.createInputMessage();
+        WSIFMessage outputMessage = operation.createOutputMessage();
+        WSIFMessage faultMessage = operation.createFaultMessage();
+
+        // inputMessage.setObjectPart("InputParam1", "Hello");
+        inputMessage.setObjectPart("InputParam1", "100");
+
+        logger.info("inputMessage: " + XsulUtil.safeXmlToString((XmlElement) inputMessage));
+        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
+
+        XmlElement result;
+        if (success) {
+            result = (XmlElement) outputMessage;
+        } else {
+            result = (XmlElement) faultMessage;
+        }
+        logger.info("result:\n" + XsulUtil.safeXmlToString(result));
+
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCUtilTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCUtilTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCUtilTestCase.java
new file mode 100644
index 0000000..866aa6a
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCUtilTestCase.java
@@ -0,0 +1,79 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test;
+
+import java.io.File;
+
+import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+import org.apache.airavata.workflow.model.gpel.DSCUtil;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.file.XBayaPathConstants;
+import org.apache.airavata.xbaya.test.util.WorkflowCreator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import xsul5.wsdl.WsdlDefinitions;
+import xsul5.wsdl.WsdlException;
+import xsul5.wsdl.WsdlResolver;
+
+public class DSCUtilTestCase extends XBayaTestCase {
+
+    private static final String SAMPLE_AWSDL = XBayaPathConstants.WSDL_DIRECTORY + "/test/adder-awsdl.xml";
+
+    private static final String WSDL_WITH_MULTIPLE_PORT_TYPES = XBayaPathConstants.BPEL_SCRIPT_DIRECTORY
+            + File.separator + "receive-test-wsdl.xml";
+
+    private static final Logger logger = LoggerFactory.getLogger(DSCUtilTestCase.class);
+
+    /**
+     * @throws WsdlException
+     */
+    public void testConvertToCWSDL() throws WsdlException {
+        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(new File(".").toURI(),
+                new File(SAMPLE_AWSDL).toURI());
+        DSCUtil.convertToCWSDL(definitions, this.configuration.getDSCURL());
+        logger.info(definitions.xmlStringPretty());
+    }
+
+    /**
+     * 
+     */
+    public void testMultiplePortTypes() {
+        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(new File(".").toURI(),
+                new File(WSDL_WITH_MULTIPLE_PORT_TYPES).toURI());
+        DSCUtil.convertToCWSDL(definitions, this.configuration.getDSCURL());
+        logger.info(definitions.xmlStringPretty());
+    }
+
+    /**
+     * @throws ComponentException
+     * @throws GraphException
+     * @throws ComponentRegistryException
+     */
+    public void testConvertToCWSDLs() throws ComponentException, GraphException, ComponentRegistryException {
+        WorkflowCreator creator = new WorkflowCreator();
+        Workflow workflow = creator.createComplexMathWorkflow();
+        DSCUtil.createCWSDLs(workflow, this.configuration.getDSCURL());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GFacServiceCreaterTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GFacServiceCreaterTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GFacServiceCreaterTestCase.java
new file mode 100644
index 0000000..1dca11e
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GFacServiceCreaterTestCase.java
@@ -0,0 +1,120 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.utils.IOUtil;
+import org.apache.airavata.common.utils.WSDLUtil;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.file.XBayaPathConstants;
+import org.apache.airavata.xbaya.invoker.GenericInvoker;
+import org.apache.airavata.xbaya.invoker.Invoker;
+import org.apache.airavata.xbaya.jython.lib.GFacServiceCreator;
+import org.apache.airavata.xbaya.jython.lib.NotificationSender;
+import org.apache.airavata.xbaya.jython.script.JythonScript;
+import org.apache.airavata.xbaya.test.util.WorkflowCreator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GFacServiceCreaterTestCase extends XBayaTestCase {
+
+    private static final String TEST_SERVICE_QNAME = "{http://www.extreme.indiana.edu/lead}TestCMD_Simple";
+
+    private static final String TEST_AWSDL = XBayaPathConstants.WSDL_DIRECTORY + File.separator
+            + WorkflowCreator.GFAC_TEST_AWSDL;
+
+    private static final Logger logger = LoggerFactory.getLogger(GFacServiceCreaterTestCase.class);
+
+    /**
+     * @throws WorkflowException
+     */
+    public void testCreate() throws WorkflowException {
+        URI gFacURL = this.configuration.getGFacURL();
+        URI gFacWSDLURL = WSDLUtil.appendWSDLQuary(gFacURL);
+        GFacServiceCreator creator = new GFacServiceCreator(gFacWSDLURL);
+        creator.createService(TEST_SERVICE_QNAME);
+        creator.shutdownService();
+    }
+
+    /**
+     * @throws WorkflowException
+     */
+    public void testService() throws WorkflowException {
+        NotificationSender notifier = new NotificationSender(this.configuration.getBrokerURL(), "test-topic2");
+        Invoker invoker = new GenericInvoker(QName.valueOf(TEST_SERVICE_QNAME), TEST_AWSDL, "test-node", null,
+                this.configuration.getGFacURL().toString(), notifier);
+        invoker.setup();
+        invoker.setOperation("Run");
+        invoker.setInput("inparam1", "test");
+        invoker.invoke();
+        Object output = invoker.getOutput("outparam1");
+        logger.info("output: " + output);
+    }
+
+    /**
+     * @throws ComponentException
+     * @throws IOException
+     * @throws GraphException
+     * @throws InterruptedException
+     * @throws ComponentRegistryException
+     */
+    public void testWorkflow() throws ComponentException, IOException, GraphException, InterruptedException,
+            ComponentRegistryException {
+        WorkflowCreator creator = new WorkflowCreator();
+        Workflow workflow = creator.createGFacWorkflow();
+
+        File workflowFile = new File("tmp/gfac-test.xwf");
+        XMLUtil.saveXML(workflow.toXML(), workflowFile);
+
+        JythonScript script = new JythonScript(workflow, this.configuration);
+        script.create();
+        String jythonString = script.getJythonString();
+        String filename = "tmp/gfac-test.py";
+        IOUtil.writeToFile(jythonString, filename);
+
+        // String[] argv = new String[] { filename, "-TestCMD_Simple_wsdl",
+        // GFAC_TEST_WSDL };
+        // jython.main(argv);
+
+        String[] commands = new String[] { "./jython.sh", filename, "-TestCMD_Simple_wsdl", TEST_AWSDL };
+        Process process = Runtime.getRuntime().exec(commands);
+        int exitValue = process.waitFor();
+        logger.info("Exit value: " + exitValue);
+        InputStream inputStream = process.getInputStream();
+        String output = IOUtil.readToString(inputStream);
+        logger.info("output: " + output);
+        InputStream errorStream = process.getErrorStream();
+        String error = IOUtil.readToString(errorStream);
+        logger.info("error: " + error);
+    }
+}
\ No newline at end of file