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 2013/01/07 23:08:54 UTC

svn commit: r1430053 - in /airavata/trunk/modules: airavata-client/src/main/java/org/apache/airavata/client/ airavata-client/src/main/java/org/apache/airavata/client/api/ airavata-client/src/main/java/org/apache/airavata/client/impl/ integration-tests/...

Author: samindaw
Date: Mon Jan  7 22:08:54 2013
New Revision: 1430053

URL: http://svn.apache.org/viewvc?rev=1430053&view=rev
Log:
motnitor listener udpate/refact + execution manager api improvement

Added:
    airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListener.java
      - copied, changed from r1429941, airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java
    airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java   (contents, props changed)
      - copied, changed from r1429941, airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListenerAdapter.java
    airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java   (with props)
Removed:
    airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListenerAdapter.java
Modified:
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java
    airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java
    airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataRepository.java

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java?rev=1430053&r1=1430052&r2=1430053&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java Mon Jan  7 22:08:54 2013
@@ -21,16 +21,12 @@
 
 package org.apache.airavata.client;
 
-import java.io.IOException;
-import java.net.MalformedURLException;
 import java.net.URI;
-import java.util.Map;
 
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.AiravataAPIInvocationException;
 import org.apache.airavata.client.impl.PasswordCallBackImpl;
 import org.apache.airavata.registry.api.PasswordCallback;
-import org.apache.airavata.registry.api.exception.RegistryException;
 
 public class AiravataAPIFactory {
 	

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java?rev=1430053&r1=1430052&r2=1430053&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java Mon Jan  7 22:08:54 2013
@@ -27,7 +27,7 @@ import org.apache.airavata.common.workfl
 import org.apache.airavata.workflow.model.wf.Workflow;
 import org.apache.airavata.workflow.model.wf.WorkflowInput;
 import org.apache.airavata.ws.monitor.Monitor;
-import org.apache.airavata.ws.monitor.MonitorEventListener;
+import org.apache.airavata.ws.monitor.EventDataListener;
 
 public interface ExecutionManager {
     /**
@@ -49,6 +49,16 @@ public interface ExecutionManager {
      */
 	public String runExperiment(String workflow,List<WorkflowInput> inputs, ExperimentAdvanceOptions options) throws AiravataAPIInvocationException;
 
+    /**
+     * Run an experiment containing single workflow with custom settings for the experiment & listen 
+     * for notification events 
+     * @param workflow - Workflow template Id or Workflow Graph XML
+     * @param inputs
+     * @param options
+     * @return
+     * @throws AiravataAPIInvocationException
+     */
+	public String runExperiment(String workflow,List<WorkflowInput> inputs, ExperimentAdvanceOptions options, EventDataListener listener) throws AiravataAPIInvocationException;
 	
     /**
      * Run an experiment containing single workflow
@@ -126,7 +136,7 @@ public interface ExecutionManager {
      * @return
      * @throws AiravataAPIInvocationException
      */
-	public Monitor getExperimentMonitor(String experimentId, MonitorEventListener listener) throws AiravataAPIInvocationException;
+	public Monitor getExperimentMonitor(String experimentId, EventDataListener listener) throws AiravataAPIInvocationException;
 	
 	/**
 	 * @deprecated

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java?rev=1430053&r1=1430052&r2=1430053&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java Mon Jan  7 22:08:54 2013
@@ -53,8 +53,8 @@ import org.apache.airavata.ws.monitor.Ev
 import org.apache.airavata.ws.monitor.EventDataRepository;
 import org.apache.airavata.ws.monitor.Monitor;
 import org.apache.airavata.ws.monitor.MonitorConfiguration;
-import org.apache.airavata.ws.monitor.MonitorEventListener;
-import org.apache.airavata.ws.monitor.MonitorEventListenerAdapter;
+import org.apache.airavata.ws.monitor.EventDataListener;
+import org.apache.airavata.ws.monitor.EventDataListenerAdapter;
 import org.apache.airavata.ws.monitor.MonitorUtil.EventType;
 import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
 import org.apache.axis2.AxisFault;
@@ -77,7 +77,7 @@ public class ExecutionManagerImpl implem
 	public String runExperiment(String workflow,
 			List<WorkflowInput> inputs, ExperimentAdvanceOptions options)
 			throws AiravataAPIInvocationException {
-		return runWorkflow(workflow, inputs, options);
+		return runExperimentGeneral(extractWorkflow(workflow), inputs, options, null);
 	}
 	
 
@@ -108,7 +108,7 @@ public class ExecutionManagerImpl implem
 	@Override
 	public void waitForExperimentTermination(String experimentId)
 			throws AiravataAPIInvocationException {
-		Monitor experimentMonitor = getExperimentMonitor(experimentId, new MonitorEventListenerAdapter() {
+		Monitor experimentMonitor = getExperimentMonitor(experimentId, new EventDataListenerAdapter() {
 			@Override
 			public void notify(EventDataRepository eventDataRepo,
 					EventData eventData) {
@@ -137,7 +137,7 @@ public class ExecutionManagerImpl implem
 	}
 
 	@Override
-	public Monitor getExperimentMonitor(String experimentId,MonitorEventListener listener)
+	public Monitor getExperimentMonitor(String experimentId,final EventDataListener listener)
 			throws AiravataAPIInvocationException {
 		MonitorConfiguration monitorConfiguration;
 		try {
@@ -146,111 +146,40 @@ public class ExecutionManagerImpl implem
 					true, getClient().getClientConfiguration().getMessageboxURL().toURI());
 			final Monitor monitor = new Monitor(monitorConfiguration);
 			monitor.printRawMessage(false);
-			monitor.getEventDataRepository().registerEventListener(listener);
-			listener.setExperimentMonitor(monitor);
+			if (listener!=null) {
+				monitor.getEventDataRepository().registerEventListener(listener);
+				listener.setExperimentMonitor(monitor);
+			}
+			if (!monitor.getExperimentId().equals(">")){
+				monitor.getEventDataRepository().registerEventListener(new EventDataListenerAdapter() {
+					@Override
+					public void notify(EventDataRepository eventDataRepo, EventData eventData) {
+						if (eventData.getType()==EventType.WORKFLOW_TERMINATED || eventData.getType()==EventType.SENDING_FAULT){
+							monitor.stopMonitoring();
+						} 
+					}
+				});
+			}
 			return monitor;
 		} catch (URISyntaxException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
 	}
 
-	//------------------Deprecated Functions---------------------//
-	
-	@Override
-	public String runExperiment(String workflowTemplateId,
-			List<WorkflowInput> inputs, String user, String metadata, String workflowInstanceName)
-			throws AiravataAPIInvocationException {
-		ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowInstanceName, user, metadata);
-		return runExperiment(workflowTemplateId, inputs, options);
-
-	}
-
-	@Override
-	public String runExperiment(Workflow workflow, List<WorkflowInput> inputs,
-			String user, String metadata) throws AiravataAPIInvocationException {
-		ExperimentAdvanceOptions options=createExperimentAdvanceOptions(workflow.getName()+"_"+Calendar.getInstance().getTime().toString(), user, metadata);
-		return runExperiment(workflow,inputs,options);
-	}
-	
-	@Override
-	public String runExperiment(String workflowTemplateId,
-			List<WorkflowInput> inputs, String user, String metadata,
-			String workflowInstanceName, WorkflowContextHeaderBuilder builder)
-			throws AiravataAPIInvocationException {
-		ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowInstanceName, user, metadata);
-		ApplicationSchedulingContext[] nodeSchedules = builder.getWorkflowSchedulingContext().getApplicationSchedulingContextArray();
-		for (ApplicationSchedulingContext context : nodeSchedules) {
-			NodeSettings nodeSettings = options.getCustomWorkflowSchedulingSettings().addNewNodeSettings(context.getWorkflowNodeId());
-			if (context.isSetServiceId()) nodeSettings.setServiceId(context.getServiceId());
-			if (context.isSetGatekeeperEpr()) nodeSettings.getHostSettings().setGatekeeperEPR(context.getGatekeeperEpr());
-			if (context.isSetHostName()) nodeSettings.getHostSettings().setHostId(context.getHostName());
-			if (context.isSetWsgramPreferred()) nodeSettings.getHostSettings().setWSGramPreffered(context.getWsgramPreferred());
-			if (context.isSetCpuCount()) nodeSettings.getHPCSettings().setCPUCount(context.getCpuCount());
-			if (context.isSetJobManager()) nodeSettings.getHPCSettings().setJobManager(context.getJobManager());
-			if (context.isSetMaxWallTime()) nodeSettings.getHPCSettings().setMaxWallTime(context.getMaxWallTime());
-			if (context.isSetNodeCount()) nodeSettings.getHPCSettings().setNodeCount(context.getNodeCount());
-			if (context.isSetQueueName()) nodeSettings.getHPCSettings().setQueueName(context.getQueueName());
-		}
-		ApplicationOutputDataHandling[] dataHandlingSettings = builder.getWorkflowOutputDataHandling().getApplicationOutputDataHandlingArray();
-		for (ApplicationOutputDataHandling handling : dataHandlingSettings) {
-			options.getCustomWorkflowOutputDataSettings().addNewOutputDataSettings(handling.getOutputDataDirectory(),handling.getDataRegistryUrl(),handling.getDataPersistance());
-		}
-		//TODO rest of the builder configurations as they are added to the experiment options
-		return runExperiment(workflowTemplateId, inputs, options);
-	}
-	
-
-	@Override
-	public WorkflowContextHeaderBuilder createWorkflowContextHeader()
-			throws AiravataAPIInvocationException {
-		try {
-			return new WorkflowContextHeaderBuilder(null,
-					null,null,null,null,
-					null);
-		} catch (Exception e) {
-			throw new AiravataAPIInvocationException(e);
-		}
-	}
-
 	@Override
-	public String runExperiment(String workflowName,
-			List<WorkflowInput> inputs, String user, String metadata,
-			String workflowInstanceName, String experimentName)
+	public String runExperiment(String workflow, List<WorkflowInput> inputs,
+			ExperimentAdvanceOptions options, EventDataListener listener)
 			throws AiravataAPIInvocationException {
-		ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowInstanceName, user, metadata);
-		options.setCustomExperimentId(experimentName);
-		return runExperiment(workflowName, inputs, options);
+		return runExperimentGeneral(extractWorkflow(workflow), inputs, options, listener);
 	}
 	
-	//------------------End of Deprecated Functions---------------------//
-
 	public AiravataClient getClient() {
 		return client;
 	}
 	public void setClient(AiravataClient client) {
 		this.client = client;
 	}
-
-	private String runWorkflow(String workflowName, List<WorkflowInput> inputs, ExperimentAdvanceOptions options) throws AiravataAPIInvocationException {
-		return runExperimentGeneral(extractWorkflow(workflowName), inputs, options, null).toString();
-	}
-	
-    private Workflow extractWorkflow(String workflowName) throws AiravataAPIInvocationException {
-        Workflow workflowObj = null;
-        //FIXME - There should be a better way to figure-out if the passed string is a name or an xml
-        if(!workflowName.contains("http://airavata.apache.org/xbaya/xwf")){//(getClient().getWorkflowManager().isWorkflowExists(workflowName)) {
-            workflowObj = getClient().getWorkflowManager().getWorkflow(workflowName);
-        }else {
-            try{
-                workflowObj = getClient().getWorkflowManager().getWorkflowFromString(workflowName);
-            }catch (AiravataAPIInvocationException e){
-            	getClient().getWorkflowManager().getWorkflow(workflowName);
-            }
-        }
-        return workflowObj;
-    }
-    
-	private Object runExperimentGeneral(Workflow workflowObj, List<WorkflowInput> inputs, ExperimentAdvanceOptions options, MonitorEventListener listener) throws AiravataAPIInvocationException {
+	private String runExperimentGeneral(Workflow workflowObj, List<WorkflowInput> inputs, ExperimentAdvanceOptions options, EventDataListener listener) throws AiravataAPIInvocationException {
 		try {
 			String workflowString = XMLUtil.xmlElementToString(workflowObj.toXML());
 			List<WSComponentPort> ports = getWSComponentPortInputs(workflowObj);
@@ -298,16 +227,11 @@ public class ExecutionManagerImpl implem
 			}
 			runPreWorkflowExecutionTasks(experimentID, executionUser, options.getExperimentMetadata(), options.getExperimentName());
 			NameValue[] inputVals = inputValues.toArray(new NameValue[] {});
-			Monitor monitorObj=null;
 			if (listener!=null){
-				monitorObj=getExperimentMonitor(experimentID, listener);
+				getExperimentMonitor(experimentID, listener).startMonitoring();
 			}
 			launchWorkflow(experimentID, workflowString, inputVals, builder);
-			if (listener==null){
-				return experimentID;	
-			}else{
-				return monitorObj;
-			}
+			return experimentID;	
 		}  catch (GraphException e) {
 			throw new AiravataAPIInvocationException(e);
 		} catch (ComponentException e) {
@@ -316,6 +240,25 @@ public class ExecutionManagerImpl implem
 	        throw new AiravataAPIInvocationException("Error working with Airavata Registry: " + e.getLocalizedMessage(), e);
 	    }
 	}
+
+//	private String runWorkflow(String workflowName, List<WorkflowInput> inputs, ExperimentAdvanceOptions options) throws AiravataAPIInvocationException {
+//		return runExperimentGeneral(extractWorkflow(workflowName), inputs, options, null);
+//	}
+	
+    private Workflow extractWorkflow(String workflowName) throws AiravataAPIInvocationException {
+        Workflow workflowObj = null;
+        //FIXME - There should be a better way to figure-out if the passed string is a name or an xml
+        if(!workflowName.contains("http://airavata.apache.org/xbaya/xwf")){//(getClient().getWorkflowManager().isWorkflowExists(workflowName)) {
+            workflowObj = getClient().getWorkflowManager().getWorkflow(workflowName);
+        }else {
+            try{
+                workflowObj = getClient().getWorkflowManager().getWorkflowFromString(workflowName);
+            }catch (AiravataAPIInvocationException e){
+            	getClient().getWorkflowManager().getWorkflow(workflowName);
+            }
+        }
+        return workflowObj;
+    }
     
 	private List<WSComponentPort> getWSComponentPortInputs(Workflow workflow)
 			throws GraphException, ComponentException {
@@ -366,4 +309,74 @@ public class ExecutionManagerImpl implem
 		getClient().getProvenanceManager().setExperimentName(experimentId, experimentName);
 	}
 
+	//------------------Deprecated Functions---------------------//
+	
+	@Override
+	public String runExperiment(String workflowTemplateId,
+			List<WorkflowInput> inputs, String user, String metadata, String workflowInstanceName)
+			throws AiravataAPIInvocationException {
+		ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowInstanceName, user, metadata);
+		return runExperiment(workflowTemplateId, inputs, options);
+
+	}
+
+	@Override
+	public String runExperiment(Workflow workflow, List<WorkflowInput> inputs,
+			String user, String metadata) throws AiravataAPIInvocationException {
+		ExperimentAdvanceOptions options=createExperimentAdvanceOptions(workflow.getName()+"_"+Calendar.getInstance().getTime().toString(), user, metadata);
+		return runExperiment(workflow,inputs,options);
+	}
+	
+	@Override
+	public String runExperiment(String workflowTemplateId,
+			List<WorkflowInput> inputs, String user, String metadata,
+			String workflowInstanceName, WorkflowContextHeaderBuilder builder)
+			throws AiravataAPIInvocationException {
+		ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowInstanceName, user, metadata);
+		ApplicationSchedulingContext[] nodeSchedules = builder.getWorkflowSchedulingContext().getApplicationSchedulingContextArray();
+		for (ApplicationSchedulingContext context : nodeSchedules) {
+			NodeSettings nodeSettings = options.getCustomWorkflowSchedulingSettings().addNewNodeSettings(context.getWorkflowNodeId());
+			if (context.isSetServiceId()) nodeSettings.setServiceId(context.getServiceId());
+			if (context.isSetGatekeeperEpr()) nodeSettings.getHostSettings().setGatekeeperEPR(context.getGatekeeperEpr());
+			if (context.isSetHostName()) nodeSettings.getHostSettings().setHostId(context.getHostName());
+			if (context.isSetWsgramPreferred()) nodeSettings.getHostSettings().setWSGramPreffered(context.getWsgramPreferred());
+			if (context.isSetCpuCount()) nodeSettings.getHPCSettings().setCPUCount(context.getCpuCount());
+			if (context.isSetJobManager()) nodeSettings.getHPCSettings().setJobManager(context.getJobManager());
+			if (context.isSetMaxWallTime()) nodeSettings.getHPCSettings().setMaxWallTime(context.getMaxWallTime());
+			if (context.isSetNodeCount()) nodeSettings.getHPCSettings().setNodeCount(context.getNodeCount());
+			if (context.isSetQueueName()) nodeSettings.getHPCSettings().setQueueName(context.getQueueName());
+		}
+		ApplicationOutputDataHandling[] dataHandlingSettings = builder.getWorkflowOutputDataHandling().getApplicationOutputDataHandlingArray();
+		for (ApplicationOutputDataHandling handling : dataHandlingSettings) {
+			options.getCustomWorkflowOutputDataSettings().addNewOutputDataSettings(handling.getOutputDataDirectory(),handling.getDataRegistryUrl(),handling.getDataPersistance());
+		}
+		//TODO rest of the builder configurations as they are added to the experiment options
+		return runExperiment(workflowTemplateId, inputs, options);
+	}
+	
+
+	@Override
+	public WorkflowContextHeaderBuilder createWorkflowContextHeader()
+			throws AiravataAPIInvocationException {
+		try {
+			return new WorkflowContextHeaderBuilder(null,
+					null,null,null,null,
+					null);
+		} catch (Exception e) {
+			throw new AiravataAPIInvocationException(e);
+		}
+	}
+
+	@Override
+	public String runExperiment(String workflowName,
+			List<WorkflowInput> inputs, String user, String metadata,
+			String workflowInstanceName, String experimentName)
+			throws AiravataAPIInvocationException {
+		ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowInstanceName, user, metadata);
+		options.setCustomExperimentId(experimentName);
+		return runExperiment(workflowName, inputs, options);
+	}
+	
+	//------------------End of Deprecated Functions---------------------//
+
 }

Modified: airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java?rev=1430053&r1=1430052&r2=1430053&view=diff
==============================================================================
--- airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java (original)
+++ airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java Mon Jan  7 22:08:54 2013
@@ -11,7 +11,7 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.ws.monitor.Monitor;
 import org.apache.airavata.ws.monitor.EventData;
 import org.apache.airavata.ws.monitor.EventDataRepository;
-import org.apache.airavata.ws.monitor.MonitorEventListener;
+import org.apache.airavata.ws.monitor.EventDataListener;
 import org.apache.airavata.ws.monitor.MonitorUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Monitor class for integration tests.
  */
-public class TestMonitorListener implements MonitorEventListener {
+public class TestMonitorListener implements EventDataListener {
 
     private static final Logger log = LoggerFactory.getLogger(BaseCaseIT.class);
 
@@ -96,4 +96,12 @@ public class TestMonitorListener impleme
 	public void monitoringPostStop() {
 	}
 
+	@Override
+	public void onFail(EventData failNotification) {
+	}
+
+	@Override
+	public void onCompletion(EventData completionNotification) {
+	}
+
 }

Copied: airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListener.java (from r1429941, airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java)
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListener.java?p2=airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListener.java&p1=airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java&r1=1429941&r2=1430053&rev=1430053&view=diff
==============================================================================
--- airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java (original)
+++ airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListener.java Mon Jan  7 22:08:54 2013
@@ -21,7 +21,7 @@
 
 package org.apache.airavata.ws.monitor;
 
-public interface MonitorEventListener {
+public interface EventDataListener {
 	
 	/**
 	 * Gets triggered when a new message is received relevant for the experiment subscribed to
@@ -55,4 +55,14 @@ public interface MonitorEventListener {
 	 * Gets triggered just after the experiment monitoring is stopped
 	 */
 	public void monitoringPostStop();
+	
+	/**
+	 * Gets triggered when experiment fails
+	 */
+	public void onFail(EventData failNotification);
+	
+	/**
+	 * Gets triggered when the experiment completes
+	 */
+	public void onCompletion(EventData completionNotification);
 }

Copied: airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java (from r1429941, airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListenerAdapter.java)
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java?p2=airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java&p1=airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListenerAdapter.java&r1=1429941&r2=1430053&rev=1430053&view=diff
==============================================================================
--- airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListenerAdapter.java (original)
+++ airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java Mon Jan  7 22:08:54 2013
@@ -21,7 +21,7 @@
 
 package org.apache.airavata.ws.monitor;
 
-public abstract class MonitorEventListenerAdapter implements MonitorEventListener {
+public abstract class EventDataListenerAdapter implements EventDataListener {
 	private Monitor monitor;
 	
 	@Override
@@ -48,7 +48,7 @@ public abstract class MonitorEventListen
 	public void monitoringPostStop() {
 		//Nothing to do
 	}
-
+	
 	protected Monitor getMonitor() {
 		return monitor;
 	}
@@ -57,4 +57,14 @@ public abstract class MonitorEventListen
 		this.monitor = monitor;
 	}
 
+	@Override
+	public void onFail(EventData failNotification) {
+		//Nothing to do
+	}
+
+	@Override
+	public void onCompletion(EventData completionNotification) {
+		//Nothing to do
+	}
+
 }

Propchange: airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataRepository.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataRepository.java?rev=1430053&r1=1430052&r2=1430053&view=diff
==============================================================================
--- airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataRepository.java (original)
+++ airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataRepository.java Mon Jan  7 22:08:54 2013
@@ -32,6 +32,7 @@ import javax.swing.event.TableModelEvent
 import javax.swing.event.TableModelListener;
 import javax.swing.table.TableModel;
 
+import org.apache.airavata.ws.monitor.MonitorUtil.EventType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xmlpull.infoset.XmlElement;
@@ -89,7 +90,7 @@ public class EventDataRepository impleme
 
     private EventFilter filter;
 
-    private List<MonitorEventListener> monitorEventListerners;
+    private List<EventDataListener> monitorEventListerners;
 
     /**
      * 
@@ -142,7 +143,7 @@ public class EventDataRepository impleme
 
     }
     public void triggerListenerForPreMonitorStart() {
-		for (MonitorEventListener listener : getMonitorEventListerners()) {
+		for (EventDataListener listener : getMonitorEventListerners()) {
 			try {
 				listener.monitoringPreStart();
 			} catch (Exception e) {
@@ -153,7 +154,7 @@ public class EventDataRepository impleme
 	}
     
     public void triggerListenerForPostMonitorStart() {
-		for (MonitorEventListener listener : getMonitorEventListerners()) {
+		for (EventDataListener listener : getMonitorEventListerners()) {
 			try {
 				listener.monitoringPostStart();
 			} catch (Exception e) {
@@ -164,7 +165,7 @@ public class EventDataRepository impleme
 	}
     
     public void triggerListenerForPreMonitorStop() {
-		for (MonitorEventListener listener : getMonitorEventListerners()) {
+		for (EventDataListener listener : getMonitorEventListerners()) {
 			try {
 				listener.monitoringPreStop();
 			} catch (Exception e) {
@@ -175,7 +176,7 @@ public class EventDataRepository impleme
 	}
     
     public void triggerListenerForPostMonitorStop() {
-		for (MonitorEventListener listener : getMonitorEventListerners()) {
+		for (EventDataListener listener : getMonitorEventListerners()) {
 			try {
 				listener.monitoringPostStop();
 			} catch (Exception e) {
@@ -185,9 +186,14 @@ public class EventDataRepository impleme
 		}
 	}
 	private void triggerListenerForMonitorEvent(EventData event) {
-		for (MonitorEventListener listener : getMonitorEventListerners()) {
+		for (EventDataListener listener : getMonitorEventListerners()) {
 			try {
 				listener.notify(this, event);
+				if (event.getType()==EventType.WORKFLOW_TERMINATED){
+					listener.onCompletion(event);
+				}else if (event.getType()==EventType.SENDING_FAULT){
+					listener.onFail(event);
+				}
 			} catch (Exception e) {
 				//just in case
 				e.printStackTrace();
@@ -475,20 +481,20 @@ public class EventDataRepository impleme
             listener.stateChanged(this.tableModelChangeEvent);
         }
     }
-	private List<MonitorEventListener> getMonitorEventListerners() {
+	private List<EventDataListener> getMonitorEventListerners() {
 		if (monitorEventListerners==null){
-			monitorEventListerners=new ArrayList<MonitorEventListener>();
+			monitorEventListerners=new ArrayList<EventDataListener>();
 		}
 		return monitorEventListerners;
 	}
 
-	public void registerEventListener(MonitorEventListener listener){
+	public void registerEventListener(EventDataListener listener){
 		if (listener!=null) {
 			getMonitorEventListerners().add(listener);
 		}
 	}
 	
-	public void unregisterEventListener(MonitorEventListener listener){
+	public void unregisterEventListener(EventDataListener listener){
 		if (getMonitorEventListerners().contains(listener)) {
 			getMonitorEventListerners().remove(listener);
 		}

Added: airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java?rev=1430053&view=auto
==============================================================================
--- airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java (added)
+++ airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java Mon Jan  7 22:08:54 2013
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.ws.monitor;
+
+/**
+ * @deprecated - Use <code>EventDataListener</code> instead
+ * @author samindaw
+ *
+ */
+public interface MonitorEventListener extends EventDataListener {
+
+}

Propchange: airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain