airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1351927 - /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/
Date Wed, 20 Jun 2012 03:02:58 GMT
Author: samindaw
Date: Wed Jun 20 03:02:57 2012
New Revision: 1351927

URL: http://svn.apache.org/viewvc?rev=1351927&view=rev
Log:
removing mode and introducing the interactor

Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionMessage.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java?rev=1351927&r1=1351926&r2=1351927&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java
Wed Jun 20 03:02:57 2012
@@ -21,24 +21,24 @@
 
 package org.apache.airavata.xbaya.interpretor;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.ws.WSGraph;
 import org.apache.airavata.workflow.model.wf.Workflow;
 import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
-import org.apache.airavata.xbaya.XBayaConfiguration;
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
-import org.apache.airavata.xbaya.monitor.MonitorConfiguration;
 import org.apache.airavata.xbaya.monitor.MonitorException;
-import org.apache.airavata.xbaya.myproxy.MyProxyClient;
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
 import org.apache.airavata.xbaya.ui.graph.subworkflow.SubWorkflowNodeGUI;
+import org.apache.airavata.xbaya.ui.graph.system.DifferedInputHandler;
 import org.apache.airavata.xbaya.ui.utils.Cancelable;
 import org.apache.airavata.xbaya.ui.utils.MyProxyChecker;
-import org.apache.airavata.xbaya.util.XBayaUtil;
+import org.apache.airavata.xbaya.util.InterpreterUtil;
 
 public class GUIWorkflowInterpreterInteractorImpl implements
 		WorkflowInterpreterInteractor {
@@ -56,7 +56,7 @@ public class GUIWorkflowInterpreterInter
 	}
 
 	@Override
-	public boolean notify(WorkflowExecutionMessage messageType, Object data) {
+	public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration
config, Object data) {
 		switch (messageType) {
 		case NODE_STATE_CHANGED:
 			xbayaGUI.getGraphCanvas().repaint();
@@ -75,6 +75,13 @@ public class GUIWorkflowInterpreterInter
 			// }
 			// }
 			getWorkflow().setExecutionState(state);
+			if (state==WorkflowExecutionState.PAUSED){
+				if (config.getWorkflow().getExecutionState() == WorkflowExecutionState.RUNNING
+						|| config.getWorkflow().getExecutionState() == WorkflowExecutionState.STEP) {
+					config.getGUI().getToolbar().getPlayAction()
+							.actionPerformed(null);
+				}
+			}
 			break;
 		case EXECUTION_TASK_START:
 			TaskNotification task = (TaskNotification) data;
@@ -104,53 +111,61 @@ public class GUIWorkflowInterpreterInter
 			break;
 		case OPEN_SUBWORKFLOW:
 			((SubWorkflowNodeGUI) NodeController.getGUI((Node) data))
-					.openWorkflowTab(this.engine.getGUI());
+					.openWorkflowTab(config.getGUI());
+			break;
 		case EXECUTION_CLEANUP:
 			this.engine.resetWorkflowInterpreter();
 			try {
-				this.engine.getMonitor().stop();
+				config.getMonitor().stop();
 			} catch (MonitorException e) {
 				e.printStackTrace();
 			} finally {
 				this.engine.getMonitor().reset();
 			}
+			break;
+		case HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS:
+			ArrayList<Node> waitingNodes = InterpreterUtil.getWaitingNodesDynamically((WSGraph)data);
+			for (Node readyNode : waitingNodes) {
+				DifferedInputHandler.handleDifferredInputsofDependentNodes(
+						readyNode, config.getGUI());
+			}
+			break;
+		default:
+			return false;	
 		}
-		return false;
+		return true;
 	}
 
 	@Override
-	public Object retrieveData(WorkflowExecutionMessage messageType, Object data)
+	public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration
config, Object data)
 			throws Exception {
 		Object result = null;
 		switch (messageType) {
 		case INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW:
-			WorkflowExecutionData widata = (WorkflowExecutionData) data;
-            XBayaConfiguration conf = this.engine.getConfiguration();
-            WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(widata.workflow,widata.topic,conf.getMessageBoxURL(),
conf.getBrokerURL(), conf.getJcrComponentRegistry().getRegistry(), conf, engine.getGUI(),
new MyProxyChecker(this.engine), this.engine.getMonitor());
+            WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(config.getWorkflow(),config.getTopic(),config.getMessageBoxURL(),
config.getMessageBrokerURL(), config.getRegistry(), config.getConfiguration(), config.getGUI(),
new MyProxyChecker(this.engine), this.engine.getMonitor());
             workflowInterpreterConfiguration.setActOnProvenance(false);
             workflowInterpreterConfiguration.setSubWorkflow(true);
 			result = new WorkflowInterpreter(workflowInterpreterConfiguration, 
 					new GUIWorkflowInterpreterInteractorImpl(engine,
-							widata.workflow));
+							config.getWorkflow()));
 			this.engine.registerWorkflowInterpreter((WorkflowInterpreter)result);
 			break;
-		case INPUT_GSS_CREDENTIAL:
-			MyProxyChecker myProxyChecker = new MyProxyChecker(this.engine);
-			myProxyChecker.loadIfNecessary();
-			MyProxyClient myProxyClient = this.engine.getMyProxyClient();
-			result = myProxyClient.getProxy();
-			break;
-		case INPUT_LEAD_CONTEXT_HEADER:
-			WSNodeData w = (WSNodeData) data;
-			result = XBayaUtil.buildLeadContextHeader(this.getWorkflow(),
-					w.currentInterpreter.getConfig().getConfiguration(),
-					new MonitorConfiguration(w.currentInterpreter
-							.getConfig().getMessageBrokerURL(),
-							w.currentInterpreter.getConfig().getTopic(), true,
-							w.currentInterpreter.getConfig()
-									.getMessageBoxURL()), w.wsNode.getID(),
-					null);
-			break;
+//		case INPUT_GSS_CREDENTIAL:
+//			MyProxyChecker myProxyChecker = new MyProxyChecker(this.engine);
+//			myProxyChecker.loadIfNecessary();
+//			MyProxyClient myProxyClient = this.engine.getMyProxyClient();
+//			result = myProxyClient.getProxy();
+//			break;
+//		case INPUT_LEAD_CONTEXT_HEADER:
+//			Node node = (Node) data;
+//			result = XBayaUtil.buildLeadContextHeader(this.getWorkflow(),
+//					config.getConfiguration(),
+//					new MonitorConfiguration(config.getMessageBrokerURL(),
+//							config.getTopic(), true,
+//							config
+//									.getMessageBoxURL()), node.getID(),
+//					null);
+//			break;
 		}
 		return result;
 	}

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java?rev=1351927&r1=1351926&r2=1351927&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java
Wed Jun 20 03:02:57 2012
@@ -21,9 +21,15 @@
 
 package org.apache.airavata.xbaya.interpretor;
 
+import java.util.ArrayList;
+
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.ws.WSGraph;
 import org.apache.airavata.workflow.model.wf.Workflow;
 import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
 import org.apache.airavata.xbaya.monitor.MonitorConfiguration;
+import org.apache.airavata.xbaya.ui.graph.system.DifferedInputHandler;
+import org.apache.airavata.xbaya.util.InterpreterUtil;
 import org.apache.airavata.xbaya.util.XBayaUtil;
 
 public class SSWorkflowInterpreterInteractorImpl implements
@@ -35,7 +41,7 @@ public class SSWorkflowInterpreterIntera
 	}
 
 	@Override
-	public boolean notify(WorkflowExecutionMessage messageType, Object data) {
+	public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration
config, Object data) {
 		switch (messageType) {
 		case NODE_STATE_CHANGED:
 			break;
@@ -43,44 +49,48 @@ public class SSWorkflowInterpreterIntera
 			WorkflowExecutionState state = (WorkflowExecutionState) data;
 			if (state == WorkflowExecutionState.PAUSED
 					|| state == WorkflowExecutionState.STOPPED) {
-				workflow.setExecutionState(WorkflowExecutionState.STOPPED);
+				config.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
 			}
 			break;
 		case EXECUTION_TASK_START:
 			break;
 		case EXECUTION_TASK_END:
 			break;
+		case OPEN_SUBWORKFLOW:
+			break;
+		case HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS:
+				break;
+		default:
+			return false;	
 		}
-		return false;
+		return true;
 	}
 
 	@Override
-	public Object retrieveData(WorkflowExecutionMessage messageType, Object data)
+	public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration
config, Object data)
 			throws Exception {
 		Object result = null;
 		switch (messageType) {
 		case INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW:
 			WorkflowExecutionData widata = (WorkflowExecutionData) data;
-            WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(widata.workflow,widata.topic,widata.currentInterpreter.getConfig().getMessageBoxURL(),
widata.currentInterpreter.getConfig().getMessageBrokerURL(), widata.currentInterpreter.getConfig().getRegistry(),
widata.currentInterpreter.getConfig().getConfiguration(), widata.currentInterpreter.getConfig().getGUI(),
widata.currentInterpreter.getConfig().getMyProxyChecker(), widata.currentInterpreter.getConfig().getMonitor());
+            WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(config.getWorkflow(),config.getTopic(),config.getMessageBoxURL(),
config.getMessageBrokerURL(), config.getRegistry(), config.getConfiguration(), config.getGUI(),
config.getMyProxyChecker(), config.getMonitor());
 			result = new WorkflowInterpreter(workflowInterpreterConfiguration
 					, 
-					new SSWorkflowInterpreterInteractorImpl(widata.workflow));
+					new SSWorkflowInterpreterInteractorImpl(config.getWorkflow()));
 			break;
 //		case INPUT_GSS_CREDENTIAL:
 //			WorkflowInterpreter w = (WorkflowInterpreter) data;
 //			result = SecurityUtil.getGSSCredential(w.getUsername(),
 //					w.getPassword(), w.getConfig().getConfiguration().getMyProxyServer());
 //			break;
-		case INPUT_LEAD_CONTEXT_HEADER:
-			WSNodeData d = (WSNodeData) data;
-			result = XBayaUtil.buildLeadContextHeader(d.currentInterpreter
-					.getWorkflow(), d.currentInterpreter.getConfig().getConfiguration(),
-					new MonitorConfiguration(d.currentInterpreter
-							.getConfig().getMessageBrokerURL(),
-							d.currentInterpreter.getConfig().getTopic(), true,
-							d.currentInterpreter.getConfig().getMessageBoxURL()), d.wsNode.getID(),
-					null);
-			break;
+//		case INPUT_LEAD_CONTEXT_HEADER:
+//			Node node = (Node) data;
+//			result = XBayaUtil.buildLeadContextHeader(config.getWorkflow(), config.getConfiguration(),
+//					new MonitorConfiguration(config.getMessageBrokerURL(),
+//							config.getTopic(), true,
+//							config.getMessageBoxURL()), node.getID(),
+//					null);
+//			break;
 		}
 		return result;
 	}

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionMessage.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionMessage.java?rev=1351927&r1=1351926&r2=1351927&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionMessage.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowExecutionMessage.java
Wed Jun 20 03:02:57 2012
@@ -31,8 +31,10 @@ public enum WorkflowExecutionMessage {
 	EXECUTION_ERROR,
 	EXECUTION_CLEANUP,
 	OPEN_SUBWORKFLOW,
+	HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS,
 	INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW,
 	INPUT_GSS_CREDENTIAL,
 	INPUT_LEAD_CONTEXT_HEADER,
 	INPUT_GFAC_INVOKER,
+	
 }

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1351927&r1=1351926&r2=1351927&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
Wed Jun 20 03:02:57 2012
@@ -31,6 +31,7 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.xml.namespace.QName;
@@ -100,12 +101,10 @@ import org.apache.airavata.xbaya.monitor
 import org.apache.airavata.xbaya.provenance.ProvenanceReader;
 import org.apache.airavata.xbaya.provenance.ProvenanceWrite;
 import org.apache.airavata.xbaya.security.XBayaSecurity;
-import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
 import org.apache.airavata.xbaya.ui.graph.NodeGUI;
 import org.apache.airavata.xbaya.ui.graph.subworkflow.SubWorkflowNodeGUI;
 import org.apache.airavata.xbaya.ui.graph.system.DifferedInputHandler;
 import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler.NodeState;
-import org.apache.airavata.xbaya.ui.utils.Cancelable;
 import org.apache.airavata.xbaya.util.AmazonUtil;
 import org.apache.airavata.xbaya.util.InterpreterUtil;
 import org.apache.airavata.xbaya.util.XBayaUtil;
@@ -117,114 +116,19 @@ import xsul5.XmlConstants;
 
 public class WorkflowInterpreter {
 
-//	private static final int WorkflowInterpreterConfiguration.GUI_MODE = 1;
-//
-//	private static final int SERVER_MODE = 2;
-
-
-//	private static final int MAXIMUM_RETRY_TIME = 2;
-
 	public static final String WORKFLOW_STARTED = "Workflow Running";
 	public static final String WORKFLOW_FINISHED = "Workflow Finished";
 
-//	private XBayaEngine engine;
-
 	private WorkflowInterpreterConfiguration config;
 	
-//	private Map<Node, Integer> retryCounter = new HashMap<Node, Integer>();
-
 	private Map<Node, Invoker> invokerMap = new HashMap<Node, Invoker>();
 
-//	private WorkflowNotifiable notifier;
-
-//	private boolean retryFailed = false;
-
-//	private Workflow workflow;
-//
-//    private WSGraph graph;
-
-//	private boolean isSubWorkflow;
-
-//	private XBayaConfiguration configuration;
-
-//	private int mode;
-
-//	private String password;
-//
-//	private String username;
-
-//	private String topic;
-
-//    private Boolean gfacEmbeddedMode = false;
-
 	private LeadResourceMapping resourceMapping;
 
-//	private boolean actOnProvenance = false;
-
 	private PredicatedTaskRunner provenanceWriter;
 
-//	private boolean runWithCrossProduct = false;
-
-//	private boolean isoffline = false;
-	
 	private WorkflowInterpreterInteractor interactor;
 
-//	/**
-//	 * 
-//	 * Constructs a WorkflowInterpreter.
-//	 * 
-//	 * @param configuration
-//	 * @param topic
-//	 * @param workflow
-//	 * @param username
-//	 * @param password
-//	 */
-//	public WorkflowInterpreter(WorkflowInterpreterConfiguration config,WorkflowInterpreterInteractor
interactor) {
-//		this.setConfig(config);
-////		this.setUsername(username);
-////		this.setPassword(password);
-////		this.setTopic(topic);
-////        this.config.getNotifier() = new NotificationSender(
-////				this.getConfig().getConfiguration().getBrokerURL(), topic);
-//		this.config.getMode() = SERVER_MODE;
-//		this.interactor=interactor;
-//	}
-
-//	/**
-//	 * 
-//	 * Constructs a WorkflowInterpreter.
-//	 * 
-//	 * @param configuration
-//	 * @param topic
-//	 * @param workflow
-//	 * @param username
-//	 * @param password
-//	 */
-//	public WorkflowInterpreter(WorkflowInterpreterConfiguration config, String topic, WorkflowInterpreterInteractor
interactor) {
-////		this.isoffline = offline;
-//		this.setConfig(config);
-//		this.setTopic(topic);
-//		if (config.isOffline()) {
-//			this.config.getNotifier() = new StandaloneNotificationSender(topic,
-//					this.getWorkflow());
-//		} else {
-//			throw new Error("Cannot Initialize workflow with offline false");
-//		}
-//		this.config.getMode() = SERVER_MODE;
-//	}
-
-//	/**
-//	 * 
-//	 * Constructs a WorkflowInterpreter.
-//	 * 
-//	 * @param engine
-//	 * @param topic
-//	 */
-//	public WorkflowInterpreter(WorkflowInterpreterConfiguration config, WorkflowInterpreterInteractor
interactor) {
-//		this(config, interactor);
-//
-//	}
-
 	/**
 	 * 
 	 * Constructs a WorkflowInterpreter.
@@ -235,18 +139,11 @@ public class WorkflowInterpreter {
 	 * @param subWorkflow
 	 */
 	public WorkflowInterpreter(WorkflowInterpreterConfiguration config, WorkflowInterpreterInteractor
interactor) {
-//		this.engine = engine;
 		this.setConfig(config);
-//		this.isSubWorkflow = subWorkflow;
-//		this.config.getMode() = WorkflowInterpreterConfiguration.GUI_MODE;
 		config.validateNotifier();
-//		this.setTopic(topic);
-//		this.config.isActOnProvenance() = actOnProvenance;
-//		engine.registerWorkflowInterpreter(this);
 		this.interactor=interactor;
 		config.setActOnProvenance(config.getConfiguration().isCollectProvenance());
 		config.setSubWorkflow(false);
-
 	}
 
 	public void setResourceMapping(LeadResourceMapping resourceMapping) {
@@ -254,11 +151,11 @@ public class WorkflowInterpreter {
 	}
 
 	private void notifyViaInteractor(WorkflowExecutionMessage messageType, Object data){
-		interactor.notify(messageType, data);
+		interactor.notify(messageType, config, data);
 	}
 	
 	private Object getInputViaInteractor(WorkflowExecutionMessage messageType, Object data)
throws Exception{
-		return interactor.retrieveData(messageType, data);
+		return interactor.retrieveData(messageType, config, data);
 	}
 	
 	
@@ -291,20 +188,20 @@ public class WorkflowInterpreter {
 			for (int i = 0; i < inputNodes.size(); ++i) {
 				Node node = inputNodes.get(i);
 				NodeController.getGUI(node).setBodyColor(NodeState.FINISHED.color);
-				interactor.notify(WorkflowExecutionMessage.NODE_STATE_CHANGED, null);
+				notifyViaInteractor(WorkflowExecutionMessage.NODE_STATE_CHANGED, null);
 				keywords[i] = ((InputNode) node).getName();
 				values[i] = ((InputNode) node).getDefaultValue();
 			}
 			this.config.getNotifier().workflowStarted(values, keywords);
 			while (this.getWorkflow().getExecutionState() != WorkflowExecutionState.STOPPED) {
 				if (getRemainNodesDynamically() == 0) {
-//					notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
-					if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
-						this.notifyPause();
-					} else {
-						this.getWorkflow().setExecutionState(
-								WorkflowExecutionState.STOPPED);
-					}
+					notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
+//					if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
+//						this.notifyPause();
+//					} else {
+//						this.getWorkflow().setExecutionState(
+//								WorkflowExecutionState.STOPPED);
+//					}
 				}
 				// ok we have paused sleep
 				while (this.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED) {
@@ -397,49 +294,49 @@ public class WorkflowInterpreter {
 				}
 			}
 			this.config.getNotifier().workflowTerminated();
-			if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
-				final WaitDialog waitDialog = new WaitDialog(new Cancelable() {
-					@Override
-					public void cancel() {
-						// Do nothing
-					}
-				}, "Stop Workflow", "Cleaning up resources for Workflow",
-						this.config.getGUI());
-				new Thread(new Runnable() {
-					@Override
-					public void run() {
-						waitDialog.show();
-					}
-				}).start();
-				// Send Notification for output values
-				finish();
-				// Sleep to provide for notification delay
-				try {
-					Thread.sleep(1000);
-				} catch (InterruptedException e) {
-					e.printStackTrace();
-				}
-				cleanup();
-				this.config.getNotifier().cleanup();
-				waitDialog.hide();
-			} else {
-				finish();
-			}
-//			UUID uuid = UUID.randomUUID();
-//			notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_TASK_START, new WorkflowInterpreterInteractor.TaskNotification("Stop
Workflow", "Cleaning up resources for Workflow",uuid.toString()));
-//			// Send Notification for output values
-//			finish();
-//			// Sleep to provide for notification delay
-//			try {
-//				Thread.sleep(1000);
-//			} catch (InterruptedException e) {
-//				e.printStackTrace();
-//			}
-//			cleanup();
-//			if (notifier!=null){
+//			if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
+//				final WaitDialog waitDialog = new WaitDialog(new Cancelable() {
+//					@Override
+//					public void cancel() {
+//						// Do nothing
+//					}
+//				}, "Stop Workflow", "Cleaning up resources for Workflow",
+//						this.config.getGUI());
+//				new Thread(new Runnable() {
+//					@Override
+//					public void run() {
+//						waitDialog.show();
+//					}
+//				}).start();
+//				// Send Notification for output values
+//				finish();
+//				// Sleep to provide for notification delay
+//				try {
+//					Thread.sleep(1000);
+//				} catch (InterruptedException e) {
+//					e.printStackTrace();
+//				}
+//				cleanup();
 //				this.config.getNotifier().cleanup();
+//				waitDialog.hide();
+//			} else {
+//				finish();
 //			}
-//			notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_TASK_END, new WorkflowInterpreterInteractor.TaskNotification("Stop
Workflow", "Cleaning up resources for Workflow",uuid.toString()));
+			UUID uuid = UUID.randomUUID();
+			notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_TASK_START, new WorkflowInterpreterInteractor.TaskNotification("Stop
Workflow", "Cleaning up resources for Workflow",uuid.toString()));
+			// Send Notification for output values
+			finish();
+			// Sleep to provide for notification delay
+			try {
+				Thread.sleep(1000);
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+			}
+			cleanup();
+			if (config.getNotifier()!=null){
+				this.config.getNotifier().cleanup();
+			}
+			notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_TASK_END, new WorkflowInterpreterInteractor.TaskNotification("Stop
Workflow", "Cleaning up resources for Workflow",uuid.toString()));
 
 			this.getWorkflow().setExecutionState(WorkflowExecutionState.NONE);
 		} catch (RuntimeException e) {
@@ -527,34 +424,34 @@ public class WorkflowInterpreter {
 	 * @param e
 	 */
 	public void raiseException(Throwable e) {
-//		notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_ERROR, e);
-//		throw new RuntimeException(e);
-		if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
-			this.config.getGUI().getErrorWindow().error(e);
-		} else {
-			throw new RuntimeException(e);
-		}
+		notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_ERROR, e);
+////		throw new RuntimeException(e);
+//		if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
+//			this.config.getGUI().getErrorWindow().error(e);
+//		} else {
+//			throw new RuntimeException(e);
+//		}
 	}
 
 	/**
      *
      */
 	private void notifyPause() {
-//		if (this.getWorkflow().getExecutionState() != WorkflowExecutionState.RUNNING
-//				&& this.getWorkflow().getExecutionState() != WorkflowExecutionState.STEP) {
-//			throw new WorkflowRuntimeException("Cannot pause when not running");
-//		}
-//		notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
-		if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
-
-			if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.RUNNING
-					|| this.getWorkflow().getExecutionState() == WorkflowExecutionState.STEP) {
-				this.config.getGUI().getToolbar().getPlayAction()
-						.actionPerformed(null);
-			} else {
-				throw new WorkflowRuntimeException("Cannot pause when not running");
-			}
+		if (this.getWorkflow().getExecutionState() != WorkflowExecutionState.RUNNING
+				&& this.getWorkflow().getExecutionState() != WorkflowExecutionState.STEP) {
+			throw new WorkflowRuntimeException("Cannot pause when not running");
 		}
+		notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
+//		if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
+//
+//			if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.RUNNING
+//					|| this.getWorkflow().getExecutionState() == WorkflowExecutionState.STEP) {
+//				this.config.getGUI().getToolbar().getPlayAction()
+//						.actionPerformed(null);
+//			} else {
+//				throw new WorkflowRuntimeException("Cannot pause when not running");
+//			}
+//		}
 	}
 
 	/**
@@ -759,10 +656,10 @@ public class WorkflowInterpreter {
 	}
 
 	private void handleSubWorkComponent(Node node) throws WorkflowException {
-//		notifyViaInteractor(WorkflowExecutionMessage.OPEN_SUBWORKFLOW, node);
-		if ((this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) && (node
instanceof SubWorkflowNodeGUI)) {
-			((SubWorkflowNodeGUI) NodeController.getGUI(node)).openWorkflowTab(this.config.getGUI());
-		}
+		notifyViaInteractor(WorkflowExecutionMessage.OPEN_SUBWORKFLOW, node);
+//		if ((this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) && (node
instanceof SubWorkflowNodeGUI)) {
+//			((SubWorkflowNodeGUI) NodeController.getGUI(node)).openWorkflowTab(this.config.getGUI());
+//		}
 		// setting the inputs
 		Workflow subWorkflow = ((SubWorkflowNode) node).getWorkflow();
 		// List<WSComponentPort> subWorkflowdInputs = new ODEClient()
@@ -829,28 +726,35 @@ public class WorkflowInterpreter {
 			if (gfacURLString.startsWith("https")) {
 				LeadContextHeader leadCtxHeader=null;
 //				try {
-//					leadCtxHeader = (LeadContextHeader)getInputViaInteractor(WorkflowExecutionMessage.INPUT_LEAD_CONTEXT_HEADER,
new WSNodeData(wsNode,this));
+//					leadCtxHeader = (LeadContextHeader)getInputViaInteractor(WorkflowExecutionMessage.INPUT_LEAD_CONTEXT_HEADER,
wsNode);
 //				} catch (Exception e1) {
 //					throw new WorkflowException(e1);
 //				}
 				try {
-					if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
-						leadCtxHeader = XBayaUtil.buildLeadContextHeader(
-								this.getWorkflow(),
-								this.getConfig().getConfiguration(),
-								new MonitorConfiguration(this.getConfig().getConfiguration()
-										.getBrokerURL(), this.config.getTopic(), true,
-										this.getConfig().getConfiguration().getMessageBoxURL()),
-								wsNode.getID(), null);
-					} else {
-						leadCtxHeader = XBayaUtil.buildLeadContextHeader(
-								this.getWorkflow(),
-								this.getConfig().getConfiguration(),
-								new MonitorConfiguration(this.getConfig().getConfiguration()
-										.getBrokerURL(), this.config.getTopic(), true,
-										this.getConfig().getConfiguration().getMessageBoxURL()),
-								wsNode.getID(), null);
-					}
+					leadCtxHeader = XBayaUtil.buildLeadContextHeader(
+							this.getWorkflow(),
+							this.getConfig().getConfiguration(),
+							new MonitorConfiguration(this.getConfig().getConfiguration()
+									.getBrokerURL(), this.config.getTopic(), true,
+									this.getConfig().getConfiguration().getMessageBoxURL()),
+							wsNode.getID(), null);
+//					if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
+//						leadCtxHeader = XBayaUtil.buildLeadContextHeader(
+//								this.getWorkflow(),
+//								this.getConfig().getConfiguration(),
+//								new MonitorConfiguration(this.getConfig().getConfiguration()
+//										.getBrokerURL(), this.config.getTopic(), true,
+//										this.getConfig().getConfiguration().getMessageBoxURL()),
+//								wsNode.getID(), null);
+//					} else {
+//						leadCtxHeader = XBayaUtil.buildLeadContextHeader(
+//								this.getWorkflow(),
+//								this.getConfig().getConfiguration(),
+//								new MonitorConfiguration(this.getConfig().getConfiguration()
+//										.getBrokerURL(), this.config.getTopic(), true,
+//										this.getConfig().getConfiguration().getMessageBoxURL()),
+//								wsNode.getID(), null);
+//					}
 				} catch (URISyntaxException e) {
 					throw new WorkflowException(e);
 				}
@@ -1384,23 +1288,30 @@ public class WorkflowInterpreter {
 			if (gfacURLString.startsWith("https")) {
 				LeadContextHeader leadCtxHeader = null;
 				try {
-					if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
-						leadCtxHeader = XBayaUtil.buildLeadContextHeader(
-								this.getWorkflow(),
-								this.getConfig().getConfiguration(),
-								new MonitorConfiguration(this.getConfig().getConfiguration()
-										.getBrokerURL(), this.config.getTopic(), true,
-										this.getConfig().getConfiguration().getMessageBoxURL()),
-								foreachWSNode.getID(), null);
-					} else {
-						leadCtxHeader = XBayaUtil.buildLeadContextHeader(
-								this.getWorkflow(),
-								this.getConfig().getConfiguration(),
-								new MonitorConfiguration(this.getConfig().getConfiguration()
-										.getBrokerURL(), this.config.getTopic(), true,
-										this.getConfig().getConfiguration().getMessageBoxURL()),
-								foreachWSNode.getID(), null);
-					}
+					leadCtxHeader = XBayaUtil.buildLeadContextHeader(
+							this.getWorkflow(),
+							this.getConfig().getConfiguration(),
+							new MonitorConfiguration(this.getConfig().getConfiguration()
+									.getBrokerURL(), this.config.getTopic(), true,
+									this.getConfig().getConfiguration().getMessageBoxURL()),
+							foreachWSNode.getID(), null);
+//					if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
+//						leadCtxHeader = XBayaUtil.buildLeadContextHeader(
+//								this.getWorkflow(),
+//								this.getConfig().getConfiguration(),
+//								new MonitorConfiguration(this.getConfig().getConfiguration()
+//										.getBrokerURL(), this.config.getTopic(), true,
+//										this.getConfig().getConfiguration().getMessageBoxURL()),
+//								foreachWSNode.getID(), null);
+//					} else {
+//						leadCtxHeader = XBayaUtil.buildLeadContextHeader(
+//								this.getWorkflow(),
+//								this.getConfig().getConfiguration(),
+//								new MonitorConfiguration(this.getConfig().getConfiguration()
+//										.getBrokerURL(), this.config.getTopic(), true,
+//										this.getConfig().getConfiguration().getMessageBoxURL()),
+//								foreachWSNode.getID(), null);
+//					}
 				} catch (URISyntaxException e) {
 					throw new WorkflowException(e);
 				}
@@ -1819,14 +1730,14 @@ public class WorkflowInterpreter {
 			}
 		}
 
-
-		if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
-			ArrayList<Node> waitingNodes = InterpreterUtil.getWaitingNodesDynamically(this.getGraph());
-			for (Node readyNode : waitingNodes) {
-				DifferedInputHandler.handleDifferredInputsofDependentNodes(
-						readyNode, config.getGUI());
-			}
-		}
+		notifyViaInteractor(WorkflowExecutionMessage.HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS, this.getGraph());
+//		if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
+//			ArrayList<Node> waitingNodes = InterpreterUtil.getWaitingNodesDynamically(this.getGraph());
+//			for (Node readyNode : waitingNodes) {
+//				DifferedInputHandler.handleDifferredInputsofDependentNodes(
+//						readyNode, config.getGUI());
+//			}
+//		}
 
 		return list;
 
@@ -1836,46 +1747,10 @@ public class WorkflowInterpreter {
 		return this.config.getWorkflow();
 	}
 
-//	public void setActOnProvenance(boolean actOnProvenance) {
-//		this.config.isActOnProvenance() = actOnProvenance;
-//	}
-
 	public void setProvenanceWriter(PredicatedTaskRunner provenanceWriter) {
 		this.provenanceWriter = provenanceWriter;
 	}
 
-//    public void setGfacEmbeddedMode(Boolean gfacEmbeddedMode) {
-//        this.gfacEmbeddedMode = gfacEmbeddedMode;
-//    }
-//
-//    public Boolean getGfacEmbeddedMode() {
-//        return gfacEmbeddedMode;
-//    }
-
-//	public String getUsername() {
-//		return username;
-//	}
-//
-//	public void setUsername(String username) {
-//		this.username = username;
-//	}
-//
-//	public String getPassword() {
-//		return password;
-//	}
-//
-//	public void setPassword(String password) {
-//		this.password = password;
-//	}
-
-//	public String getTopic() {
-//		return topic;
-//	}
-//
-//	public void setTopic(String topic) {
-//		this.topic = topic;
-//	}
-
 	public WorkflowInterpreterConfiguration getConfig() {
 		return config;
 	}

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java?rev=1351927&r1=1351926&r2=1351927&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java
Wed Jun 20 03:02:57 2012
@@ -163,9 +163,9 @@ public class WorkflowInterpreterConfigur
 		this.topic = topic;
 	}
 
-	public int getMode() {
-		return getMonitor()==null? SERVER_MODE:GUI_MODE;
-	}
+//	public int getMode() {
+//		return getMonitor()==null? SERVER_MODE:GUI_MODE;
+//	}
 
 	public boolean isGfacEmbeddedMode() {
 		return gfacEmbeddedMode;

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java?rev=1351927&r1=1351926&r2=1351927&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java
Wed Jun 20 03:02:57 2012
@@ -32,8 +32,8 @@ import org.apache.airavata.xbaya.jython.
 import xsul.wsdl.WsdlDefinitions;
 
 public interface WorkflowInterpreterInteractor {
-	public boolean notify(WorkflowExecutionMessage messageType, Object data);
-	public Object retrieveData(WorkflowExecutionMessage messageType, Object data) throws Exception;
+	public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration
config, Object data);
+	public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration
config, Object data) throws Exception;
 	public static class TaskNotification{
 		String messageTitle;
 		String message;



Mime
View raw message