airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [12/51] [abbrv] changing package names of gfac implementations
Date Wed, 21 May 2014 17:56:26 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/9bb8c2be/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
new file mode 100644
index 0000000..84b41e9
--- /dev/null
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
@@ -0,0 +1,220 @@
+/*
+ *
+ * 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.ssh.handler;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import net.schmizz.sshj.connection.ConnectionException;
+import net.schmizz.sshj.transport.TransportException;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
+import org.apache.airavata.gfac.handler.AbstractHandler;
+import org.apache.airavata.gfac.handler.GFacHandlerException;
+import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
+import org.apache.airavata.gfac.utils.GFacUtils;
+import org.apache.airavata.gfac.utils.OutputUtils;
+import org.apache.airavata.gsi.ssh.api.Cluster;
+import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
+import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.apache.airavata.schemas.gfac.URIParameterType;
+import org.apache.xmlbeans.XmlException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SSHOutputHandler extends AbstractHandler {
+    private static final Logger log = LoggerFactory.getLogger(SSHOutputHandler.class);
+
+    public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
+        if (jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof GsisshHostType) { // this is because we don't have the right jobexecution context
+            // so attempting to get it from the registry
+            if (Constants.PUSH.equals(((GsisshHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getMonitorMode())) { // this is because we don't have the right jobexecution context
+                // so attempting to get it from the registry
+                log.warn("During the out handler chain jobExecution context came null, so trying to handler");
+                ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
+                TaskDetails taskData = null;
+                try {
+                    taskData = (TaskDetails) registry.get(DataType.TASK_DETAIL, jobExecutionContext.getTaskData().getTaskID());
+                } catch (RegistryException e) {
+                    log.error("Error retrieving job details from Registry");
+                    throw new GFacHandlerException("Error retrieving job details from Registry", e);
+                }
+                JobDetails jobDetails = taskData.getJobDetailsList().get(0);
+                String jobDescription = jobDetails.getJobDescription();
+                if (jobDescription != null) {
+                    JobDescriptor jobDescriptor = null;
+                    try {
+                        jobDescriptor = JobDescriptor.fromXML(jobDescription);
+                    } catch (XmlException e1) {
+                        e1.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+                    }
+                    applicationDeploymentDescription.getType().setScratchWorkingDirectory(
+                            jobDescriptor.getJobDescriptorDocument().getJobDescriptor().getWorkingDirectory());
+                    applicationDeploymentDescription.getType().setInputDataDirectory(jobDescriptor.getInputDirectory());
+                    applicationDeploymentDescription.getType().setOutputDataDirectory(jobDescriptor.getOutputDirectory());
+                    applicationDeploymentDescription.getType().setStandardError(jobDescriptor.getJobDescriptorDocument().getJobDescriptor().getStandardErrorFile());
+                    applicationDeploymentDescription.getType().setStandardOutput(jobDescriptor.getJobDescriptorDocument().getJobDescriptor().getStandardOutFile());
+                }
+            }
+        }
+
+        try {
+            if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null) {
+
+                GFACSSHUtils.addSecurityContext(jobExecutionContext);
+            }
+        } catch (ApplicationSettingsException e) {
+            log.error(e.getMessage());
+            throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
+        } catch (GFacException e1) {
+            log.error(e1.getMessage());
+            throw new GFacHandlerException("Error while creating SSHSecurityContext", e1, e1.getLocalizedMessage());
+        }
+
+        super.invoke(jobExecutionContext);
+        DataTransferDetails detail = new DataTransferDetails();
+        TransferStatus status = new TransferStatus();
+
+        ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext()
+                .getApplicationDeploymentDescription().getType();
+        try {
+            Cluster cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
+            if (cluster == null) {
+                throw new GFacProviderException("Security context is not set properly");
+            } else {
+                log.info("Successfully retrieved the Security Context");
+            }
+
+            // Get the Stdouts and StdErrs
+            String timeStampedServiceName = GFacUtils.createUniqueNameForService(jobExecutionContext.getServiceName());
+
+            TaskDetails taskData = jobExecutionContext.getTaskData();
+            String outputDataDir = null;
+            File localStdOutFile;
+            File localStdErrFile;
+
+            if (taskData.getAdvancedOutputDataHandling() != null) {
+                outputDataDir = taskData.getAdvancedOutputDataHandling().getOutputDataDir();
+            }
+            if (outputDataDir == null) {
+                outputDataDir = File.separator + "tmp";
+            }
+            outputDataDir = outputDataDir + File.separator + jobExecutionContext.getExperimentID() + "-" + jobExecutionContext.getTaskData().getTaskID();
+            (new File(outputDataDir)).mkdirs();
+
+
+            localStdOutFile = new File(outputDataDir + File.separator + timeStampedServiceName + "stdout");
+            localStdErrFile = new File(outputDataDir + File.separator + timeStampedServiceName + "stderr");
+//            cluster.makeDirectory(outputDataDir);
+            cluster.scpFrom(app.getStandardOutput(), localStdOutFile.getAbsolutePath());
+            Thread.sleep(1000);
+            cluster.scpFrom(app.getStandardError(), localStdErrFile.getAbsolutePath());
+            Thread.sleep(1000);
+
+            String stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath());
+            String stdErrStr = GFacUtils.readFileToString(localStdErrFile.getAbsolutePath());
+            status.setTransferState(TransferState.COMPLETE);
+            detail.setTransferStatus(status);
+            detail.setTransferDescription("STDOUT:" + stdOutStr);
+            registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+
+            status.setTransferState(TransferState.COMPLETE);
+            detail.setTransferStatus(status);
+            detail.setTransferDescription("STDERR:" + stdErrStr);
+            registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+
+
+            Map<String, ActualParameter> stringMap = new HashMap<String, ActualParameter>();
+            Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters();
+            Set<String> keys = output.keySet();
+            for (String paramName : keys) {
+                ActualParameter actualParameter = (ActualParameter) output.get(paramName);
+                if ("URI".equals(actualParameter.getType().getType().toString())) {
+
+                    List<String> outputList = cluster.listDirectory(app.getOutputDataDirectory());
+                    if (outputList.size() == 0 || outputList.get(0).isEmpty()) {
+                        stringMap = OutputUtils.fillOutputFromStdout(output, stdOutStr, stdErrStr);
+                    } else {
+                        String valueList = outputList.get(0);
+                        cluster.scpFrom(app.getOutputDataDirectory() + File.separator + valueList, outputDataDir);
+                        jobExecutionContext.addOutputFile(outputDataDir + File.separator + valueList);
+                        ((URIParameterType) actualParameter.getType()).setValue(valueList);
+                        stringMap = new HashMap<String, ActualParameter>();
+                        stringMap.put(paramName, actualParameter);
+                    }
+                } else {
+                    stringMap = OutputUtils.fillOutputFromStdout(output, stdOutStr, stdErrStr);
+                }
+            }
+            if (stringMap == null || stringMap.isEmpty()) {
+                throw new GFacHandlerException(
+                        "Empty Output returned from the Application, Double check the application"
+                                + "and ApplicationDescriptor output Parameter Names");
+            }
+            status.setTransferState(TransferState.DOWNLOAD);
+            detail.setTransferStatus(status);
+            registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+
+            app.setStandardError(localStdErrFile.getAbsolutePath());
+            app.setStandardOutput(localStdOutFile.getAbsolutePath());
+            app.setOutputDataDirectory(outputDataDir);
+        } catch (XmlException e) {
+            throw new GFacHandlerException("Cannot read output:" + e.getMessage(), e);
+        } catch (ConnectionException e) {
+            throw new GFacHandlerException(e.getMessage(), e);
+        } catch (TransportException e) {
+            throw new GFacHandlerException(e.getMessage(), e);
+        } catch (IOException e) {
+            throw new GFacHandlerException(e.getMessage(), e);
+        } catch (Exception e) {
+            try {
+                status.setTransferState(TransferState.FAILED);
+                detail.setTransferStatus(status);
+                registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID());
+                GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
+            } catch (Exception e1) {
+                throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage());
+            }
+            throw new GFacHandlerException("Error in retrieving results", e);
+        }
+
+    }
+
+    public void initProperties(Map<String, String> properties) throws GFacHandlerException {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9bb8c2be/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/impl/SSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/impl/SSHProvider.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/impl/SSHProvider.java
new file mode 100644
index 0000000..ee3dcd2
--- /dev/null
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/impl/SSHProvider.java
@@ -0,0 +1,310 @@
+/*
+ *
+ * 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.ssh.impl;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.Set;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+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.GFacException;
+import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
+import org.apache.airavata.gfac.handler.GFacHandlerException;
+import org.apache.airavata.gfac.notification.events.StartExecutionEvent;
+import org.apache.airavata.gfac.provider.AbstractProvider;
+import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
+import org.apache.airavata.gfac.utils.GFacUtils;
+import org.apache.airavata.gsi.ssh.api.Cluster;
+import org.apache.airavata.gsi.ssh.api.CommandExecutor;
+import org.apache.airavata.gsi.ssh.api.SSHApiException;
+import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
+import org.apache.airavata.gsi.ssh.impl.RawCommandInfo;
+import org.apache.airavata.gsi.ssh.impl.StandardOutReader;
+import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
+import org.apache.airavata.model.workspace.experiment.ErrorCategory;
+import org.apache.airavata.model.workspace.experiment.JobDetails;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.apache.airavata.schemas.gfac.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
+
+/**
+ * Execute application using remote SSH
+ */
+public class SSHProvider extends AbstractProvider {
+    private static final Logger log = LoggerFactory.getLogger(SSHProvider.class);
+    private Cluster cluster;
+    private String jobID = null;
+    private String taskID = null;
+    // we keep gsisshprovider to support qsub submission incase of hpc scenario with ssh
+    private boolean hpcType = false;
+
+    public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
+    	super.initialize(jobExecutionContext);
+    	 if(jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null){
+            try {
+                GFACSSHUtils.addSecurityContext(jobExecutionContext);
+            } catch (ApplicationSettingsException e) {
+                log.error(e.getMessage());
+                throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
+            }
+        }
+        taskID = jobExecutionContext.getTaskData().getTaskID();
+		if (!((SSHHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getHpcResource()) {
+            jobID = "SSH_" + jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress() + "_" + Calendar.getInstance().getTimeInMillis();
+            cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
+            
+            ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
+            String remoteFile = app.getStaticWorkingDirectory() + File.separatorChar + Constants.EXECUTABLE_NAME;
+            details.setJobID(taskID);
+            details.setJobDescription(remoteFile);
+            jobExecutionContext.setJobDetails(details);
+            JobDescriptor jobDescriptor = GFACSSHUtils.createJobDescriptor(jobExecutionContext, app, null);
+            details.setJobDescription(jobDescriptor.toXML());
+         
+            GFacUtils.saveJobStatus(jobExecutionContext, details, JobState.SETUP);
+            log.info(remoteFile);
+            try {
+            	File runscript = createShellScript(jobExecutionContext);
+                cluster.scpTo(remoteFile, runscript.getAbsolutePath());
+            } catch (Exception e) {
+                throw new GFacProviderException(e.getLocalizedMessage(), e);
+            }
+        }else{
+           hpcType = true;
+        }
+    }
+
+
+    public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException {
+        if (!hpcType) {
+            ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
+            try {
+                /*
+                 * Execute
+                 */
+                String execuable = app.getStaticWorkingDirectory() + File.separatorChar + Constants.EXECUTABLE_NAME;
+                details.setJobDescription(execuable);
+
+//                GFacUtils.updateJobStatus(details, JobState.SUBMITTED);
+                RawCommandInfo rawCommandInfo = new RawCommandInfo("/bin/chmod 755 " + execuable + "; " + execuable);
+
+                StandardOutReader jobIDReaderCommandOutput = new StandardOutReader();
+                
+                CommandExecutor.executeCommand(rawCommandInfo, cluster.getSession(), jobIDReaderCommandOutput);
+                String stdOutputString = getOutputifAvailable(jobIDReaderCommandOutput, "Error submitting job to resource");
+
+                log.info("stdout=" + stdOutputString);
+             
+//                GFacUtils.updateJobStatus(details, JobState.COMPLETE);
+            } catch (Exception e) {
+                throw new GFacProviderException(e.getMessage(), e);
+            } finally {
+                if (cluster != null) {
+                	try {
+						cluster.disconnect();
+					} catch (SSHApiException e) {
+						throw new GFacProviderException(e.getMessage(), e);
+					}
+                }
+            }
+        } else {
+            try {
+                jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
+                HostDescriptionType host = jobExecutionContext.getApplicationContext().
+                        getHostDescription().getType();
+                HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) jobExecutionContext.getApplicationContext().
+                        getApplicationDeploymentDescription().getType();
+                JobDetails jobDetails = new JobDetails();
+                String taskID = jobExecutionContext.getTaskData().getTaskID();
+                try {
+                    Cluster cluster = null;
+                    if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) != null) {
+                        cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
+                    }
+                    if (cluster == null) {
+                        throw new GFacProviderException("Security context is not set properly");
+                    } else {
+                        log.info("Successfully retrieved the Security Context");
+                    }
+                    // This installed path is a mandetory field, because this could change based on the computing resource
+                    JobDescriptor jobDescriptor = GFACSSHUtils.createJobDescriptor(jobExecutionContext, app, cluster);
+
+                    log.info(jobDescriptor.toXML());
+
+                    jobDetails.setJobDescription(jobDescriptor.toXML());
+
+                    String jobID = cluster.submitBatchJob(jobDescriptor);
+                    jobExecutionContext.setJobDetails(jobDetails);
+                    if (jobID == null) {
+                        jobDetails.setJobID("none");
+                        GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.FAILED);
+                    } else {
+                        jobDetails.setJobID(jobID);
+                        GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.SUBMITTED);
+                    }
+
+                } catch (SSHApiException e) {
+                    String error = "Error submitting the job to host " + host.getHostAddress() + " message: " + e.getMessage();
+                    log.error(error);
+                    jobDetails.setJobID("none");
+                    GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.FAILED);
+                    GFacUtils.saveErrorDetails(jobExecutionContext, error, CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+                    throw new GFacProviderException(error, e);
+                } catch (Exception e) {
+                    String error = "Error submitting the job to host " + host.getHostAddress() + " message: " + e.getMessage();
+                    log.error(error);
+                    jobDetails.setJobID("none");
+                    GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.FAILED);
+                    GFacUtils.saveErrorDetails(jobExecutionContext, error, CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+                    throw new GFacProviderException(error, e);
+                }
+            } catch (GFacException e) {
+                throw new GFacProviderException(e.getMessage(), e);
+            }
+        }
+    }
+
+    public void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException {
+
+    }
+
+
+    public void cancelJob(String jobId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+
+    private File createShellScript(JobExecutionContext context) throws IOException {
+        ApplicationDeploymentDescriptionType app = context.getApplicationContext()
+                .getApplicationDeploymentDescription().getType();
+        String uniqueDir = app.getApplicationName().getStringValue() + System.currentTimeMillis()
+                + new Random().nextLong();
+
+        File shellScript = File.createTempFile(uniqueDir, "sh");
+        OutputStream out = new FileOutputStream(shellScript);
+
+        out.write("#!/bin/bash\n".getBytes());
+        out.write(("cd " + app.getStaticWorkingDirectory() + "\n").getBytes());
+        out.write(("export " + Constants.INPUT_DATA_DIR_VAR_NAME + "=" + app.getInputDataDirectory() + "\n").getBytes());
+        out.write(("export " + Constants.OUTPUT_DATA_DIR_VAR_NAME + "=" + app.getOutputDataDirectory() + "\n")
+                .getBytes());
+        // get the env of the host and the application
+        NameValuePairType[] env = app.getApplicationEnvironmentArray();
+
+        Map<String, String> nv = new HashMap<String, String>();
+        if (env != null) {
+            for (int i = 0; i < env.length; i++) {
+                String key = env[i].getName();
+                String value = env[i].getValue();
+                nv.put(key, value);
+            }
+        }
+        for (Entry<String, String> entry : nv.entrySet()) {
+            log.debug("Env[" + entry.getKey() + "] = " + entry.getValue());
+            out.write(("export " + entry.getKey() + "=" + entry.getValue() + "\n").getBytes());
+
+        }
+
+        // prepare the command
+        final String SPACE = " ";
+        StringBuffer cmd = new StringBuffer();
+        cmd.append(app.getExecutableLocation());
+        cmd.append(SPACE);
+
+        MessageContext input = context.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())) {
+                String[] values = ((URIArrayType) actualParameter.getType()).getValueArray();
+                for (String value : values) {
+                    cmd.append(value);
+                    cmd.append(SPACE);
+                }
+            } else {
+                String paramValue = MappingFactory.toString(actualParameter);
+                cmd.append(paramValue);
+                cmd.append(SPACE);
+            }
+        }
+        // We redirect the error and stdout to remote files, they will be read
+        // in later
+        cmd.append(SPACE);
+        cmd.append("1>");
+        cmd.append(SPACE);
+        cmd.append(app.getStandardOutput());
+        cmd.append(SPACE);
+        cmd.append("2>");
+        cmd.append(SPACE);
+        cmd.append(app.getStandardError());
+
+        String cmdStr = cmd.toString();
+        log.info("Command = " + cmdStr);
+        out.write((cmdStr + "\n").getBytes());
+        String message = "\"execuationSuceeded\"";
+        out.write(("echo " + message + "\n").getBytes());
+        out.close();
+
+        return shellScript;
+    }
+
+    public void initProperties(Map<String, String> properties) throws GFacProviderException, GFacException {
+
+    }
+    /**
+     * This method will read standard output and if there's any it will be parsed
+     * @param jobIDReaderCommandOutput
+     * @param errorMsg
+     * @return
+     * @throws SSHApiException
+     */
+    private String getOutputifAvailable(StandardOutReader jobIDReaderCommandOutput, String errorMsg) throws SSHApiException {
+        String stdOutputString = jobIDReaderCommandOutput.getStdOutputString();
+        String stdErrorString = jobIDReaderCommandOutput.getStdErrorString();
+
+        if(stdOutputString == null || stdOutputString.isEmpty() || (stdErrorString != null && !stdErrorString.isEmpty())){
+            log.error("Standard Error output : " + stdErrorString);
+            throw new SSHApiException(errorMsg + stdErrorString);
+        }
+        return stdOutputString;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9bb8c2be/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/SSHSecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/SSHSecurityContext.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/SSHSecurityContext.java
new file mode 100644
index 0000000..da05cdd
--- /dev/null
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/SSHSecurityContext.java
@@ -0,0 +1,120 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.airavata.gfac.ssh.security;
+
+import java.io.IOException;
+
+import net.schmizz.sshj.SSHClient;
+import net.schmizz.sshj.connection.channel.direct.Session;
+import net.schmizz.sshj.userauth.keyprovider.KeyProvider;
+
+import org.apache.airavata.gfac.SecurityContext;
+import org.apache.airavata.gsi.ssh.api.Cluster;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Handle SSH security
+ */
+public class SSHSecurityContext implements SecurityContext {
+	private static final Logger log = LoggerFactory.getLogger(SSHSecurityContext.class);
+
+	public static final String SSH_SECURITY_CONTEXT = "ssh";
+
+	private String username;
+	private String privateKeyLoc;
+	private String keyPass;
+	private SSHClient sshClient;
+	private Session session;
+
+    private Cluster pbsCluster;
+
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public String getPrivateKeyLoc() {
+		return privateKeyLoc;
+	}
+
+	public void setPrivateKeyLoc(String privateKeyLoc) {
+		this.privateKeyLoc = privateKeyLoc;
+	}
+
+	public String getKeyPass() {
+		return keyPass;
+	}
+
+	public void setKeyPass(String keyPass) {
+		this.keyPass = keyPass;
+	}
+
+	public void closeSession(Session session) {
+		if (session != null) {
+			try {
+				session.close();
+			} catch (Exception e) {
+				log.warn("Cannot Close SSH Session");
+			}
+		}
+	}
+
+	public Session getSession(String hostAddress) throws IOException {
+		try {
+			if (sshClient == null) {
+				sshClient = new SSHClient();
+			}
+			if (getSSHClient().isConnected())
+				return getSSHClient().startSession();
+
+			KeyProvider pkey = getSSHClient().loadKeys(getPrivateKeyLoc(), getKeyPass());
+
+			getSSHClient().loadKnownHosts();
+
+			getSSHClient().connect(hostAddress);
+			getSSHClient().authPublickey(getUsername(), pkey);
+			session = getSSHClient().startSession();
+			return session;
+
+		} catch (NullPointerException ne) {
+			throw new SecurityException("Cannot load security context for SSH", ne);
+		}
+	}
+
+	public SSHClient getSSHClient() {
+		if (sshClient == null) {
+			sshClient = new SSHClient();
+		}
+		return sshClient;
+	}
+
+    public void setPbsCluster(Cluster pbsCluster) {
+        this.pbsCluster = pbsCluster;
+    }
+
+    public Cluster getPbsCluster() {
+        return this.pbsCluster;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9bb8c2be/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
new file mode 100644
index 0000000..03f1770
--- /dev/null
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
@@ -0,0 +1,179 @@
+/*
+ *
+ * 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.ssh.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.MappingFactory;
+import org.apache.airavata.gfac.Constants;
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
+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.AuthenticationInfo;
+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.DefaultPasswordAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
+import org.apache.airavata.gsi.ssh.util.CommonUtils;
+import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.schemas.gfac.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+
+public class GFACSSHUtils {
+    private final static Logger logger = LoggerFactory.getLogger(GFACSSHUtils.class);
+
+    public static void addSecurityContext(JobExecutionContext jobExecutionContext) throws GFacException, ApplicationSettingsException {
+        HostDescription registeredHost = jobExecutionContext.getApplicationContext().getHostDescription();
+        if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType() instanceof UnicoreHostType
+                || registeredHost.getType() instanceof GsisshHostType) {
+            logger.error("This is a wrong method to invoke to non ssh host types,please check your gfac-config.xml");
+        } else if (registeredHost.getType() instanceof SSHHostType) {
+            Properties configurationProperties = ServerSettings.getProperties();
+            String sshUserName = configurationProperties.getProperty(Constants.SSH_USER_NAME);
+            String sshPrivateKey = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY);
+            String sshPrivateKeyPass = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS);
+            String sshPassword = configurationProperties.getProperty(Constants.SSH_PASSWORD);
+            String sshPublicKey = configurationProperties.getProperty(Constants.SSH_PUBLIC_KEY);
+            SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
+            AuthenticationInfo authenticationInfo = null;
+            // we give higher preference to the password over keypair ssh authentication
+            if (sshPassword != null) {
+                authenticationInfo = new DefaultPasswordAuthenticationInfo(sshPassword);
+            } else {
+                authenticationInfo = new DefaultPublicKeyFileAuthentication(sshPublicKey, sshPrivateKey, sshPrivateKeyPass);
+            }
+            ServerInfo serverInfo = new ServerInfo(sshUserName, registeredHost.getType().getHostAddress());
+
+            Cluster pbsCluster = null;
+            try {
+                String installedParentPath = "/";
+                if (((SSHHostType) registeredHost.getType()).getHpcResource()) {
+                    installedParentPath = ((HpcApplicationDeploymentType)
+                            jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
+                }
+                pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
+                        CommonUtils.getPBSJobManager(installedParentPath));
+            } catch (SSHApiException e) {
+                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            }
+            sshSecurityContext.setPbsCluster(pbsCluster);
+            sshSecurityContext.setUsername(sshUserName);
+            jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, sshSecurityContext);
+        }
+    }
+    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/9bb8c2be/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/util/GFACSSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/util/GFACSSHUtils.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/util/GFACSSHUtils.java
deleted file mode 100644
index 9146bfd..0000000
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/util/GFACSSHUtils.java
+++ /dev/null
@@ -1,180 +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.util;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.commons.gfac.type.ActualParameter;
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.commons.gfac.type.MappingFactory;
-import org.apache.airavata.gfac.Constants;
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.RequestData;
-import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gfac.context.security.SSHSecurityContext;
-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.AuthenticationInfo;
-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.DefaultPasswordAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
-import org.apache.airavata.gsi.ssh.util.CommonUtils;
-import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.apache.airavata.schemas.gfac.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-public class GFACSSHUtils {
-    private final static Logger logger = LoggerFactory.getLogger(GFACSSHUtils.class);
-
-    public static void addSecurityContext(JobExecutionContext jobExecutionContext) throws GFacException, ApplicationSettingsException {
-        HostDescription registeredHost = jobExecutionContext.getApplicationContext().getHostDescription();
-        if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType() instanceof UnicoreHostType
-                || registeredHost.getType() instanceof GsisshHostType) {
-            logger.error("This is a wrong method to invoke to non ssh host types,please check your gfac-config.xml");
-        } else if (registeredHost.getType() instanceof SSHHostType) {
-            Properties configurationProperties = ServerSettings.getProperties();
-            String sshUserName = configurationProperties.getProperty(Constants.SSH_USER_NAME);
-            String sshPrivateKey = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY);
-            String sshPrivateKeyPass = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS);
-            String sshPassword = configurationProperties.getProperty(Constants.SSH_PASSWORD);
-            String sshPublicKey = configurationProperties.getProperty(Constants.SSH_PUBLIC_KEY);
-            SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
-            AuthenticationInfo authenticationInfo = null;
-            // we give higher preference to the password over keypair ssh authentication
-            if (sshPassword != null) {
-                authenticationInfo = new DefaultPasswordAuthenticationInfo(sshPassword);
-            } else {
-                authenticationInfo = new DefaultPublicKeyFileAuthentication(sshPublicKey, sshPrivateKey, sshPrivateKeyPass);
-            }
-            ServerInfo serverInfo = new ServerInfo(sshUserName, registeredHost.getType().getHostAddress());
-
-            Cluster pbsCluster = null;
-            try {
-                String installedParentPath = "/";
-                if (((SSHHostType) registeredHost.getType()).getHpcResource()) {
-                    installedParentPath = ((HpcApplicationDeploymentType)
-                            jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
-                }
-                pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
-                        CommonUtils.getPBSJobManager(installedParentPath));
-            } catch (SSHApiException e) {
-                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-            }
-            sshSecurityContext.setPbsCluster(pbsCluster);
-            sshSecurityContext.setUsername(sshUserName);
-            jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, sshSecurityContext);
-        }
-    }
-    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/9bb8c2be/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
index 8d83174..8c42869 100644
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
+++ b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
@@ -30,7 +30,7 @@ import org.apache.airavata.gfac.SecurityContext;
 import org.apache.airavata.gfac.context.ApplicationContext;
 import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
 import org.apache.airavata.gfac.cpi.GFacImpl;
 import org.apache.airavata.gsi.ssh.api.Cluster;
 import org.apache.airavata.gsi.ssh.api.SSHApiException;
@@ -44,7 +44,6 @@ import org.apache.airavata.gsi.ssh.util.CommonUtils;
 import org.apache.airavata.model.workspace.experiment.TaskDetails;
 import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
 import org.apache.airavata.schemas.gfac.*;
-import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/9bb8c2be/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
index 60b941a..74a79e0 100644
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
+++ b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
@@ -37,7 +37,7 @@ import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.ApplicationContext;
 import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.context.MessageContext;
-import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
 import org.apache.airavata.gfac.cpi.GFacImpl;
 import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
 import org.apache.airavata.schemas.gfac.InputParameterType;

http://git-wip-us.apache.org/repos/asf/airavata/blob/9bb8c2be/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml b/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml
index 85d148d..2388f64 100644
--- a/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml
+++ b/modules/gfac/gfac-ssh/src/test/resources/gfac-config.xml
@@ -21,13 +21,31 @@
     </GlobalHandlers>
 
 
-     <Provider class="org.apache.airavata.gfac.provider.impl.SSHProvider" host="org.apache.airavata.schemas.gfac.impl.SSHHostTypeImpl">
-         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SSHDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.SSHInputHandler"/>
-        </InHandlers>
-        <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SSHOutputHandler"/>
-        </OutHandlers>
-    </Provider>
+     <Provider class="org.apache.airavata.gfac.gsissh.provider.impl.GSISSHProvider" host="org.apache.airavata.schemas.gfac.impl.GsisshHostTypeImpl" executionMode="async">
+             <InHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHDirectorySetupHandler"/>
+                 <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPInputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw98.iu.xsede.org"/>
+                        <property name="inputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHInputHandler"/>
+            </InHandlers>
+            <OutHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHOutputHandler"/>
+                <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPOutputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw111.iu.xsede.org"/>
+                        <property name="outputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+            </OutHandlers>
+        </Provider>
 </GFac>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9bb8c2be/modules/integration-tests/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/resources/gfac-config.xml b/modules/integration-tests/src/test/resources/gfac-config.xml
index 61dca4f..06afc6e 100644
--- a/modules/integration-tests/src/test/resources/gfac-config.xml
+++ b/modules/integration-tests/src/test/resources/gfac-config.xml
@@ -11,6 +11,11 @@
     ~ under the License. -->
     
 <GFac>
+    <DaemonHandlers>
+        <Handler class="org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler">
+                <property name="listeners" value="org.apache.airavata.gfac.monitor.AiravataJobStatusUpdator"/>
+        </Handler>
+    </DaemonHandlers>
     <GlobalHandlers>
         <InHandlers>
             <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
@@ -19,31 +24,24 @@
         </InHandlers>
         <OutHandlers></OutHandlers>
     </GlobalHandlers>
-    <Provider class="org.apache.airavata.gfac.provider.impl.LocalProvider" host="org.apache.airavata.schemas.gfac.impl.HostDescriptionTypeImpl">
+    <Provider class="org.apache.airavata.gfac.local.impl.LocalProvider" host="org.apache.airavata.schemas.gfac.impl.HostDescriptionTypeImpl">
         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.LocalDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.local.handler.LocalDirectorySetupHandler"/>
         </InHandlers>
     </Provider>
-    <Provider class="org.apache.airavata.gfac.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
+   <Provider class="org.apache.airavata.gfac.gram.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
         <property name="name" value="value"/>
         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler">
+            <Handler class="org.apache.airavata.gfac..gram.handler.GramDirectorySetupHandler">
                     <property name="name" value="value"/>
             </Handler>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+            <Handler class="org.apache.airavata.gfac..gram.handler.GridFTPInputHandler"/>
         </InHandlers>
         <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+            <Handler class="org.apache.airavata.gfac..gram.handler.GridFTPOutputHandler"/>
         </OutHandlers>
     </Provider>
-      <Provider class="org.apache.airavata.gfac.provider.impl.BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
-        <InHandlers>
-        	<Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
-        </InHandlers>
-        <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
-        </OutHandlers>
+    <Provider class="org.apache.airavata.gfac.bes.provider.impl.BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
     </Provider>
 
     <Provider class="org.apache.airavata.gfac.ec2.EC2Provider" host="org.apache.airavata.schemas.gfac.impl.Ec2HostTypeImpl">
@@ -51,40 +49,58 @@
         <OutHandlers/>
     </Provider>
 
-    <Provider class="org.apache.airavata.gfac.provider.impl.HadoopProvider" host="org.apache.airavata.schemas.gfac.impl.HadoopHostTypeImpl">
+    <Provider class="org.apache.airavata.gfac.hadoop.provider.impl.HadoopProvider" host="org.apache.airavata.schemas.gfac.impl.HadoopHostTypeImpl">
         <InHandlers>
-        	<Handler class="org.apache.airavata.gfac.handler.HadoopDeploymentHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.HDFSDataMovementHandler"/>
+                <Handler class="org.apache.airavata.gfac.hadoop.handler.HadoopDeploymentHandler"/>
+            <Handler class="org.apache.airavata.gfac.hadoop.handler.HDFSDataMovementHandler"/>
         </InHandlers>
         <OutHandlers/>
     </Provider>
 
     <Application name="UltraScan">
         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+            <Handler class="org.apache.airavata.gfac.handler.GfacDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.gram.handler.GridFTPInputHandler"/>
         </InHandlers>
         <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+            <Handler class="org.apache.airavata.gfac.gram.handler.GridFTPOutputHandler"/>
         </OutHandlers>
     </Application>
 
-     <Provider class="org.apache.airavata.gfac.provider.impl.SSHProvider" host="org.apache.airavata.schemas.gfac.impl.SSHHostTypeImpl">
-         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.SCPInputHandler"/>
-        </InHandlers>
-        <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPOutputHandler"/>
-        </OutHandlers>
-    </Provider>
-     <Provider class="org.apache.airavata.gfac.provider.impl.GSISSHProvider" host="org.apache.airavata.schemas.gfac.impl.GsisshHostTypeImpl">
+     <Provider class="org.apache.airavata.gfac.ssh.provider.impl.SSHProvider" host="org.apache.airavata.schemas.gfac.impl.SSHHostTypeImpl">
          <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.SCPInputHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHInputHandler"/>
         </InHandlers>
         <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPOutputHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHOutputHandler"/>
         </OutHandlers>
     </Provider>
+    <Provider class="org.apache.airavata.gfac.gsissh.provider.impl.GSISSHProvider" host="org.apache.airavata.schemas.gfac.impl.GsisshHostTypeImpl" executionMode="async">
+             <InHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHDirectorySetupHandler"/>
+                 <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPInputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw98.iu.xsede.org"/>
+                        <property name="inputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHInputHandler"/>
+            </InHandlers>
+            <OutHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHOutputHandler"/>
+                <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPOutputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw111.iu.xsede.org"/>
+                        <property name="outputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+            </OutHandlers>
+        </Provider>
 </GFac>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9bb8c2be/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml b/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml
index 61dca4f..06afc6e 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/resources/gfac-config.xml
@@ -11,6 +11,11 @@
     ~ under the License. -->
     
 <GFac>
+    <DaemonHandlers>
+        <Handler class="org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler">
+                <property name="listeners" value="org.apache.airavata.gfac.monitor.AiravataJobStatusUpdator"/>
+        </Handler>
+    </DaemonHandlers>
     <GlobalHandlers>
         <InHandlers>
             <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
@@ -19,31 +24,24 @@
         </InHandlers>
         <OutHandlers></OutHandlers>
     </GlobalHandlers>
-    <Provider class="org.apache.airavata.gfac.provider.impl.LocalProvider" host="org.apache.airavata.schemas.gfac.impl.HostDescriptionTypeImpl">
+    <Provider class="org.apache.airavata.gfac.local.impl.LocalProvider" host="org.apache.airavata.schemas.gfac.impl.HostDescriptionTypeImpl">
         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.LocalDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.local.handler.LocalDirectorySetupHandler"/>
         </InHandlers>
     </Provider>
-    <Provider class="org.apache.airavata.gfac.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
+   <Provider class="org.apache.airavata.gfac.gram.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
         <property name="name" value="value"/>
         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler">
+            <Handler class="org.apache.airavata.gfac..gram.handler.GramDirectorySetupHandler">
                     <property name="name" value="value"/>
             </Handler>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+            <Handler class="org.apache.airavata.gfac..gram.handler.GridFTPInputHandler"/>
         </InHandlers>
         <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+            <Handler class="org.apache.airavata.gfac..gram.handler.GridFTPOutputHandler"/>
         </OutHandlers>
     </Provider>
-      <Provider class="org.apache.airavata.gfac.provider.impl.BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
-        <InHandlers>
-        	<Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
-        </InHandlers>
-        <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
-        </OutHandlers>
+    <Provider class="org.apache.airavata.gfac.bes.provider.impl.BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
     </Provider>
 
     <Provider class="org.apache.airavata.gfac.ec2.EC2Provider" host="org.apache.airavata.schemas.gfac.impl.Ec2HostTypeImpl">
@@ -51,40 +49,58 @@
         <OutHandlers/>
     </Provider>
 
-    <Provider class="org.apache.airavata.gfac.provider.impl.HadoopProvider" host="org.apache.airavata.schemas.gfac.impl.HadoopHostTypeImpl">
+    <Provider class="org.apache.airavata.gfac.hadoop.provider.impl.HadoopProvider" host="org.apache.airavata.schemas.gfac.impl.HadoopHostTypeImpl">
         <InHandlers>
-        	<Handler class="org.apache.airavata.gfac.handler.HadoopDeploymentHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.HDFSDataMovementHandler"/>
+                <Handler class="org.apache.airavata.gfac.hadoop.handler.HadoopDeploymentHandler"/>
+            <Handler class="org.apache.airavata.gfac.hadoop.handler.HDFSDataMovementHandler"/>
         </InHandlers>
         <OutHandlers/>
     </Provider>
 
     <Application name="UltraScan">
         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+            <Handler class="org.apache.airavata.gfac.handler.GfacDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.gram.handler.GridFTPInputHandler"/>
         </InHandlers>
         <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+            <Handler class="org.apache.airavata.gfac.gram.handler.GridFTPOutputHandler"/>
         </OutHandlers>
     </Application>
 
-     <Provider class="org.apache.airavata.gfac.provider.impl.SSHProvider" host="org.apache.airavata.schemas.gfac.impl.SSHHostTypeImpl">
-         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.SCPInputHandler"/>
-        </InHandlers>
-        <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPOutputHandler"/>
-        </OutHandlers>
-    </Provider>
-     <Provider class="org.apache.airavata.gfac.provider.impl.GSISSHProvider" host="org.apache.airavata.schemas.gfac.impl.GsisshHostTypeImpl">
+     <Provider class="org.apache.airavata.gfac.ssh.provider.impl.SSHProvider" host="org.apache.airavata.schemas.gfac.impl.SSHHostTypeImpl">
          <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.SCPInputHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHInputHandler"/>
         </InHandlers>
         <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPOutputHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHOutputHandler"/>
         </OutHandlers>
     </Provider>
+    <Provider class="org.apache.airavata.gfac.gsissh.provider.impl.GSISSHProvider" host="org.apache.airavata.schemas.gfac.impl.GsisshHostTypeImpl" executionMode="async">
+             <InHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHDirectorySetupHandler"/>
+                 <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPInputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw98.iu.xsede.org"/>
+                        <property name="inputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHInputHandler"/>
+            </InHandlers>
+            <OutHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHOutputHandler"/>
+                <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPOutputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw111.iu.xsede.org"/>
+                        <property name="outputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+            </OutHandlers>
+        </Provider>
 </GFac>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9bb8c2be/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml b/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
index 61dca4f..06afc6e 100644
--- a/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
+++ b/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
@@ -11,6 +11,11 @@
     ~ under the License. -->
     
 <GFac>
+    <DaemonHandlers>
+        <Handler class="org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler">
+                <property name="listeners" value="org.apache.airavata.gfac.monitor.AiravataJobStatusUpdator"/>
+        </Handler>
+    </DaemonHandlers>
     <GlobalHandlers>
         <InHandlers>
             <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler">
@@ -19,31 +24,24 @@
         </InHandlers>
         <OutHandlers></OutHandlers>
     </GlobalHandlers>
-    <Provider class="org.apache.airavata.gfac.provider.impl.LocalProvider" host="org.apache.airavata.schemas.gfac.impl.HostDescriptionTypeImpl">
+    <Provider class="org.apache.airavata.gfac.local.impl.LocalProvider" host="org.apache.airavata.schemas.gfac.impl.HostDescriptionTypeImpl">
         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.LocalDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.local.handler.LocalDirectorySetupHandler"/>
         </InHandlers>
     </Provider>
-    <Provider class="org.apache.airavata.gfac.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
+   <Provider class="org.apache.airavata.gfac.gram.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
         <property name="name" value="value"/>
         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler">
+            <Handler class="org.apache.airavata.gfac..gram.handler.GramDirectorySetupHandler">
                     <property name="name" value="value"/>
             </Handler>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+            <Handler class="org.apache.airavata.gfac..gram.handler.GridFTPInputHandler"/>
         </InHandlers>
         <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+            <Handler class="org.apache.airavata.gfac..gram.handler.GridFTPOutputHandler"/>
         </OutHandlers>
     </Provider>
-      <Provider class="org.apache.airavata.gfac.provider.impl.BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
-        <InHandlers>
-        	<Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
-        </InHandlers>
-        <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
-        </OutHandlers>
+    <Provider class="org.apache.airavata.gfac.bes.provider.impl.BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
     </Provider>
 
     <Provider class="org.apache.airavata.gfac.ec2.EC2Provider" host="org.apache.airavata.schemas.gfac.impl.Ec2HostTypeImpl">
@@ -51,40 +49,58 @@
         <OutHandlers/>
     </Provider>
 
-    <Provider class="org.apache.airavata.gfac.provider.impl.HadoopProvider" host="org.apache.airavata.schemas.gfac.impl.HadoopHostTypeImpl">
+    <Provider class="org.apache.airavata.gfac.hadoop.provider.impl.HadoopProvider" host="org.apache.airavata.schemas.gfac.impl.HadoopHostTypeImpl">
         <InHandlers>
-        	<Handler class="org.apache.airavata.gfac.handler.HadoopDeploymentHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.HDFSDataMovementHandler"/>
+                <Handler class="org.apache.airavata.gfac.hadoop.handler.HadoopDeploymentHandler"/>
+            <Handler class="org.apache.airavata.gfac.hadoop.handler.HDFSDataMovementHandler"/>
         </InHandlers>
         <OutHandlers/>
     </Provider>
 
     <Application name="UltraScan">
         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+            <Handler class="org.apache.airavata.gfac.handler.GfacDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.gram.handler.GridFTPInputHandler"/>
         </InHandlers>
         <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+            <Handler class="org.apache.airavata.gfac.gram.handler.GridFTPOutputHandler"/>
         </OutHandlers>
     </Application>
 
-     <Provider class="org.apache.airavata.gfac.provider.impl.SSHProvider" host="org.apache.airavata.schemas.gfac.impl.SSHHostTypeImpl">
-         <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.SCPInputHandler"/>
-        </InHandlers>
-        <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPOutputHandler"/>
-        </OutHandlers>
-    </Provider>
-     <Provider class="org.apache.airavata.gfac.provider.impl.GSISSHProvider" host="org.apache.airavata.schemas.gfac.impl.GsisshHostTypeImpl">
+     <Provider class="org.apache.airavata.gfac.ssh.provider.impl.SSHProvider" host="org.apache.airavata.schemas.gfac.impl.SSHHostTypeImpl">
          <InHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPDirectorySetupHandler"/>
-            <Handler class="org.apache.airavata.gfac.handler.SCPInputHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHInputHandler"/>
         </InHandlers>
         <OutHandlers>
-            <Handler class="org.apache.airavata.gfac.handler.SCPOutputHandler"/>
+            <Handler class="org.apache.airavata.gfac.ssh.handler.SSHOutputHandler"/>
         </OutHandlers>
     </Provider>
+    <Provider class="org.apache.airavata.gfac.gsissh.provider.impl.GSISSHProvider" host="org.apache.airavata.schemas.gfac.impl.GsisshHostTypeImpl" executionMode="async">
+             <InHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHDirectorySetupHandler"/>
+                 <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPInputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw98.iu.xsede.org"/>
+                        <property name="inputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHInputHandler"/>
+            </InHandlers>
+            <OutHandlers>
+                <Handler class="org.apache.airavata.gfac.gsissh.handler.GSISSHOutputHandler"/>
+                <!--Handler class="org.apache.airavata.gfac.handler.AdvancedSCPOutputHandler">
+                            <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/>
+                            <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/>
+                        <property name="userName" value="root"/>
+                        <property name="hostName" value="gw111.iu.xsede.org"/>
+                        <property name="outputPath" value="/tmp"/>
+                        <property name="passPhrase" value="/home/airavata/outputData"/>
+                        <property name="password" value="/home/airavata/outputData"/> <either we have to set password or keys, password has higher preference>
+                </Handler-->
+            </OutHandlers>
+        </Provider>
 </GFac>
\ No newline at end of file


Mime
View raw message