airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [6/7] moving common monitoring classes to gfac-core
Date Mon, 05 May 2014 16:00:14 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java
new file mode 100644
index 0000000..ce31acd
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java
@@ -0,0 +1,87 @@
+/*
+ *
+ * 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.gfac.core.handler;
+
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.gfac.Constants;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+
+public class AppDescriptorCheckHandler implements GFacHandler {
+    private static final Logger logger = LoggerFactory.getLogger(AppDescriptorCheckHandler.class);
+
+    public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
+        logger.info("Invoking ApplicationDescriptorCheckHandler ...");
+        ApplicationDescription app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
+        ApplicationDeploymentDescriptionType appDesc = app.getType();
+        if (appDesc.getScratchWorkingDirectory() == null) {
+            appDesc.setScratchWorkingDirectory("/tmp");
+        }
+
+        /*
+        * Working dir
+        */
+        if (appDesc.getStaticWorkingDirectory() == null || "null".equals(appDesc.getStaticWorkingDirectory())) {
+            String date = new Date().toString();
+            date = date.replaceAll(" ", "_");
+            date = date.replaceAll(":", "_");
+
+            String tmpDir = appDesc.getScratchWorkingDirectory() + File.separator
+                    + jobExecutionContext.getServiceName() + "_" + date + "_" + UUID.randomUUID();
+
+            appDesc.setStaticWorkingDirectory(tmpDir);
+        }
+        //FIXME: Move this input/output to application descrpitor 
+        /*
+        * Input and Output Directory
+        */
+        if (appDesc.getInputDataDirectory() == null || "".equals(appDesc.getInputDataDirectory())) {
+            appDesc.setInputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + Constants.INPUT_DATA_DIR_VAR_NAME);
+        }
+        if (appDesc.getOutputDataDirectory() == null || "".equals(appDesc.getOutputDataDirectory())) {
+            appDesc.setOutputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + Constants.OUTPUT_DATA_DIR_VAR_NAME);
+        }
+
+        /*
+        * Stdout and Stderr for Shell
+        */
+        if (appDesc.getStandardOutput() == null || "".equals(appDesc.getStandardOutput())) {
+            appDesc.setStandardOutput(appDesc.getStaticWorkingDirectory() + File.separator
+                    + appDesc.getApplicationName().getStringValue() + ".stdout");
+        }
+        if (appDesc.getStandardError() == null || "".equals(appDesc.getStandardError())) {
+            appDesc.setStandardError(appDesc.getStaticWorkingDirectory() + File.separator
+                    + appDesc.getApplicationName().getStringValue() + ".stderr");
+        }
+        jobExecutionContext.getApplicationContext().setApplicationDeploymentDescription(app);
+    }
+
+    public void initProperties(Map<String, String> properties) throws GFacHandlerException {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandler.java
new file mode 100644
index 0000000..0719f61
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandler.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.gfac.core.handler;
+
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+
+import java.util.Map;
+
+public interface GFacHandler {
+
+    public void initProperties(Map<String, String> properties) throws GFacHandlerException;
+
+    public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException;
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerConfig.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerConfig.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerConfig.java
new file mode 100644
index 0000000..d5fa418
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerConfig.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * 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.gfac.core.handler;
+
+import java.util.Map;
+
+public class GFacHandlerConfig {
+
+    public GFacHandlerConfig(Map<String, String> properties, String className) {
+        this.properties = properties;
+        this.className = className;
+    }
+
+    private Map<String,String> properties;
+
+    private String className;
+
+    public void setProperties(Map<String, String> properties) {
+        this.properties = properties;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public Map<String, String> getProperties() {
+        return properties;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerException.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerException.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerException.java
new file mode 100644
index 0000000..cb5439b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/GFacHandlerException.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * 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.gfac.core.handler;
+
+import org.apache.airavata.gfac.GFacException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GFacHandlerException extends GFacException {
+    private static final Logger log = LoggerFactory.getLogger(GFacHandlerException.class);
+
+    public GFacHandlerException(String message) {
+        super(message, new Throwable(message));
+        log.error(message);
+    }
+
+    public GFacHandlerException(String s, Throwable throwable) {
+        super(s, throwable);
+        log.error(s,throwable);
+    }
+
+    public GFacHandlerException(String message, Exception e, String... additionExceptiondata) {
+        super(message, e);
+        log.error(message,e);
+    }
+    public GFacHandlerException(Exception e) {
+        super(e);
+        log.error(e.getMessage(),e);
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/ThreadedHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/ThreadedHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/ThreadedHandler.java
new file mode 100644
index 0000000..0dcf568
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/ThreadedHandler.java
@@ -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.gfac.core.handler;
+
+/**
+ * This handler can be used to run in a separate thread in handler chain or as a daemon
+ * for the gfac instance you are running. If this is configured as another
+ * handler in the execution chain this will get invoked in asynchronous mode in a separate
+ * thread for each request, so you have to make sure the thread is returning properly.
+ */
+public abstract class ThreadedHandler extends AbstractHandler implements Runnable{
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AbstractActivityListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AbstractActivityListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AbstractActivityListener.java
new file mode 100644
index 0000000..d642154
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AbstractActivityListener.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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.gfac.core.monitor;
+
+
+public interface AbstractActivityListener {
+	public void setup(Object... configurations);
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataExperimentStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataExperimentStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataExperimentStatusUpdator.java
new file mode 100644
index 0000000..f265503
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataExperimentStatusUpdator.java
@@ -0,0 +1,80 @@
+/*
+ *
+ * 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.gfac.core.monitor;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.monitor.state.ExperimentStatusChangeRequest;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+
+public class AiravataExperimentStatusUpdator implements AbstractActivityListener {
+    private final static Logger logger = LoggerFactory.getLogger(AiravataExperimentStatusUpdator.class);
+
+    private Registry airavataRegistry;
+
+    public Registry getAiravataRegistry() {
+        return airavataRegistry;
+    }
+
+    public void setAiravataRegistry(Registry airavataRegistry) {
+        this.airavataRegistry = airavataRegistry;
+    }
+
+    @Subscribe
+    public void updateRegistry(ExperimentStatusChangeRequest experimentStatus) {
+        ExperimentState state = experimentStatus.getState();
+        if (state != null) {
+            try {
+                String experimentID = experimentStatus.getIdentity().getExperimentID();
+                updateExperimentStatus(experimentID, state);
+            } catch (Exception e) {
+                logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+            }
+        }
+    }
+
+    public  void updateExperimentStatus(String experimentId, ExperimentState state) throws Exception {
+    	Experiment details = (Experiment)airavataRegistry.get(DataType.EXPERIMENT, experimentId);
+        if(details == null) {
+            details = new Experiment();
+            details.setExperimentID(experimentId);
+        }
+        org.apache.airavata.model.workspace.experiment.ExperimentStatus status = new org.apache.airavata.model.workspace.experiment.ExperimentStatus();
+        status.setExperimentState(state);
+        status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+        details.setExperimentStatus(status);
+        airavataRegistry.update(DataType.EXPERIMENT, details, experimentId);
+    }
+
+	public void setup(Object... configurations) {
+		for (Object configuration : configurations) {
+			if (configuration instanceof Registry){
+				this.airavataRegistry=(Registry)configuration;
+			} 
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
new file mode 100644
index 0000000..aaf7084
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java
@@ -0,0 +1,145 @@
+/*
+ *
+ * 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.gfac.core.monitor;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.core.monitor.state.TaskStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
+import org.apache.airavata.model.workspace.experiment.JobDetails;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.apache.airavata.model.workspace.experiment.TaskState;
+import org.apache.airavata.registry.cpi.CompositeIdentifier;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+import java.util.concurrent.BlockingQueue;
+
+public class AiravataJobStatusUpdator implements AbstractActivityListener {
+    private final static Logger logger = LoggerFactory.getLogger(AiravataJobStatusUpdator.class);
+
+    private Registry airavataRegistry;
+
+    private MonitorPublisher monitorPublisher;
+
+    private BlockingQueue<MonitorID> jobsToMonitor;
+
+
+    public Registry getAiravataRegistry() {
+        return airavataRegistry;
+    }
+
+    public void setAiravataRegistry(Registry airavataRegistry) {
+        this.airavataRegistry = airavataRegistry;
+    }
+
+    public BlockingQueue<MonitorID> getJobsToMonitor() {
+        return jobsToMonitor;
+    }
+
+    public void setJobsToMonitor(BlockingQueue<MonitorID> jobsToMonitor) {
+        this.jobsToMonitor = jobsToMonitor;
+    }
+
+    @Subscribe
+    public void updateRegistry(JobStatusChangeRequest jobStatus) {
+        /* Here we need to parse the jobStatus message and update
+                the registry accordingly, for now we are just printing to standard Out
+                 */
+        JobState state = jobStatus.getState();
+        if (state != null) {
+            try {
+                String taskID = jobStatus.getIdentity().getTaskId();
+                String jobID = jobStatus.getIdentity().getJobId();
+                updateJobStatus(taskID, jobID, state);
+            } catch (Exception e) {
+                logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+            }
+            logger.info("Job ID:" + jobStatus.getIdentity().getJobId() + " is "+state.toString());
+            switch (state) {
+                case COMPLETE: case UNKNOWN: case CANCELED:case FAILED:case SUSPENDED:
+                    jobsToMonitor.remove(jobStatus.getMonitorID());
+                    break;
+			default:
+				break;
+            }
+        }
+    }
+
+    @Subscribe
+    public void setupTaskStatus(JobStatusChangeRequest jobStatus){
+    	TaskState state=TaskState.UNKNOWN;
+    	switch(jobStatus.getState()){
+    	case ACTIVE:
+    		state=TaskState.EXECUTING; break;
+    	case CANCELED:
+    		state=TaskState.CANCELED; break;
+    	case COMPLETE:
+    		state=TaskState.COMPLETED; break;
+    	case FAILED:
+    		state=TaskState.FAILED; break;
+    	case HELD: case SUSPENDED: case QUEUED:
+    		state=TaskState.WAITING; break;
+    	case SETUP:
+    		state=TaskState.PRE_PROCESSING; break;
+    	case SUBMITTED:
+    		state=TaskState.STARTED; break;
+    	case UN_SUBMITTED:
+    		state=TaskState.CANCELED; break;
+    	case CANCELING:
+    		state=TaskState.CANCELING; break;
+		default:
+			break;
+    	}
+    	logger.debug("Publishing Task Status "+state.toString());
+    	monitorPublisher.publish(new TaskStatusChangeRequest(jobStatus.getIdentity(),state));
+    }
+
+    public  void updateJobStatus(String taskId, String jobID, JobState state) throws Exception {
+        CompositeIdentifier ids = new CompositeIdentifier(taskId, jobID);
+        JobDetails details = (JobDetails)airavataRegistry.get(DataType.JOB_DETAIL, ids);
+        if(details == null) {
+            details = new JobDetails();
+        }
+        org.apache.airavata.model.workspace.experiment.JobStatus status = new org.apache.airavata.model.workspace.experiment.JobStatus();
+        status.setJobState(state);
+        status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+        details.setJobStatus(status);
+        details.setJobID(jobID);
+        airavataRegistry.update(DataType.JOB_DETAIL, details, ids);
+    }
+
+	@SuppressWarnings("unchecked")
+	public void setup(Object... configurations) {
+		for (Object configuration : configurations) {
+			if (configuration instanceof Registry){
+				this.airavataRegistry=(Registry)configuration;
+			} else if (configuration instanceof BlockingQueue<?>){
+				this.jobsToMonitor=(BlockingQueue<MonitorID>) configuration;
+			} else if (configuration instanceof MonitorPublisher){
+				this.monitorPublisher=(MonitorPublisher) configuration;
+			} 
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
new file mode 100644
index 0000000..8a57571
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java
@@ -0,0 +1,112 @@
+/*
+ *
+ * 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.gfac.core.monitor;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.monitor.state.TaskStatusChangeRequest;
+import org.apache.airavata.gfac.core.monitor.state.WorkflowNodeStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.model.workspace.experiment.TaskState;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+
+public class AiravataTaskStatusUpdator implements AbstractActivityListener {
+    private final static Logger logger = LoggerFactory.getLogger(AiravataTaskStatusUpdator.class);
+
+    private Registry airavataRegistry;
+
+    private MonitorPublisher monitorPublisher;
+    
+    public Registry getAiravataRegistry() {
+        return airavataRegistry;
+    }
+
+    public void setAiravataRegistry(Registry airavataRegistry) {
+        this.airavataRegistry = airavataRegistry;
+    }
+
+    @Subscribe
+    public void updateRegistry(TaskStatusChangeRequest taskStatus) {
+        TaskState state = taskStatus.getState();
+        if (state != null) {
+            try {
+                String taskID = taskStatus.getIdentity().getTaskId();
+                updateTaskStatus(taskID, state);
+            } catch (Exception e) {
+                logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+            }
+        }
+    }
+    
+    @Subscribe
+    public void setupWorkflowNodeStatus(TaskStatusChangeRequest taskStatus){
+    	WorkflowNodeState state=WorkflowNodeState.UNKNOWN;
+    	switch(taskStatus.getState()){
+    	case CANCELED:
+    		state=WorkflowNodeState.CANCELED; break;
+    	case COMPLETED:
+    		state=WorkflowNodeState.COMPLETED; break;
+    	case CONFIGURING_WORKSPACE:
+    		state=WorkflowNodeState.INVOKED; break;
+    	case FAILED:
+    		state=WorkflowNodeState.FAILED; break;
+    	case EXECUTING: case WAITING: case PRE_PROCESSING: case POST_PROCESSING: case OUTPUT_DATA_STAGING: case INPUT_DATA_STAGING:
+    		state=WorkflowNodeState.EXECUTING; break;
+    	case STARTED:
+    		state=WorkflowNodeState.INVOKED; break;
+    	case CANCELING:
+    		state=WorkflowNodeState.CANCELING; break;
+		default:
+			break;
+    	}
+    	logger.debug("Publishing Experiment Status "+state.toString());
+    	monitorPublisher.publish(new WorkflowNodeStatusChangeRequest(taskStatus.getIdentity(),state));
+    }
+    
+    public  void updateTaskStatus(String taskId, TaskState state) throws Exception {
+    	TaskDetails details = (TaskDetails)airavataRegistry.get(DataType.TASK_DETAIL, taskId);
+        if(details == null) {
+            details = new TaskDetails();
+            details.setTaskID(taskId);
+        }
+        org.apache.airavata.model.workspace.experiment.TaskStatus status = new org.apache.airavata.model.workspace.experiment.TaskStatus();
+        status.setExecutionState(state);
+        status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+        details.setTaskStatus(status);
+        airavataRegistry.update(DataType.TASK_DETAIL, details, taskId);
+    }
+
+	public void setup(Object... configurations) {
+		for (Object configuration : configurations) {
+			if (configuration instanceof Registry){
+				this.airavataRegistry=(Registry)configuration;
+			} else if (configuration instanceof MonitorPublisher){
+				this.monitorPublisher=(MonitorPublisher) configuration;
+			} 
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
new file mode 100644
index 0000000..66e7ecc
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java
@@ -0,0 +1,111 @@
+/*
+ *
+ * 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.gfac.core.monitor;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.monitor.state.ExperimentStatusChangeRequest;
+import org.apache.airavata.gfac.core.monitor.state.WorkflowNodeStatusChangeRequest;
+import org.apache.airavata.gfac.core.notification.MonitorPublisher;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+
+public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListener {
+    private final static Logger logger = LoggerFactory.getLogger(AiravataWorkflowNodeStatusUpdator.class);
+
+    private Registry airavataRegistry;
+
+    private MonitorPublisher monitorPublisher;
+
+    public Registry getAiravataRegistry() {
+        return airavataRegistry;
+    }
+
+    public void setAiravataRegistry(Registry airavataRegistry) {
+        this.airavataRegistry = airavataRegistry;
+    }
+
+    @Subscribe
+    public void updateRegistry(WorkflowNodeStatusChangeRequest workflowNodeStatus) {
+        WorkflowNodeState state = workflowNodeStatus.getState();
+        if (state != null) {
+            try {
+                String workflowNodeID = workflowNodeStatus.getIdentity().getWorkflowNodeID();
+                updateWorkflowNodeStatus(workflowNodeID, state);
+            } catch (Exception e) {
+                logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+            }
+        }
+    }
+
+    @Subscribe
+    public void setupExperimentStatus(WorkflowNodeStatusChangeRequest nodeStatus){
+    	ExperimentState state=ExperimentState.UNKNOWN;
+    	switch(nodeStatus.getState()){
+    	case CANCELED:
+    		state=ExperimentState.CANCELED; break;
+    	case COMPLETED:
+    		state=ExperimentState.COMPLETED; break;
+    	case INVOKED:
+    		state=ExperimentState.LAUNCHED; break;
+    	case FAILED:
+    		state=ExperimentState.FAILED; break;
+    	case EXECUTING:
+    		state=ExperimentState.EXECUTING; break;
+    	case CANCELING:
+    		state=ExperimentState.CANCELING; break;
+		default:
+			break;
+    	}
+    	logger.debug("Publishing Experiment Status "+state.toString());
+    	monitorPublisher.publish(new ExperimentStatusChangeRequest(nodeStatus.getIdentity(),state));
+    }
+
+    public  void updateWorkflowNodeStatus(String workflowNodeId, WorkflowNodeState state) throws Exception {
+    	WorkflowNodeDetails details = (WorkflowNodeDetails)airavataRegistry.get(DataType.WORKFLOW_NODE_DETAIL, workflowNodeId);
+        if(details == null) {
+            details = new WorkflowNodeDetails();
+            details.setNodeInstanceId(workflowNodeId);
+        }
+        WorkflowNodeStatus status = new WorkflowNodeStatus();
+        status.setWorkflowNodeState(state);
+        status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+        details.setWorkflowNodeStatus(status);
+        airavataRegistry.update(DataType.WORKFLOW_NODE_DETAIL, details, workflowNodeId);
+    }
+
+	public void setup(Object... configurations) {
+		for (Object configuration : configurations) {
+			if (configuration instanceof Registry){
+				this.airavataRegistry=(Registry)configuration;
+			} else if (configuration instanceof MonitorPublisher){
+				this.monitorPublisher=(MonitorPublisher) configuration;
+			} 
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java
new file mode 100644
index 0000000..5993101
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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.gfac.core.monitor;
+
+public class ExperimentIdentity {
+	private String experimentID;
+	public ExperimentIdentity(String experimentId) {
+		setExperimentID(experimentId);
+	}
+	public String getExperimentID() {
+		return experimentID;
+	}
+
+	public void setExperimentID(String experimentID) {
+		this.experimentID = experimentID;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java
new file mode 100644
index 0000000..cea7fa7
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.gfac.core.monitor;
+
+public class JobIdentity extends TaskIdentity {
+	private String jobId;
+	
+	public JobIdentity(String experimentId, String workflowNodeId, String taskId, String jobId) {
+		super(experimentId,workflowNodeId,taskId);
+		setJobId(jobId);
+	}
+
+	public String getJobId() {
+		return jobId;
+	}
+
+	public void setJobId(String jobId) {
+		this.jobId = jobId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
new file mode 100644
index 0000000..beb1f93
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
@@ -0,0 +1,213 @@
+/*
+ *
+ * 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.gfac.core.monitor;
+
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.Map;
+
+/*
+This is the object which contains the data to identify a particular
+Job to start the monitoring
+*/
+public class MonitorID {
+    private final static Logger logger = LoggerFactory.getLogger(MonitorID.class);
+
+    private String userName;
+
+    private Timestamp jobStartedTime;
+
+    private Timestamp lastMonitored;
+
+    private HostDescription host;
+
+    private Map<String, Object> parameters;
+
+    private String experimentID;
+
+    private String workflowNodeID;
+
+    private String taskID;
+
+    private String jobID;
+
+    private int failedCount = 0;
+
+    private JobState state;
+
+    private JobExecutionContext jobExecutionContext;
+
+    public MonitorID() {
+    }
+
+    public MonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID, String experimentID, String userName) {
+        this.host = host;
+        this.jobStartedTime = new Timestamp((new Date()).getTime());
+        this.userName = userName;
+        this.jobID = jobID;
+        this.taskID = taskID;
+        this.experimentID = experimentID;
+        this.workflowNodeID = workflowNodeID;
+    }
+
+    public HostDescription getHost() {
+        return host;
+    }
+
+    public void setHost(HostDescription host) {
+        this.host = host;
+    }
+
+    public Timestamp getLastMonitored() {
+        return lastMonitored;
+    }
+
+    public void setLastMonitored(Timestamp lastMonitored) {
+        this.lastMonitored = lastMonitored;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getJobID() {
+        return jobID;
+    }
+
+    public void setJobID(String jobID) {
+        this.jobID = jobID;
+    }
+
+    public Timestamp getJobStartedTime() {
+        return jobStartedTime;
+    }
+
+    public void setJobStartedTime(Timestamp jobStartedTime) {
+        this.jobStartedTime = jobStartedTime;
+    }
+
+    public void addParameter(String key,Object value) {
+        this.parameters.put(key, value);
+    }
+
+    public Object getParameter(String key) {
+        return this.parameters.get(key);
+    }
+
+    public Map<String, Object> getParameters() {
+        return parameters;
+    }
+
+    public void setParameters(Map<String, Object> parameters) {
+        this.parameters = parameters;
+    }
+
+    public String getExperimentID() {
+        return experimentID;
+    }
+
+    public void setExperimentID(String experimentID) {
+        this.experimentID = experimentID;
+    }
+
+    public String getTaskID() {
+        return taskID;
+    }
+
+    public void setTaskID(String taskID) {
+        this.taskID = taskID;
+    }
+
+    public int getFailedCount() {
+        return failedCount;
+    }
+
+    public void setFailedCount(int failedCount) {
+        this.failedCount = failedCount;
+    }
+
+    public JobState getStatus() {
+        return state;
+    }
+
+    public void setStatus(JobState status) {
+        // this logic is going to be useful for fast finishing jobs
+        // because in some machines job state vanishes quicckly when the job is done
+        // during that case job state comes as unknown.so we handle it here.
+            if (this.state != null && status.equals(JobState.UNKNOWN)) {
+                if (getFailedCount() > 2) {
+                    switch (this.state) {
+                        case ACTIVE:
+                            this.state = JobState.COMPLETE;
+                            break;
+                        case QUEUED:
+                            this.state = JobState.COMPLETE;
+                            break;
+                    }
+                } else {
+                    try {
+                        // when state becomes unknown we sleep for a while
+                        Thread.sleep(10000);
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+                    }
+                    setFailedCount(getFailedCount() + 1);
+                }
+            } else {
+                // normal scenario
+                this.state = status;
+            }
+    }
+
+	public String getWorkflowNodeID() {
+		return workflowNodeID;
+	}
+
+	public void setWorkflowNodeID(String workflowNodeID) {
+		this.workflowNodeID = workflowNodeID;
+	}
+
+    public JobExecutionContext getJobExecutionContext() {
+        return jobExecutionContext;
+    }
+
+    public void setJobExecutionContext(JobExecutionContext jobExecutionContext) {
+        this.jobExecutionContext = jobExecutionContext;
+    }
+
+    //	public String getWorkflowNodeID() {
+//		return workflowNodeID;
+//	}
+//
+//	public void setWorkflowNodeID(String workflowNodeID) {
+//		this.workflowNodeID = workflowNodeID;
+//	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java
new file mode 100644
index 0000000..2f2d6c5
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.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.gfac.core.monitor;
+
+public class TaskIdentity extends WorkflowNodeIdentity {
+	private String taskId;
+
+	public TaskIdentity(String experimentId, String workflowNodeId, String taskId) {
+		super(experimentId,workflowNodeId);
+		setTaskId(taskId);
+	}
+	public String getTaskId() {
+		return taskId;
+	}
+
+	public void setTaskId(String taskId) {
+		this.taskId = taskId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java
new file mode 100644
index 0000000..71a8f14
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.gfac.core.monitor;
+
+public class WorkflowNodeIdentity extends ExperimentIdentity {
+	private String workflowNodeID;
+	public WorkflowNodeIdentity(String experimentId, String workflowNodeId) {
+		super(experimentId);
+		setWorkflowNodeID(workflowNodeId);
+	}
+	public String getWorkflowNodeID() {
+		return workflowNodeID;
+	}
+
+	public void setWorkflowNodeID(String workflowNodeID) {
+		this.workflowNodeID = workflowNodeID;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/AbstractStateChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/AbstractStateChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/AbstractStateChangeRequest.java
new file mode 100644
index 0000000..7db9e4b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/AbstractStateChangeRequest.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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.gfac.core.monitor.state;
+
+
+public abstract class AbstractStateChangeRequest implements PublisherMessage {
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/ExperimentStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/ExperimentStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/ExperimentStatusChangeRequest.java
new file mode 100644
index 0000000..a8bc6b4
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/ExperimentStatusChangeRequest.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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.gfac.core.monitor.state;
+
+import org.apache.airavata.gfac.core.monitor.ExperimentIdentity;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+
+/**
+ * This is the primary job state object used in
+ * through out the monitor module. This use airavata-data-model JobState enum
+ * Ideally after processing each event or monitoring message from remote system
+ * Each monitoring implementation has to return this object with a state and
+ * the monitoring ID
+ */
+public class ExperimentStatusChangeRequest extends AbstractStateChangeRequest {
+    private ExperimentState state;
+    private ExperimentIdentity identity;
+
+    // this constructor can be used in Qstat monitor to handle errors
+    public ExperimentStatusChangeRequest() {
+    }
+
+    public ExperimentStatusChangeRequest(ExperimentIdentity experimentIdentity, ExperimentState state) {
+        this.state = state;
+        setIdentity(experimentIdentity);
+    }
+
+    public ExperimentState getState() {
+        return state;
+    }
+
+    public void setState(ExperimentState state) {
+       this.state = state;
+    }
+
+	public ExperimentIdentity getIdentity() {
+		return identity;
+	}
+
+	public void setIdentity(ExperimentIdentity identity) {
+		this.identity = identity;
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java
new file mode 100644
index 0000000..8b308ac
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java
@@ -0,0 +1,80 @@
+/*
+ *
+ * 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.gfac.core.monitor.state;
+
+import org.apache.airavata.gfac.core.monitor.JobIdentity;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.model.workspace.experiment.JobState;
+
+/**
+ * This is the primary job state object used in
+ * through out the monitor module. This use airavata-data-model JobState enum
+ * Ideally after processing each event or monitoring message from remote system
+ * Each monitoring implementation has to return this object with a state and
+ * the monitoring ID
+ */
+public class JobStatusChangeRequest  extends AbstractStateChangeRequest {
+    private JobState state;
+    private JobIdentity identity;
+
+    private MonitorID monitorID;
+    
+    // this constructor can be used in Qstat monitor to handle errors
+    public JobStatusChangeRequest() {
+    }
+
+    public JobStatusChangeRequest(MonitorID monitorID) {
+        setIdentity(new JobIdentity(monitorID.getExperimentID(),monitorID.getWorkflowNodeID(),
+                monitorID.getTaskID(),monitorID.getJobID()));
+    	setMonitorID(monitorID);
+    	this.state = monitorID.getStatus();
+    }
+    public JobStatusChangeRequest(MonitorID monitorID, JobIdentity jobId, JobState state) {
+    	setIdentity(jobId);
+    	setMonitorID(monitorID);
+    	this.state = state;
+    }
+
+    public JobState getState() {
+        return state;
+    }
+
+    public void setState(JobState state) {
+       this.state = state;
+    }
+
+	public JobIdentity getIdentity() {
+		return identity;
+	}
+
+	public void setIdentity(JobIdentity identity) {
+		this.identity = identity;
+	}
+
+	public MonitorID getMonitorID() {
+		return monitorID;
+	}
+
+	public void setMonitorID(MonitorID monitorID) {
+		this.monitorID = monitorID;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/PublisherMessage.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/PublisherMessage.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/PublisherMessage.java
new file mode 100644
index 0000000..08294f8
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/PublisherMessage.java
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.gfac.core.monitor.state;
+
+public interface PublisherMessage {
+//	public String getType();
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/TaskStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/TaskStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/TaskStatusChangeRequest.java
new file mode 100644
index 0000000..ec34cc9
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/TaskStatusChangeRequest.java
@@ -0,0 +1,61 @@
+/*
+ *
+ * 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.gfac.core.monitor.state;
+
+import org.apache.airavata.gfac.core.monitor.TaskIdentity;
+import org.apache.airavata.model.workspace.experiment.TaskState;
+
+/**
+ * This is the primary job state object used in
+ * through out the monitor module. This use airavata-data-model JobState enum
+ * Ideally after processing each event or monitoring message from remote system
+ * Each monitoring implementation has to return this object with a state and
+ * the monitoring ID
+ */
+public class TaskStatusChangeRequest extends AbstractStateChangeRequest {
+    private TaskState state;
+    private TaskIdentity identity;
+    // this constructor can be used in Qstat monitor to handle errors
+    public TaskStatusChangeRequest() {
+    }
+
+    public TaskStatusChangeRequest(TaskIdentity taskIdentity, TaskState state) {
+        this.state = state;
+        setIdentity(taskIdentity);
+    }
+
+    public TaskState getState() {
+        return state;
+    }
+
+    public void setState(TaskState state) {
+       this.state = state;
+    }
+
+	public TaskIdentity getIdentity() {
+		return identity;
+	}
+
+	public void setIdentity(TaskIdentity identity) {
+		this.identity = identity;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/WorkflowNodeStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/WorkflowNodeStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/WorkflowNodeStatusChangeRequest.java
new file mode 100644
index 0000000..9e52dd4
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/WorkflowNodeStatusChangeRequest.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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.gfac.core.monitor.state;
+
+import org.apache.airavata.gfac.core.monitor.WorkflowNodeIdentity;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
+
+/**
+ * This is the primary job state object used in
+ * through out the monitor module. This use airavata-data-model JobState enum
+ * Ideally after processing each event or monitoring message from remote system
+ * Each monitoring implementation has to return this object with a state and
+ * the monitoring ID
+ */
+public class WorkflowNodeStatusChangeRequest extends AbstractStateChangeRequest {
+    private WorkflowNodeState state;
+    private WorkflowNodeIdentity identity;
+
+    // this constructor can be used in Qstat monitor to handle errors
+    public WorkflowNodeStatusChangeRequest() {
+    }
+
+    public WorkflowNodeStatusChangeRequest(WorkflowNodeIdentity identity, WorkflowNodeState state) {
+        this.state = state;
+        setIdentity(identity);
+    }
+
+    public WorkflowNodeState getState() {
+        return state;
+    }
+
+    public void setState(WorkflowNodeState state) {
+       this.state = state;
+    }
+
+	public WorkflowNodeIdentity getIdentity() {
+		return identity;
+	}
+
+	public void setIdentity(WorkflowNodeIdentity identity) {
+		this.identity = identity;
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/GFacNotifier.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/GFacNotifier.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/GFacNotifier.java
new file mode 100644
index 0000000..40ffdcc
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/GFacNotifier.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.gfac.core.notification;
+
+import com.google.common.eventbus.EventBus;
+import org.apache.airavata.gfac.core.notification.events.GFacEvent;
+
+public class GFacNotifier {
+    private EventBus eventBus;
+
+    public GFacNotifier(){
+        eventBus = new EventBus();
+    }
+
+    public void registerListener(Object listener){
+        eventBus.register(listener);
+    }
+
+    public void publish(GFacEvent event){
+        eventBus.post(event);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/MonitorPublisher.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/MonitorPublisher.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/MonitorPublisher.java
new file mode 100644
index 0000000..e44974b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/MonitorPublisher.java
@@ -0,0 +1,47 @@
+/*
+ *
+ * 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.gfac.core.notification;
+
+import com.google.common.eventbus.EventBus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MonitorPublisher{
+    private final static Logger logger = LoggerFactory.getLogger(MonitorPublisher.class);
+    private EventBus eventBus;
+    
+    public MonitorPublisher(EventBus eventBus) {
+        this.eventBus = eventBus;
+    }
+
+    public void registerListener(Object listener) {
+        eventBus.register(listener);
+    }
+    
+    public void unregisterListener(Object listener) {
+        eventBus.unregister(listener);
+    }
+
+    public void publish(Object o) {
+        eventBus.post(o);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/ExecutionFailEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/ExecutionFailEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/ExecutionFailEvent.java
new file mode 100644
index 0000000..a7fd986
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/ExecutionFailEvent.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.gfac.core.notification.events;
+
+public class ExecutionFailEvent extends GFacEvent {
+    private Throwable cause;
+
+    public ExecutionFailEvent(Throwable cause){
+        this.eventType = ExecutionFailEvent.class.getSimpleName();
+        this.cause = cause;
+    }
+
+    public Throwable getCauseForFailure(){
+        return cause;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishExecutionEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishExecutionEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishExecutionEvent.java
new file mode 100644
index 0000000..426b182
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishExecutionEvent.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.gfac.core.notification.events;
+
+public class FinishExecutionEvent  extends GFacEvent{
+
+    public FinishExecutionEvent(){
+        this.eventType = FinishExecutionEvent.class.getSimpleName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishScheduleEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishScheduleEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishScheduleEvent.java
new file mode 100644
index 0000000..5924aba
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/FinishScheduleEvent.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.gfac.core.notification.events;
+
+public class FinishScheduleEvent extends GFacEvent {
+
+    public FinishScheduleEvent(){
+        this.eventType = FinishScheduleEvent.class.getSimpleName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/GFacEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/GFacEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/GFacEvent.java
new file mode 100644
index 0000000..5b49730
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/GFacEvent.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.gfac.core.notification.events;
+
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+
+public abstract class GFacEvent {
+
+    protected JobExecutionContext executionContext;
+
+    protected String eventType;
+
+    public JobExecutionContext getJobExecutionContext(){
+        return executionContext;
+    }
+
+    public String getEventType(){
+        return eventType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/JobIDEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/JobIDEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/JobIDEvent.java
new file mode 100644
index 0000000..4f13391
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/JobIDEvent.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.gfac.core.notification.events;
+
+public class JobIDEvent extends GFacEvent {
+	String statusMessage;
+
+	public JobIDEvent(String message) {
+		statusMessage = message;
+		this.eventType = JobIDEvent.class.getSimpleName();
+	}
+
+	public String getStatusMessage() {
+		return statusMessage;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartExecutionEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartExecutionEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartExecutionEvent.java
new file mode 100644
index 0000000..5ab65c1
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartExecutionEvent.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.gfac.core.notification.events;
+
+public class StartExecutionEvent extends GFacEvent {
+
+    public StartExecutionEvent(){
+        this.eventType = StartExecutionEvent.class.getSimpleName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartScheduleEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartScheduleEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartScheduleEvent.java
new file mode 100644
index 0000000..7abdb22
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StartScheduleEvent.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.gfac.core.notification.events;
+
+public class StartScheduleEvent extends GFacEvent {
+
+    public StartScheduleEvent(){
+        this.eventType = StartScheduleEvent.class.getSimpleName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StatusChangeEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StatusChangeEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StatusChangeEvent.java
new file mode 100644
index 0000000..b5f964f
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/StatusChangeEvent.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.gfac.core.notification.events;
+
+public class StatusChangeEvent extends GFacEvent {
+    String statusMessage;
+    public StatusChangeEvent(String message){
+        statusMessage = message;
+        this.eventType = StatusChangeEvent.class.getSimpleName();
+    }
+
+    public String getStatusMessage() {
+        return statusMessage;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/UnicoreJobIDEvent.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/UnicoreJobIDEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/UnicoreJobIDEvent.java
new file mode 100644
index 0000000..98dddaf
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/events/UnicoreJobIDEvent.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.gfac.core.notification.events;
+
+public class UnicoreJobIDEvent extends GFacEvent {
+	String statusMessage;
+
+	public UnicoreJobIDEvent(String message) {
+		statusMessage = message;
+		this.eventType = UnicoreJobIDEvent.class.getSimpleName();
+	}
+
+	public String getStatusMessage() {
+		return statusMessage;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/LoggingListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/LoggingListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/LoggingListener.java
new file mode 100644
index 0000000..809b9d5
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/LoggingListener.java
@@ -0,0 +1,57 @@
+/*
+ *
+ * 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.gfac.core.notification.listeners;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.core.notification.events.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LoggingListener {
+    private static Logger log = LoggerFactory.getLogger("gfac-logginglistener");
+
+    @Subscribe
+    public void logGFacEvent(GFacEvent e){
+        log.info("GFac event of type " + e.getEventType() + " received.");
+    }
+
+    @Subscribe
+    public void logExecutionFail(ExecutionFailEvent e){
+        log.error("Execution failed." + e.getEventType());
+    }
+
+    @Subscribe
+    public void logFinishExecutionEvent(FinishExecutionEvent event){
+        log.info("Execution has Finished ...");
+    }
+
+    @Subscribe
+    public void logStartExecutionEvent(StartExecutionEvent event){
+        log.info("Execution has started ...");
+    }
+
+    @Subscribe
+    public void logStatusChangeEvent(StatusChangeEvent event){
+        log.info("Job status has changed ...");
+        log.info(event.getStatusMessage());
+    }
+}


Mime
View raw message