airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [07/51] [abbrv] Separating gfac-monitoring implementation
Date Wed, 21 May 2014 17:56:21 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java
deleted file mode 100644
index 72c77d5..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * 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.monitor.impl.push.amqp;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.airavata.ComputingActivity;
-import org.apache.airavata.gfac.monitor.core.MessageParser;
-import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-
-public class JSONMessageParser implements MessageParser {
-    private final static Logger logger = LoggerFactory.getLogger(JSONMessageParser.class);
-
-    public JobState parseMessage(String message)throws AiravataMonitorException {
-        /*todo write a json message parser here*/
-        logger.debug(message);
-        ObjectMapper objectMapper = new ObjectMapper();
-        try {
-            ComputingActivity computingActivity = objectMapper.readValue(message.getBytes(), ComputingActivity.class);
-            logger.info(computingActivity.getIDFromEndpoint());
-            List<String> stateList = computingActivity.getState();
-            JobState jobState = null;
-            for (String aState : stateList) {
-                jobState = getStatusFromString(aState);
-            }
-            // we get the last value of the state array
-            return jobState;
-        } catch (IOException e) {
-            throw new AiravataMonitorException(e);
-        }
-    }
-
-private JobState getStatusFromString(String status) {
-        logger.info("parsing the job status returned : " + status);
-        if(status != null){
-            if("ipf:finished".equals(status)){
-                return JobState.COMPLETE;
-            }else if("ipf:pending".equals(status)|| "ipf:starting".equals(status)){
-                return JobState.QUEUED;
-            }else if("ipf:running".equals(status) || "ipf:finishing".equals(status)){
-                return JobState.ACTIVE;
-            }else if ("ipf:held".equals(status) || "ipf:teminating".equals(status) || "ipf:teminated".equals(status)) {
-                return JobState.HELD;
-            } else if ("ipf:suspending".equals(status)) {
-                return JobState.SUSPENDED;
-            }else if ("ipf:failed".equals(status)) {
-                return JobState.FAILED;
-            }else if ("ipf:unknown".equals(status)){
-                return JobState.UNKNOWN;
-            }
-        }
-        return JobState.UNKNOWN;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
deleted file mode 100644
index c6e1378..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * 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.monitor.impl.push.amqp;
-
-import com.google.common.eventbus.Subscribe;
-import com.rabbitmq.client.Channel;
-import org.apache.airavata.gfac.monitor.MonitorID;
-import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.gfac.monitor.util.CommonUtils;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Map;
-
-public class UnRegisterWorker{
-    private final static Logger logger = LoggerFactory.getLogger(UnRegisterWorker.class);
-    private Map<String, Channel> availableChannels;
-
-    public UnRegisterWorker(Map<String, Channel> channels) {
-        this.availableChannels = channels;
-    }
-
-    @Subscribe
-    private boolean unRegisterListener(JobStatusChangeRequest jobStatus) throws AiravataMonitorException {
-        MonitorID monitorID = jobStatus.getMonitorID();
-        String channelID = CommonUtils.getChannelID(monitorID);
-        if (JobState.FAILED.equals(jobStatus.getState()) || JobState.COMPLETE.equals(jobStatus.getState())){
-            Channel channel = availableChannels.get(channelID);
-            if (channel == null) {
-                logger.error("Already Unregistered the listener");
-                throw new AiravataMonitorException("Already Unregistered the listener");
-            } else {
-                try {
-                    channel.queueUnbind(channel.queueDeclare().getQueue(), "glue2.computing_activity", CommonUtils.getRoutingKey(monitorID));
-                    channel.close();
-                    channel.getConnection().close();
-                    availableChannels.remove(channelID);
-                } catch (IOException e) {
-                    logger.error("Error unregistering the listener");
-                    throw new AiravataMonitorException("Error unregistering the listener");
-                }
-            }
-        }
-        return true;
-    }
-}
-

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

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java
deleted file mode 100644
index eecf88d..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * 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.monitor.state;
-
-import org.apache.airavata.gfac.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/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java
deleted file mode 100644
index da52656..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * 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.monitor.state;
-
-import org.apache.airavata.gfac.monitor.JobIdentity;
-import org.apache.airavata.gfac.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/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java
deleted file mode 100644
index 9a59b50..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * 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.monitor.state;
-
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-
-/**
- * Based on the job status monitoring we can gather
- * different informaation about the job, its not simply
- * the job status, so we need a way to implement
- * different job statusinfo object to keep job status
- */
-public interface JobStatusInfo {
-
-    /**
-     * This method can be used to get JobStatusInfo data and
-     * decide the finalJobState
-     *
-     * @param jobState
-     */
-    void setJobStatus(JobStatus jobState);
-
-    /**
-     * After setting the jobState by processing jobinformation
-     * this method can be used to get the JobStatus
-     * @return
-     */
-    JobStatus getJobStatus();
-
-}

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

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java
deleted file mode 100644
index af20707..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * 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.monitor.state;
-
-import org.apache.airavata.gfac.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/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java
deleted file mode 100644
index 632f2e3..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * 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.monitor.state;
-
-import org.apache.airavata.gfac.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/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java
deleted file mode 100644
index 19b051a..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.monitor.state.impl;
-
-import org.apache.airavata.gfac.monitor.state.JobStatusInfo;
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-
-/**
- * This can be used to store job status information about
- * amazon jobs, this data could be very different from
- * a typical grid job
- */
-public class AmazonJobStatusInfo implements JobStatusInfo {
-    public void setJobStatus(JobStatus jobState) {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public JobStatus getJobStatus() {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java
deleted file mode 100644
index 4612c3c..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * 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.monitor.state.impl;
-
-import org.apache.airavata.gfac.monitor.state.JobStatusInfo;
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-
-
-/**
- * This can be used to keep information about a Grid job
- * which we can get from qstat polling or from amqp based
- * monitoring in Grid machines
- */
-public class GridJobStatusInfo implements JobStatusInfo {
-    public void setJobStatus(JobStatus jobState) {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public JobStatus getJobStatus() {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java
deleted file mode 100644
index b69cf52..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * 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.monitor.util;
-
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.ConnectionFactory;
-import com.rabbitmq.client.DefaultSaslConfig;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManagerFactory;
-import java.security.KeyStore;
-import java.util.Collections;
-import java.util.List;
-
-public class AMQPConnectionUtil {
-    public static Connection connect(List<String>hosts,String vhost, String proxyFile) {
-        Collections.shuffle(hosts);
-        for (String host : hosts) {
-            Connection connection = connect(host, vhost, proxyFile);
-            if (host != null) {
-                System.out.println("connected to " + host);
-                return connection;
-            }
-        }
-        return null;
-    }
-
-    public static Connection connect(String host, String vhost, String proxyFile) {
-        Connection connection;
-        try {
-            String keyPassPhrase = "test123";
-            KeyStore ks = X509Helper.keyStoreFromPEM(proxyFile, keyPassPhrase);
-            KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
-            kmf.init(ks, keyPassPhrase.toCharArray());
-
-            KeyStore tks = X509Helper.trustKeyStoreFromCertDir();
-            TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
-            tmf.init(tks);
-
-            SSLContext c = SSLContext.getInstance("SSLv3");
-            c.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
-
-            ConnectionFactory factory = new ConnectionFactory();
-            factory.setHost(host);
-            factory.setPort(5671);
-            factory.useSslProtocol(c);
-            factory.setVirtualHost(vhost);
-            factory.setSaslConfig(DefaultSaslConfig.EXTERNAL);
-
-            connection = factory.newConnection();
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-        return connection;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
deleted file mode 100644
index 30f1ae4..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- *
- * 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.monitor.util;
-
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gfac.monitor.HostMonitorData;
-import org.apache.airavata.gfac.monitor.MonitorID;
-import org.apache.airavata.gfac.monitor.UserMonitorData;
-import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-
-public class CommonUtils {
-    private final static Logger logger = LoggerFactory.getLogger(CommonUtils.class);
-
-    public static boolean isPBSHost(HostDescription host){
-        if("pbs".equals(((GsisshHostType)host.getType()).getJobManager()) ||
-                "".equals(((GsisshHostType)host.getType()).getJobManager())){
-         return true;
-        }else{
-            // default is pbs so we return true
-            return false;
-        }
-    }
-    public static boolean isSlurm(HostDescription host){
-        if("slurm".equals(((GsisshHostType)host.getType()).getJobManager())){
-         return true;
-        }else{
-            // default is pbs so we return true
-            return false;
-        }
-    }
-    public static boolean isSGE(HostDescription host){
-        if("sge".equals(((GsisshHostType)host.getType()).getJobManager())){
-         return true;
-        }else{
-            // default is pbs so we return true
-            return false;
-        }
-    }
-    public static String getChannelID(MonitorID monitorID) {
-        return monitorID.getUserName() + "-" + monitorID.getHost().getType().getHostName();
-    }
-
-    public static String getRoutingKey(MonitorID monitorID) {
-        return "*." + monitorID.getUserName() + "." + monitorID.getHost().getType().getHostAddress();
-    }
-
-    public static String getChannelID(String userName,String hostAddress) {
-        return userName + "-" + hostAddress;
-    }
-
-    public static String getRoutingKey(String userName,String hostAddress) {
-        return "*." + userName + "." + hostAddress;
-    }
-
-    public static void addMonitortoQueue(BlockingQueue<UserMonitorData> queue, MonitorID monitorID) throws AiravataMonitorException {
-        Iterator<UserMonitorData> iterator = queue.iterator();
-        while (iterator.hasNext()) {
-            UserMonitorData next = iterator.next();
-            if (next.getUserName().equals(monitorID.getUserName())) {
-                // then this is the right place to update
-                List<HostMonitorData> monitorIDs = next.getHostMonitorData();
-                for (HostMonitorData host : monitorIDs) {
-                    if (host.getHost().equals(monitorID.getHost())) {
-                        // ok we found right place to add this monitorID
-                        host.addMonitorIDForHost(monitorID);
-                        return;
-                    }
-                }
-                // there is a userMonitor object for this user name but no Hosts for this host
-                // so we have to create new Hosts
-                HostMonitorData hostMonitorData = new HostMonitorData(monitorID.getHost());
-                hostMonitorData.addMonitorIDForHost(monitorID);
-                next.addHostMonitorData(hostMonitorData);
-                return;
-            }
-        }
-        HostMonitorData hostMonitorData = new HostMonitorData(monitorID.getHost());
-        hostMonitorData.addMonitorIDForHost(monitorID);
-
-        UserMonitorData userMonitorData = new UserMonitorData(monitorID.getUserName());
-        userMonitorData.addHostMonitorData(hostMonitorData);
-        try {
-            queue.put(userMonitorData);
-        } catch (InterruptedException e) {
-            throw new AiravataMonitorException(e);
-        }
-    }
-    public static boolean isTheLastJobInQueue(BlockingQueue<MonitorID> queue,MonitorID monitorID){
-        Iterator<MonitorID> iterator = queue.iterator();
-        while(iterator.hasNext()){
-            MonitorID next = iterator.next();
-            if(monitorID.getUserName().equals(next.getUserName()) && CommonUtils.isEqual(monitorID.getHost(), next.getHost())){
-                return false;
-            }
-        }
-        return true;
-    }
-    public static void removeMonitorFromQueue(BlockingQueue<UserMonitorData> queue,MonitorID monitorID) throws AiravataMonitorException {
-        Iterator<UserMonitorData> iterator = queue.iterator();
-        while(iterator.hasNext()){
-            UserMonitorData next = iterator.next();
-            if(next.getUserName().equals(monitorID.getUserName())){
-                // then this is the right place to update
-                List<HostMonitorData> hostMonitorData = next.getHostMonitorData();
-                for(HostMonitorData iHostMonitorID:hostMonitorData){
-                    if(iHostMonitorID.getHost().equals(monitorID.getHost())) {
-                        List<MonitorID> monitorIDs = iHostMonitorID.getMonitorIDs();
-                        for(MonitorID iMonitorID:monitorIDs){
-                            if(iMonitorID.getJobID().equals(monitorID.getJobID())) {
-                                // OK we found the object, we cannot do list.remove(object) states of two objects
-                                // could be different, thats why we check the jobID
-                                monitorIDs.remove(iMonitorID);
-                                if(monitorIDs.size()==0) {
-                                    hostMonitorData.remove(iHostMonitorID);
-                                    if (hostMonitorData.size() == 0) {
-                                        // no useful data so we have to remove the element from the queue
-                                        queue.remove(next);
-                                    }
-                                }
-                                return;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        throw new AiravataMonitorException("Cannot find the given MonitorID in the queue with userName " +
-                monitorID.getUserName() + "  and jobID " + monitorID.getJobID());
-
-    }
-
-    public static boolean isEqual(HostDescription host1,HostDescription host2) {
-        if ((host1.getType() instanceof GsisshHostType) && (host2.getType() instanceof GsisshHostType)) {
-            GsisshHostType hostType1 = (GsisshHostType)host1.getType();
-            GsisshHostType hostType2 = (GsisshHostType)host2.getType();
-            if(hostType1.getHostAddress().equals(hostType2.getHostAddress())
-                    && hostType1.getJobManager().equals(hostType2.getJobManager())
-                    && (hostType1.getPort() == hostType2.getPort())
-                    && hostType1.getMonitorMode().equals(hostType2.getMonitorMode())){
-                return true;
-            }
-        } else {
-            logger.error("This method is only impmlemented to handle Gsissh host types");
-        }
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java
deleted file mode 100644
index c29490a..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- *
- * 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.monitor.util;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.openssl.PEMReader;
-
-import java.io.*;
-import java.security.*;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CertificateParsingException;
-import java.security.cert.X509Certificate;
-import java.security.spec.InvalidKeySpecException;
-
-public class X509Helper {
-
-    static {
-        // parsing of RSA key fails without this
-        java.security.Security.addProvider(new BouncyCastleProvider());
-    }
-
-
-
-    public static KeyStore keyStoreFromPEM(String proxyFile,
-                                           String keyPassPhrase) throws IOException,
-            CertificateException,
-            NoSuchAlgorithmException,
-            InvalidKeySpecException,
-            KeyStoreException {
-        return keyStoreFromPEM(proxyFile,proxyFile,keyPassPhrase);
-    }
-
-    public static KeyStore keyStoreFromPEM(String certFile,
-                                           String keyFile,
-                                           String keyPassPhrase) throws IOException,
-                                                                        CertificateException,
-                                                                        NoSuchAlgorithmException,
-                                                                        InvalidKeySpecException,
-                                                                        KeyStoreException {
-        CertificateFactory cf = CertificateFactory.getInstance("X.509");
-        X509Certificate cert = (X509Certificate)cf.generateCertificate(new FileInputStream(certFile));
-        //System.out.println(cert.toString());
-
-        // this works for proxy files, too, since it skips over the certificate
-        BufferedReader reader = new BufferedReader(new FileReader(keyFile));
-        String line = null;
-        StringBuilder builder = new StringBuilder();
-        boolean inKey = false;
-        while((line=reader.readLine()) != null) {
-            if (line.contains("-----BEGIN RSA PRIVATE KEY-----")) {
-                inKey = true;
-            }
-            if (inKey) {
-                builder.append(line);
-                builder.append(System.getProperty("line.separator"));
-            }
-            if (line.contains("-----END RSA PRIVATE KEY-----")) {
-                inKey = false;
-            }
-        }
-        String privKeyPEM = builder.toString();
-        //System.out.println(privKeyPEM);
-
-        // using BouncyCastle
-        PEMReader pemParser = new PEMReader(new StringReader(privKeyPEM));
-        Object object = pemParser.readObject();
-
-        PrivateKey privKey = null;
-        if(object instanceof KeyPair){
-            privKey = ((KeyPair)object).getPrivate();
-        }
-        // PEMParser from BouncyCastle is good for reading PEM files, but I didn't want to add that dependency
-        /*
-        // Base64 decode the data
-        byte[] encoded = javax.xml.bind.DatatypeConverter.parseBase64Binary(privKeyPEM);
-
-        // PKCS8 decode the encoded RSA private key
-        java.security.spec.PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded);
-        KeyFactory kf = KeyFactory.getInstance("RSA");
-        PrivateKey privKey = kf.generatePrivate(keySpec);
-        //RSAPrivateKey privKey = (RSAPrivateKey)kf.generatePrivate(keySpec);
-        */
-        //System.out.println(privKey.toString());
-
-        KeyStore keyStore = KeyStore.getInstance("PKCS12");
-        keyStore.load(null,null);
-
-        KeyStore.PrivateKeyEntry entry =
-            new KeyStore.PrivateKeyEntry(privKey,
-                                         new java.security.cert.Certificate[] {(java.security.cert.Certificate)cert});
-        KeyStore.PasswordProtection prot = new KeyStore.PasswordProtection(keyPassPhrase.toCharArray());
-        keyStore.setEntry(cert.getSubjectX500Principal().getName(), entry, prot);
-
-        return keyStore;
-    }
-
-
-    public static KeyStore trustKeyStoreFromCertDir() throws IOException,
-                                                             KeyStoreException,
-                                                             CertificateException,
-                                                             NoSuchAlgorithmException, ApplicationSettingsException {
-        return trustKeyStoreFromCertDir(ServerSettings.getSetting("trusted.cert.location"));
-    }
-
-    public static KeyStore trustKeyStoreFromCertDir(String certDir) throws IOException,
-                                                                           KeyStoreException,
-                                                                           CertificateException,
-                                                                           NoSuchAlgorithmException {
-        KeyStore ks = KeyStore.getInstance("JKS");
-        ks.load(null,null);
-
-        File dir = new File(certDir);
-        for(File file : dir.listFiles()) {
-            if (!file.isFile()) {
-                continue;
-            }
-            if (!file.getName().endsWith(".0")) {
-                continue;
-            }
-
-            try {
-                //System.out.println("reading file "+file.getName());
-                CertificateFactory cf = CertificateFactory.getInstance("X.509");
-                X509Certificate cert = (X509Certificate) cf.generateCertificate(new FileInputStream(file));
-                //System.out.println(cert.toString());
-
-                KeyStore.TrustedCertificateEntry entry = new KeyStore.TrustedCertificateEntry(cert);
-
-                ks.setEntry(cert.getSubjectX500Principal().getName(), entry, null);
-            } catch (KeyStoreException e) {
-            } catch (CertificateParsingException e) {
-                continue;
-            }
-
-        }
-
-        return ks;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/GSISSHJobSubmissionListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/GSISSHJobSubmissionListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/GSISSHJobSubmissionListener.java
deleted file mode 100644
index 75a055c..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/GSISSHJobSubmissionListener.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * 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.notification.listeners;
-
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.notification.events.StatusChangeEvent;
-import org.apache.airavata.gsi.ssh.api.SSHApiException;
-import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-import org.apache.airavata.gsi.ssh.listener.JobSubmissionListener;
-
-public class GSISSHJobSubmissionListener extends JobSubmissionListener {
-
-    JobExecutionContext context;
-
-    public GSISSHJobSubmissionListener(JobExecutionContext context) {
-        this.context = context;
-    }
-
-    public void statusChanged(JobDescriptor jobDescriptor) throws SSHApiException {
-        this.context.getNotifier().publish(new StatusChangeEvent("Job status has changed to : " + jobDescriptor.getStatus()));
-    }
-
-    @Override
-    public void statusChanged(JobStatus jobStatus) throws SSHApiException {
-        this.context.getNotifier().publish(new StatusChangeEvent("Job status has changed to : " + jobStatus.toString()));
-    }
-
-    @Override
-    public boolean isJobDone() throws SSHApiException {
-        return getJobStatus().equals(JobStatus.C);
-    }
-
-    public void setContext(JobExecutionContext context) {
-        this.context = context;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java
new file mode 100644
index 0000000..0b712b0
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.provider;
+
+import java.util.List;
+
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.model.workspace.experiment.JobDetails;
+import org.apache.airavata.model.workspace.experiment.JobStatus;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractProvider implements GFacProvider{
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    protected Registry registry = null;
+	protected JobDetails details;     //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
+	protected JobStatus status;   //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
+	protected JobExecutionContext jobExecutionContext;
+
+	public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
+        log.debug("Initializing " + this.getClass().getName());
+		registry = RegistryFactory.getDefaultRegistry();
+		details = new JobDetails();
+		status = new JobStatus();
+		this.jobExecutionContext=jobExecutionContext;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
index cf77fab..85d1dc5 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
@@ -25,12 +25,8 @@ import java.util.Map;
 
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.monitor.AbstractActivityListener;
-import org.apache.airavata.gfac.monitor.command.TaskCancelRequest;
 
-import com.google.common.eventbus.Subscribe;
-
-public interface GFacProvider extends AbstractActivityListener{
+public interface GFacProvider{
 
     void initProperties(Map<String,String> properties) throws GFacProviderException,GFacException;
     /**
@@ -63,6 +59,5 @@ public interface GFacProvider extends AbstractActivityListener{
      */
     public void cancelJob(String jobId, JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException;
 
-    @Subscribe
-    public void taskCancelRequested(TaskCancelRequest request);
+
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/AbstractProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/AbstractProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/AbstractProvider.java
deleted file mode 100644
index a3f8879..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/AbstractProvider.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- * 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.provider.impl;
-
-import java.util.List;
-
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.provider.GFacProvider;
-import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.gfac.monitor.JobIdentity;
-import org.apache.airavata.gfac.monitor.MonitorID;
-import org.apache.airavata.gfac.monitor.command.TaskCancelRequest;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.model.workspace.experiment.JobDetails;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.apache.airavata.model.workspace.experiment.JobStatus;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.DataType;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.JobDetaisConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractProvider implements GFacProvider{
-    private final Logger log = LoggerFactory.getLogger(this.getClass());
-
-    protected Registry registry = null;
-	protected JobDetails details;     //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
-	protected JobStatus status;   //todo we need to remove this and add methods to fill Job details, this is not a property of a provider
-	protected JobExecutionContext jobExecutionContext;
-
-	private MonitorPublisher monitorPublisher;
-
-	public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
-		registry = RegistryFactory.getDefaultRegistry();
-		details = new JobDetails();
-		status = new JobStatus();
-		this.jobExecutionContext=jobExecutionContext;
-	}
-	
-	@Override
-	public void taskCancelRequested(TaskCancelRequest request) {
-		try {
-			List<Object> jobDetails = registry.get(DataType.JOB_DETAIL, JobDetaisConstants.TASK_ID, request.getTaskId());
-			for (Object o : jobDetails) {
-				JobDetails jd=(JobDetails)o;
-				JobState jobState = jd.getJobStatus().getJobState();
-				if (jobState!=JobState.CANCELED || jobState!=JobState.CANCELING || jobState!=JobState.COMPLETE || jobState!=JobState.FAILED){
-					MonitorID monitorId = new MonitorID(null, jd.getJobID(), request.getTaskId(), request.getExperimentId(), null, null);
-					monitorPublisher.publish(new JobStatusChangeRequest(monitorId, new JobIdentity(monitorId.getExperimentID(), monitorId.getWorkflowNodeID(), monitorId.getTaskID(), monitorId.getJobID()), JobState.CANCELING));
-					log.debug("Canceling job "+jd.getJobID());
-					cancelJob(jd.getJobID(), jobExecutionContext);
-				}
-			}
-		} catch (RegistryException e) {
-			log.error("Error retrieving job details for Task "+request.getTaskId(),e);
-		} catch (Exception e) {
-			log.error("Error canceling jobs!!!",e);
-		}
-	}
-	
-	@Override
-	public void setup(Object... configurations) {
-		for (Object configuration : configurations) {
-			if (configuration instanceof MonitorPublisher){
-				this.monitorPublisher=(MonitorPublisher) configuration;
-			} 
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
index 3058909..c8113e5 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
@@ -26,7 +26,6 @@ import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.InetAddress;
-import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.UnknownHostException;
 import java.util.*;
@@ -35,14 +34,11 @@ import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
-import org.apache.airavata.commons.gfac.type.MappingFactory;
 import org.apache.airavata.gfac.Constants;
+import org.apache.airavata.gfac.ExecutionMode;
+import org.apache.airavata.gfac.GFacConfiguration;
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gsi.ssh.api.Cluster;
-import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gsi.ssh.impl.PBSCluster;
 import org.apache.airavata.model.workspace.experiment.*;
 import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
 import org.apache.airavata.registry.api.workflow.ApplicationJob;
@@ -90,6 +86,18 @@ public class GFacUtils {
         }
     }
 
+    /**
+     * this can be used to do framework opertaions specific to different modes
+     * @param jobExecutionContext
+     * @return
+     */
+    public static boolean isSynchronousMode(JobExecutionContext jobExecutionContext){
+        GFacConfiguration gFacConfiguration = jobExecutionContext.getGFacConfiguration();
+        if(ExecutionMode.ASYNCHRONOUS.equals(gFacConfiguration.getExecutionMode())){
+            return false;
+        }
+        return true;
+    }
     public static String readFileToString(String file) throws FileNotFoundException, IOException {
         BufferedReader instream = null;
         try {
@@ -154,27 +162,27 @@ public class GFacUtils {
             actualParameter = new ActualParameter(DoubleParameterType.type);
             if (!"".equals(element.getValue())) {
                 ((DoubleParameterType) actualParameter.getType()).setValue(new Double(element.getValue()));
-            } 
+            }
         } else if ("Integer".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(IntegerParameterType.type);
             if (!"".equals(element.getValue())) {
                 ((IntegerParameterType) actualParameter.getType()).setValue(new Integer(element.getValue()));
-            } 
+            }
         } else if ("Float".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(FloatParameterType.type);
             if (!"".equals(element.getValue())) {
                 ((FloatParameterType) actualParameter.getType()).setValue(new Float(element.getValue()));
-            } 
+            }
         } else if ("Boolean".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(BooleanParameterType.type);
             if (!"".equals(element.getValue())) {
                 ((BooleanParameterType) actualParameter.getType()).setValue(new Boolean(element.getValue()));
-            } 
+            }
         } else if ("File".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(FileParameterType.type);
             if (!"".equals(element.getValue())) {
                 ((FileParameterType) actualParameter.getType()).setValue(element.getValue());
-            } 
+            }
         } else if ("URI".equals(parameter.getParameterType().getName())) {
             actualParameter = new ActualParameter(URIParameterType.type);
             if (!"".equals(element.getValue())) {
@@ -592,20 +600,21 @@ public class GFacUtils {
             log.error("Error in persisting application job data for application job " + job.getJobId() + "!!!", e);
         }
     }
-    public static void saveJobStatus(JobDetails details, JobState state, String taskID) throws GFacException {
+    public static void saveJobStatus(JobExecutionContext jobExecutionContext, JobDetails details, JobState state) throws GFacException {
 		try {
-			Registry registry = RegistryFactory.getDefaultRegistry();
+			Registry registry = jobExecutionContext.getRegistry();
 			JobStatus status = new JobStatus();
 			status.setJobState(state);
         	details.setJobStatus(status);
-			registry.add(ChildDataType.JOB_DETAIL,details, new CompositeIdentifier(taskID, details.getJobID()));
+			registry.add(ChildDataType.JOB_DETAIL,details, new CompositeIdentifier(jobExecutionContext.getTaskData().getTaskID(), details.getJobID()));
 		} catch (Exception e) {
 			throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
 		}
 	}
-    public static void updateJobStatus(JobDetails details, JobState state) throws GFacException {
+
+    public static void updateJobStatus(JobExecutionContext jobExecutionContext,JobDetails details, JobState state) throws GFacException {
 		try {
-			Registry registry = RegistryFactory.getDefaultRegistry();
+            Registry registry = jobExecutionContext.getRegistry();
 			JobStatus status = new JobStatus();
 			status.setJobState(state);
 			status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
@@ -615,7 +624,7 @@ public class GFacUtils {
 			throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
 		}
 	}
-    public static void saveErrorDetails(String errorMessage, CorrectiveAction action, ErrorCategory errorCatogory, String id) throws GFacException {
+    public static void saveErrorDetails(JobExecutionContext jobExecutionContext, String errorMessage, CorrectiveAction action, ErrorCategory errorCatogory) throws GFacException {
     	try {
     	Registry registry = RegistryFactory.getDefaultRegistry();
 		ErrorDetails details = new ErrorDetails();
@@ -624,7 +633,7 @@ public class GFacUtils {
     	details.setActionableGroup(ActionableGroup.GATEWAYS_ADMINS);
     	details.setCreationTime(Calendar.getInstance().getTimeInMillis());
     	details.setErrorCategory(errorCatogory);
-    	registry.add(ChildDataType.ERROR_DETAIL, details, id);
+    	registry.add(ChildDataType.ERROR_DETAIL, details, jobExecutionContext.getTaskData().getTaskID());
     	} catch (Exception e) {
 			throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
 		}
@@ -649,89 +658,5 @@ public class GFacUtils {
         return stringObjectHashMap;
     }
 
-    public static JobDescriptor createJobDescriptor(JobExecutionContext jobExecutionContext,
-                                                    ApplicationDeploymentDescriptionType app, Cluster cluster) {
-        JobDescriptor jobDescriptor = new JobDescriptor();
-        // this is common for any application descriptor
-        jobDescriptor.setInputDirectory(app.getInputDataDirectory());
-        jobDescriptor.setOutputDirectory(app.getOutputDataDirectory());
-        jobDescriptor.setExecutablePath(app.getExecutableLocation());
-        jobDescriptor.setStandardOutFile(app.getStandardOutput());
-        jobDescriptor.setStandardErrorFile(app.getStandardError());
-        Random random = new Random();
-        int i = random.nextInt();
-        jobDescriptor.setJobName(app.getApplicationName().getStringValue() + String.valueOf(i));
-        jobDescriptor.setWorkingDirectory(app.getStaticWorkingDirectory());
-
-
-        List<String> inputValues = new ArrayList<String>();
-        MessageContext input = jobExecutionContext.getInMessageContext();
-        Map<String, Object> inputs = input.getParameters();
-        Set<String> keys = inputs.keySet();
-        for (String paramName : keys) {
-            ActualParameter actualParameter = (ActualParameter) inputs.get(paramName);
-            if ("URIArray".equals(actualParameter.getType().getType().toString()) || "StringArray".equals(actualParameter.getType().getType().toString())
-                    || "FileArray".equals(actualParameter.getType().getType().toString())) {
-                String[] values = null;
-                if (actualParameter.getType() instanceof URIArrayType) {
-                    values = ((URIArrayType) actualParameter.getType()).getValueArray();
-                } else if (actualParameter.getType() instanceof StringArrayType) {
-                    values = ((StringArrayType) actualParameter.getType()).getValueArray();
-                } else if (actualParameter.getType() instanceof FileArrayType) {
-                    values = ((FileArrayType) actualParameter.getType()).getValueArray();
-                }
-                String value = StringUtil.createDelimiteredString(values, " ");
-                inputValues.add(value);
-            } else {
-                String paramValue = MappingFactory.toString(actualParameter);
-                inputValues.add(paramValue);
-            }
-        }
-        jobDescriptor.setInputValues(inputValues);
-
-        // this part will fill out the hpcApplicationDescriptor
-        if (app instanceof HpcApplicationDeploymentType) {
-            HpcApplicationDeploymentType applicationDeploymentType
-                    = (HpcApplicationDeploymentType) app;
-            jobDescriptor.setShellName("/bin/bash");
-            jobDescriptor.setAllEnvExport(true);
-            jobDescriptor.setMailOptions("n");
-            jobDescriptor.setNodes(applicationDeploymentType.getNodeCount());
-            jobDescriptor.setProcessesPerNode(applicationDeploymentType.getProcessorsPerNode());
-            jobDescriptor.setMaxWallTime(String.valueOf(applicationDeploymentType.getMaxWallTime()));
-            jobDescriptor.setJobSubmitter(applicationDeploymentType.getJobSubmitterCommand());
-            if (applicationDeploymentType.getProjectAccount() != null) {
-                if (applicationDeploymentType.getProjectAccount().getProjectAccountNumber() != null) {
-                    jobDescriptor.setAcountString(applicationDeploymentType.getProjectAccount().getProjectAccountNumber());
-                }
-            }
-            if (applicationDeploymentType.getQueue() != null) {
-                if (applicationDeploymentType.getQueue().getQueueName() != null) {
-                    jobDescriptor.setQueueName(applicationDeploymentType.getQueue().getQueueName());
-                }
-            }
-            jobDescriptor.setOwner(((PBSCluster) cluster).getServerInfo().getUserName());
-            TaskDetails taskData = jobExecutionContext.getTaskData();
-            if (taskData != null && taskData.isSetTaskScheduling()) {
-                ComputationalResourceScheduling computionnalResource = taskData.getTaskScheduling();
-                if (computionnalResource.getNodeCount() > 0) {
-                    jobDescriptor.setNodes(computionnalResource.getNodeCount());
-                }
-                if (computionnalResource.getComputationalProjectAccount() != null) {
-                    jobDescriptor.setAcountString(computionnalResource.getComputationalProjectAccount());
-                }
-                if (computionnalResource.getQueueName() != null) {
-                    jobDescriptor.setQueueName(computionnalResource.getQueueName());
-                }
-                if (computionnalResource.getTotalCPUCount() > 0) {
-                    jobDescriptor.setProcessesPerNode(computionnalResource.getTotalCPUCount());
-                }
-                if (computionnalResource.getWallTimeLimit() > 0) {
-                    jobDescriptor.setMaxWallTime(String.valueOf(computionnalResource.getWallTimeLimit()));
-                }
-            }
 
-        }
-        return jobDescriptor;
-    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
deleted file mode 100644
index d61083b..0000000
--- a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- *
- * 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.job;
-
-import com.google.common.eventbus.EventBus;
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gsi.ssh.api.Cluster;
-import org.apache.airavata.gsi.ssh.api.SSHApiException;
-import org.apache.airavata.gsi.ssh.api.ServerInfo;
-import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gsi.ssh.impl.PBSCluster;
-import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
-import org.apache.airavata.gfac.monitor.MonitorID;
-import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
-import org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor;
-import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-public class AMQPMonitorTest {
-
-    private String myProxyUserName;
-    private String myProxyPassword;
-    private String certificateLocation;
-    private String pbsFilePath;
-    private String workingDirectory;
-    private HostDescription hostDescription;
-    private MonitorPublisher monitorPublisher;
-    private BlockingQueue<MonitorID> finishQueue;
-    private BlockingQueue<MonitorID> pushQueue;
-    private Thread pushThread;
-    private String proxyFilePath;
-    @Before
-    public void setUp() throws Exception {
-        System.setProperty("myproxy.username", "ogce");
-        System.setProperty("myproxy.password", "OpenGwy14");
-        System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
-        System.setProperty("gsi.working.directory", "/home1/01437/ogce");
-        System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
-        System.setProperty("proxy.file.path", "/Users/lahirugunathilake/Downloads/x509up_u503876");
-        myProxyUserName = System.getProperty("myproxy.username");
-        myProxyPassword = System.getProperty("myproxy.password");
-        workingDirectory = System.getProperty("gsi.working.directory");
-        certificateLocation = System.getProperty("trusted.cert.location");
-        proxyFilePath = System.getProperty("proxy.file.path");
-        System.setProperty("connection.name", "xsede");
-        if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) {
-            System.out.println(">>>>>> Please run tests with my proxy user name and password. " +
-                    "E.g :- mvn clean install -Dmyproxy.user=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<");
-            throw new Exception("Need my proxy user name password to run tests.");
-        }
-
-        monitorPublisher =  new MonitorPublisher(new EventBus());
-        pushQueue = new LinkedBlockingQueue<MonitorID>();
-        finishQueue = new LinkedBlockingQueue<MonitorID>();
-
-
-        AMQPMonitor amqpMonitor = new
-                AMQPMonitor(monitorPublisher,
-                pushQueue, finishQueue,proxyFilePath,"xsede",
-                Arrays.asList("info1.dyn.teragrid.org,info2.dyn.teragrid.org".split(",")));
-        try {
-            pushThread = (new Thread(amqpMonitor));
-            pushThread.start();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        hostDescription = new HostDescription(GsisshHostType.type);
-        hostDescription.getType().setHostAddress("login1.stampede.tacc.utexas.edu");
-        hostDescription.getType().setHostName("stampede-host");
-        ((GsisshHostType) hostDescription.getType()).setJobManager("slurm");
-        ((GsisshHostType) hostDescription.getType()).setInstalledPath("/usr/bin/");
-        ((GsisshHostType) hostDescription.getType()).setPort(2222);
-        ((GsisshHostType) hostDescription.getType()).setMonitorMode("push");
-    }
-
-    @Test
-    public void testAMQPMonitor() throws SSHApiException {
-        /* now have to submit a job to some machine and add that job to the queue */
-        //Create authentication
-        GSIAuthenticationInfo authenticationInfo
-                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
-                7512, 17280000, certificateLocation);
-
-        // Server info
-        ServerInfo serverInfo = new ServerInfo("ogce", "login1.stampede.tacc.utexas.edu",2222);
-
-
-        Cluster pbsCluster = new
-                PBSCluster(serverInfo, authenticationInfo, org.apache.airavata.gsi.ssh.util.CommonUtils.getPBSJobManager("/usr/bin/"));
-
-
-        // Execute command
-        System.out.println("Target PBS file path: " + workingDirectory);
-        // constructing the job object
-        JobDescriptor jobDescriptor = new JobDescriptor();
-        jobDescriptor.setWorkingDirectory(workingDirectory);
-        jobDescriptor.setShellName("/bin/bash");
-        jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
-        jobDescriptor.setExecutablePath("/bin/echo");
-        jobDescriptor.setAllEnvExport(true);
-        jobDescriptor.setMailOptions("n");
-        jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
-        jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
-        jobDescriptor.setNodes(1);
-        jobDescriptor.setProcessesPerNode(1);
-        jobDescriptor.setQueueName("normal");
-        jobDescriptor.setMaxWallTime("60");
-        jobDescriptor.setAcountString("TG-STA110014S");
-        List<String> inputs = new ArrayList<String>();
-        jobDescriptor.setOwner("ogce");
-        inputs.add("Hello World");
-        jobDescriptor.setInputValues(inputs);
-        //finished construction of job object
-        System.out.println(jobDescriptor.toXML());
-        String jobID = pbsCluster.submitBatchJob(jobDescriptor);
-        System.out.println(jobID);
-        try {
-            pushQueue.add(new MonitorID(hostDescription, jobID,null,null,null, "ogce"));
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        try {
-            pushThread.join();
-        } catch (InterruptedException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-        class InnerClassAMQP{
-            @Subscribe
-            private void getStatus(JobStatusChangeRequest status){
-                Assert.assertNotNull(status);
-                pushThread.interrupt();
-            }
-        }
-        monitorPublisher.registerListener(new InnerClassAMQP());
-//        try {
-//            pushThread.join(5000);
-//            Iterator<MonitorID> iterator = pushQueue.iterator();
-//            MonitorID next = iterator.next();
-//            org.junit.Assert.assertNotNull(next.getStatus());
-//        } catch (Exception e) {
-//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-//        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/553caa08/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/GFacConfigXmlTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/GFacConfigXmlTest.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/GFacConfigXmlTest.java
new file mode 100644
index 0000000..042db95
--- /dev/null
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/GFacConfigXmlTest.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * 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.job;
+
+import junit.framework.Assert;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.ExecutionMode;
+import org.apache.airavata.gfac.GFacConfiguration;
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.Scheduler;
+import org.apache.airavata.gfac.context.ApplicationContext;
+import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.cpi.GFacImpl;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+public class GFacConfigXmlTest {
+
+    private GFacImpl gfac;
+    @BeforeClass
+    public void setUp() throws Exception {
+        gfac = new GFacImpl();
+    }
+
+    @Test
+    public void testGFacConfigWithHost(){
+        Assert.assertNotNull(gfac.getGfacConfigFile());
+        Assert.assertEquals(1,gfac.getDaemonHandlers().size());
+        try {
+            JobExecutionContext jec = new JobExecutionContext(GFacConfiguration.create(gfac.getGfacConfigFile(), null, null), "testService");
+            ApplicationContext applicationContext = new ApplicationContext();
+            HostDescription host = new HostDescription(GsisshHostType.type);
+            host.getType().setHostAddress("trestles.sdsc.edu");
+            host.getType().setHostName("trestles");
+            ((GsisshHostType) host.getType()).setPort(22);
+            ((GsisshHostType) host.getType()).setInstalledPath("/opt/torque/bin/");
+            applicationContext.setHostDescription(host);
+            jec.setApplicationContext(applicationContext);
+            Scheduler.schedule(jec);
+            Assert.assertEquals(ExecutionMode.ASYNCHRONOUS, jec.getGFacConfiguration().getExecutionMode());
+            Assert.assertEquals("org.apache.airavata.job.TestProvider", jec.getProvider().getClass().getName());
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        } catch (IOException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        } catch (SAXException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        } catch (XPathExpressionException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        } catch (GFacException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+    @Test
+        public void testAppSpecificConfig(){
+            Assert.assertNotNull(gfac.getGfacConfigFile());
+            Assert.assertEquals(1,gfac.getDaemonHandlers().size());
+            try {
+                JobExecutionContext jec = new JobExecutionContext(GFacConfiguration.create(gfac.getGfacConfigFile(), null, null), "UltraScan");
+                ApplicationContext applicationContext = new ApplicationContext();
+                HostDescription host = new HostDescription(GsisshHostType.type);
+                host.getType().setHostAddress("trestles.sdsc.edu");
+                host.getType().setHostName("trestles");
+                ((GsisshHostType) host.getType()).setPort(22);
+                ((GsisshHostType) host.getType()).setInstalledPath("/opt/torque/bin/");
+                applicationContext.setHostDescription(host);
+                jec.setApplicationContext(applicationContext);
+                Scheduler.schedule(jec);
+                Assert.assertEquals(3, jec.getGFacConfiguration().getInHandlers().size());
+                Assert.assertEquals(1, jec.getGFacConfiguration().getInHandlers().get(0).getProperties().size());
+                Assert.assertEquals(0, jec.getGFacConfiguration().getInHandlers().get(1).getProperties().size());
+                Assert.assertEquals(1,jec.getGFacConfiguration().getInHandlers().get(2).getProperties().size());
+                Assert.assertEquals(ExecutionMode.ASYNCHRONOUS, jec.getGFacConfiguration().getExecutionMode());// todo this logic might be wrong
+                Assert.assertEquals("org.apache.airavata.job.TestProvider", jec.getProvider().getClass().getName());
+            } catch (ParserConfigurationException e) {
+                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            } catch (IOException e) {
+                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            } catch (SAXException e) {
+                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            } catch (XPathExpressionException e) {
+                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            } catch (GFacException e) {
+                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            }
+        }
+
+
+}


Mime
View raw message