You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/06/04 22:15:21 UTC

[08/81] [abbrv] airavata git commit: Refactored gfac sub modules, merged gfac-ssh, gfac-gsissh, gfac-local, gfac-monitor and gsissh modules and create gface-impl, removed implementation from gfac-core to gfac-impl

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/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
deleted file mode 100644
index b38a170..0000000
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
+++ /dev/null
@@ -1,562 +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.ssh.util;
-
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
-import org.apache.airavata.gfac.Constants;
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.RequestData;
-import org.apache.airavata.gfac.core.context.JobExecutionContext;
-import org.apache.airavata.gfac.core.context.MessageContext;
-import org.apache.airavata.gfac.core.handler.GFacHandlerException;
-import org.apache.airavata.gfac.core.utils.GFacUtils;
-import org.apache.airavata.gfac.ssh.context.SSHAuthWrapper;
-import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-import org.apache.airavata.gfac.ssh.security.TokenizedSSHAuthInfo;
-import org.apache.airavata.gsi.ssh.api.Cluster;
-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.api.job.JobManagerConfiguration;
-import org.apache.airavata.gsi.ssh.impl.GSISSHAbstractCluster;
-import org.apache.airavata.gsi.ssh.impl.PBSCluster;
-import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.util.CommonUtils;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
-import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
-import org.apache.airavata.model.appcatalog.appinterface.DataType;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.appcatalog.computeresource.*;
-import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
-import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
-import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
-import org.apache.airavata.model.workspace.experiment.ErrorCategory;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.*;
-
-public class GFACSSHUtils {
-    private final static Logger logger = LoggerFactory.getLogger(GFACSSHUtils.class);
-
-    public static Map<String, List<Cluster>> clusters = new HashMap<String, List<Cluster>>();
-
-    public static final String PBS_JOB_MANAGER = "pbs";
-    public static final String SLURM_JOB_MANAGER = "slurm";
-    public static final String SUN_GRID_ENGINE_JOB_MANAGER = "UGE";
-    public static final String LSF_JOB_MANAGER = "LSF";
-
-    public static int maxClusterCount = 5;
-
-    /**
-     * This method is to add computing resource specific authentication, if its a third party machine, use the other addSecurityContext
-     * @param jobExecutionContext
-     * @throws GFacException
-     * @throws ApplicationSettingsException
-     */
-    public static void addSecurityContext(JobExecutionContext jobExecutionContext) throws GFacException, ApplicationSettingsException {
-        JobSubmissionProtocol preferredJobSubmissionProtocol = jobExecutionContext.getPreferredJobSubmissionProtocol();
-        JobSubmissionInterface preferredJobSubmissionInterface = jobExecutionContext.getPreferredJobSubmissionInterface();
-        if (preferredJobSubmissionProtocol == JobSubmissionProtocol.GLOBUS || preferredJobSubmissionProtocol == JobSubmissionProtocol.UNICORE) {
-            logger.error("This is a wrong method to invoke to non ssh host types,please check your gfac-config.xml");
-        } else if (preferredJobSubmissionProtocol == JobSubmissionProtocol.SSH) {
-            try {
-                AppCatalog appCatalog = jobExecutionContext.getAppCatalog();
-                SSHJobSubmission sshJobSubmission = appCatalog.getComputeResource().getSSHJobSubmission(preferredJobSubmissionInterface.getJobSubmissionInterfaceId());
-                SecurityProtocol securityProtocol = sshJobSubmission.getSecurityProtocol();
-                if (securityProtocol == SecurityProtocol.GSI || securityProtocol == SecurityProtocol.SSH_KEYS) {
-                    SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
-                    String credentialStoreToken = jobExecutionContext.getCredentialStoreToken(); // this is set by the framework
-                    RequestData requestData = new RequestData(jobExecutionContext.getGatewayID());
-                    requestData.setTokenId(credentialStoreToken);
-
-                    ServerInfo serverInfo = new ServerInfo(null, jobExecutionContext.getHostName());
-
-                    Cluster pbsCluster = null;
-                    try {
-                        AuthenticationInfo tokenizedSSHAuthInfo = new TokenizedSSHAuthInfo(requestData);
-                        String installedParentPath = jobExecutionContext.getResourceJobManager().getJobManagerBinPath();
-                        if (installedParentPath == null) {
-                            installedParentPath = "/";
-                        }
-
-                        SSHCredential credentials =((TokenizedSSHAuthInfo)tokenizedSSHAuthInfo).getCredentials();// this is just a call to get and set credentials in to this object,data will be used
-                        if(credentials.getPrivateKey()==null || credentials.getPublicKey()==null){
-                            // now we fall back to username password authentication
-                            Properties configurationProperties = ServerSettings.getProperties();
-                            tokenizedSSHAuthInfo = new DefaultPasswordAuthenticationInfo(configurationProperties.getProperty(Constants.SSH_PASSWORD));
-                        }
-                        // This should be the login user name from compute resource preference
-                        String loginUser = jobExecutionContext.getLoginUserName();
-                        if (loginUser == null) {
-                            loginUser = credentials.getPortalUserName();
-                        }
-                        serverInfo.setUserName(loginUser);
-                        jobExecutionContext.getExperiment().setUserName(loginUser);
-
-
-                        // inside the pbsCluser object
-
-                        String key = loginUser + jobExecutionContext.getHostName() + serverInfo.getPort();
-                        boolean recreate = false;
-                        synchronized (clusters) {
-                            if (clusters.containsKey(key) && clusters.get(key).size() < maxClusterCount) {
-                                recreate = true;
-                            } else if (clusters.containsKey(key)) {
-                                int i = new Random().nextInt(Integer.MAX_VALUE) % maxClusterCount;
-                                if (clusters.get(key).get(i).getSession().isConnected()) {
-                                    pbsCluster = clusters.get(key).get(i);
-                                } else {
-                                    clusters.get(key).remove(i);
-                                    recreate = true;
-                                }
-                                if (!recreate) {
-                                    try {
-                                        pbsCluster.listDirectory("~/"); // its hard to trust isConnected method, so we try to connect if it works we are good,else we recreate
-                                    } catch (Exception e) {
-                                        clusters.get(key).remove(i);
-                                        logger.info("Connection found the connection map is expired, so we create from the scratch");
-                                        maxClusterCount++;
-                                        recreate = true; // we make the pbsCluster to create again if there is any exception druing connection
-                                    }
-                                }
-                                logger.info("Re-using the same connection used with the connection string:" + key);
-                            } else {
-                                recreate = true;
-                            }
-                            if (recreate) {
-                            	 JobManagerConfiguration jConfig = null;
-                                 String jobManager = sshJobSubmission.getResourceJobManager().getResourceJobManagerType().toString();
-                                 if (jobManager == null) {
-                                     logger.error("No Job Manager is configured, so we are picking pbs as the default job manager");
-                                     jConfig = CommonUtils.getPBSJobManager(installedParentPath);
-                                 } else {
-                                     if (PBS_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
-                                         jConfig = CommonUtils.getPBSJobManager(installedParentPath);
-                                     } else if (SLURM_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
-                                         jConfig = CommonUtils.getSLURMJobManager(installedParentPath);
-                                     } else if (SUN_GRID_ENGINE_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
-                                         jConfig = CommonUtils.getUGEJobManager(installedParentPath);
-                                     } else if (LSF_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
-                                         jConfig = CommonUtils.getLSFJobManager(installedParentPath);
-                                     }
-                                 }
-
-                                pbsCluster = new PBSCluster(serverInfo, tokenizedSSHAuthInfo,jConfig);
-                                List<Cluster> pbsClusters = null;
-                                if (!(clusters.containsKey(key))) {
-                                    pbsClusters = new ArrayList<Cluster>();
-                                } else {
-                                    pbsClusters = clusters.get(key);
-                                }
-                                pbsClusters.add(pbsCluster);
-                                clusters.put(key, pbsClusters);
-                            }
-                        }
-                    } catch (Exception e) {
-                        throw new GFacException("Error occurred...", e);
-                    }
-                    sshSecurityContext.setPbsCluster(pbsCluster);
-                    jobExecutionContext.addSecurityContext(jobExecutionContext.getHostName(), sshSecurityContext);
-                }
-            } catch (AppCatalogException e) {
-                throw new GFacException("Error while getting SSH Submission object from app catalog", e);
-            }
-        }
-    }
-
-    /**
-     * This method can be used to add third party resource security contexts
-     * @param jobExecutionContext
-     * @param sshAuth
-     * @throws GFacException
-     * @throws ApplicationSettingsException
-     */
-    public static void addSecurityContext(JobExecutionContext jobExecutionContext,SSHAuthWrapper sshAuth) throws GFacException, ApplicationSettingsException {
-        try {
-            if(sshAuth== null) {
-                throw new GFacException("Error adding security Context, because sshAuthWrapper is null");
-            }
-            SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
-            AppCatalog appCatalog = jobExecutionContext.getAppCatalog();
-            JobSubmissionInterface preferredJobSubmissionInterface = jobExecutionContext.getPreferredJobSubmissionInterface();
-            SSHJobSubmission sshJobSubmission = null;
-			try {
-				sshJobSubmission = appCatalog.getComputeResource().getSSHJobSubmission(preferredJobSubmissionInterface.getJobSubmissionInterfaceId());
-			} catch (Exception e1) {
-				 logger.error("Not able to get SSHJobSubmission from registry");
-			}
-
-            Cluster pbsCluster = null;
-            String key=sshAuth.getKey();
-            boolean recreate = false;
-            synchronized (clusters) {
-                if (clusters.containsKey(key) && clusters.get(key).size() < maxClusterCount) {
-                    recreate = true;
-                } else if (clusters.containsKey(key)) {
-                    int i = new Random().nextInt(Integer.MAX_VALUE) % maxClusterCount;
-                    if (clusters.get(key).get(i).getSession().isConnected()) {
-                        pbsCluster = clusters.get(key).get(i);
-                    } else {
-                        clusters.get(key).remove(i);
-                        recreate = true;
-                    }
-                    if (!recreate) {
-                        try {
-                            pbsCluster.listDirectory("~/"); // its hard to trust isConnected method, so we try to connect if it works we are good,else we recreate
-                        } catch (Exception e) {
-                            clusters.get(key).remove(i);
-                            logger.info("Connection found the connection map is expired, so we create from the scratch");
-                            maxClusterCount++;
-                            recreate = true; // we make the pbsCluster to create again if there is any exception druing connection
-                        }
-                    }
-                    logger.info("Re-using the same connection used with the connection string:" + key);
-                } else {
-                    recreate = true;
-                }
-                if (recreate) {
-               	 JobManagerConfiguration jConfig = null;
-               	 String installedParentPath = null;
-               	 if(jobExecutionContext.getResourceJobManager()!= null){
-               		installedParentPath = jobExecutionContext.getResourceJobManager().getJobManagerBinPath();
-               	 }
-                 if (installedParentPath == null) {
-                     installedParentPath = "/";
-                 }
-					if (sshJobSubmission != null) {
-						String jobManager = sshJobSubmission.getResourceJobManager().getResourceJobManagerType().toString();
-						if (jobManager == null) {
-							logger.error("No Job Manager is configured, so we are picking pbs as the default job manager");
-							jConfig = CommonUtils.getPBSJobManager(installedParentPath);
-						} else {
-							if (PBS_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
-								jConfig = CommonUtils.getPBSJobManager(installedParentPath);
-							} else if (SLURM_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
-								jConfig = CommonUtils.getSLURMJobManager(installedParentPath);
-							} else if (SUN_GRID_ENGINE_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
-								jConfig = CommonUtils.getUGEJobManager(installedParentPath);
-							} else if (LSF_JOB_MANAGER.equals(jobManager)) {
-								jConfig = CommonUtils.getLSFJobManager(installedParentPath);
-							}
-						}
-					}
-                    pbsCluster = new PBSCluster(sshAuth.getServerInfo(), sshAuth.getAuthenticationInfo(),jConfig);
-                    key = sshAuth.getKey();
-                    List<Cluster> pbsClusters = null;
-                    if (!(clusters.containsKey(key))) {
-                        pbsClusters = new ArrayList<Cluster>();
-                    } else {
-                        pbsClusters = clusters.get(key);
-                    }
-                    pbsClusters.add(pbsCluster);
-                    clusters.put(key, pbsClusters);
-                }
-            }
-            sshSecurityContext.setPbsCluster(pbsCluster);
-            jobExecutionContext.addSecurityContext(key, sshSecurityContext);
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new GFacException("Error adding security Context", e);
-        }
-    }
-
-
-    public static JobDescriptor createJobDescriptor(JobExecutionContext jobExecutionContext, Cluster cluster) throws AppCatalogException, ApplicationSettingsException {
-        JobDescriptor jobDescriptor = new JobDescriptor();
-        TaskDetails taskData = jobExecutionContext.getTaskData();
-
-
-        // set email based job monitoring email  address if monitor mode is JOB_EMAIL_NOTIFICATION_MONITOR
-        boolean addJobNotifMail = isEmailBasedJobMonitor(jobExecutionContext);
-        String emailIds = null;
-        if (addJobNotifMail) {
-            emailIds = ServerSettings.getEmailBasedMonitorAddress();
-        }
-        // add all configured job notification email addresses.
-        if (ServerSettings.getSetting(ServerSettings.JOB_NOTIFICATION_ENABLE).equalsIgnoreCase("true")) {
-            String flags = ServerSettings.getSetting(ServerSettings.JOB_NOTIFICATION_FLAGS);
-            if (flags != null && jobExecutionContext.getApplicationContext().getComputeResourceDescription().getHostName().equals("stampede.tacc.xsede.org")) {
-                flags = "ALL";
-            }
-            jobDescriptor.setMailOptions(flags);
-
-            String userJobNotifEmailIds = ServerSettings.getSetting(ServerSettings.JOB_NOTIFICATION_EMAILIDS);
-            if (userJobNotifEmailIds != null && !userJobNotifEmailIds.isEmpty()) {
-                if (emailIds != null && !emailIds.isEmpty()) {
-                    emailIds += ("," + userJobNotifEmailIds);
-                } else {
-                    emailIds = userJobNotifEmailIds;
-                }
-            }
-
-            if (taskData.isEnableEmailNotification()) {
-                List<String> emailList = jobExecutionContext.getTaskData().getEmailAddresses();
-                String elist = GFacUtils.listToCsv(emailList, ',');
-                if (elist != null && !elist.isEmpty()) {
-                    if (emailIds != null && !emailIds.isEmpty()) {
-                        emailIds = emailIds + "," + elist;
-                    } else {
-                        emailIds = elist;
-                    }
-                }
-            }
-        }
-        if (emailIds != null && !emailIds.isEmpty()) {
-            logger.info("Email list: " + emailIds);
-            jobDescriptor.setMailAddress(emailIds);
-        }
-        // this is common for any application descriptor
-
-        jobDescriptor.setCallBackIp(ServerSettings.getIp());
-        jobDescriptor.setCallBackPort(ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.GFAC_SERVER_PORT, "8950"));
-        jobDescriptor.setInputDirectory(jobExecutionContext.getInputDir());
-        jobDescriptor.setOutputDirectory(jobExecutionContext.getOutputDir());
-        jobDescriptor.setExecutablePath(jobExecutionContext.getApplicationContext()
-                .getApplicationDeploymentDescription().getExecutablePath());
-        jobDescriptor.setStandardOutFile(jobExecutionContext.getStandardOutput());
-        jobDescriptor.setStandardErrorFile(jobExecutionContext.getStandardError());
-        String computationalProjectAccount = taskData.getTaskScheduling().getComputationalProjectAccount();
-        if (computationalProjectAccount == null){
-            ComputeResourcePreference computeResourcePreference = jobExecutionContext.getApplicationContext().getComputeResourcePreference();
-            if (computeResourcePreference != null) {
-                computationalProjectAccount = computeResourcePreference.getAllocationProjectNumber();
-            }
-        }
-        if (computationalProjectAccount != null) {
-            jobDescriptor.setAcountString(computationalProjectAccount);
-        }
-        // To make job name alpha numeric
-        jobDescriptor.setJobName("A" + String.valueOf(generateJobName()));
-        jobDescriptor.setWorkingDirectory(jobExecutionContext.getWorkingDir());
-
-        List<String> inputValues = new ArrayList<String>();
-        MessageContext input = jobExecutionContext.getInMessageContext();
-
-        // sort the inputs first and then build the command ListR
-        Comparator<InputDataObjectType> inputOrderComparator = new Comparator<InputDataObjectType>() {
-            @Override
-            public int compare(InputDataObjectType inputDataObjectType, InputDataObjectType t1) {
-                return inputDataObjectType.getInputOrder() - t1.getInputOrder();
-            }
-        };
-        Set<InputDataObjectType> sortedInputSet = new TreeSet<InputDataObjectType>(inputOrderComparator);
-        for (Object object : input.getParameters().values()) {
-            if (object instanceof InputDataObjectType) {
-                InputDataObjectType inputDOT = (InputDataObjectType) object;
-                sortedInputSet.add(inputDOT);
-            }
-        }
-        for (InputDataObjectType inputDataObjectType : sortedInputSet) {
-            if (!inputDataObjectType.isRequiredToAddedToCommandLine()) {
-                continue;
-            }
-            if (inputDataObjectType.getApplicationArgument() != null
-                    && !inputDataObjectType.getApplicationArgument().equals("")) {
-                inputValues.add(inputDataObjectType.getApplicationArgument());
-            }
-
-            if (inputDataObjectType.getValue() != null
-                    && !inputDataObjectType.getValue().equals("")) {
-                if (inputDataObjectType.getType() == DataType.URI) {
-                    // set only the relative path
-                    String filePath = inputDataObjectType.getValue();
-                    filePath = filePath.substring(filePath.lastIndexOf(File.separatorChar) + 1, filePath.length());
-                    inputValues.add(filePath);
-                }else {
-                    inputValues.add(inputDataObjectType.getValue());
-                }
-
-            }
-        }
-        Map<String, Object> outputParams = jobExecutionContext.getOutMessageContext().getParameters();
-        for (Object outputParam : outputParams.values()) {
-            if (outputParam instanceof OutputDataObjectType) {
-                OutputDataObjectType output = (OutputDataObjectType) outputParam;
-                if (output.getApplicationArgument() != null
-                        && !output.getApplicationArgument().equals("")) {
-                    inputValues.add(output.getApplicationArgument());
-                }
-                if (output.getValue() != null && !output.getValue().equals("") && output.isRequiredToAddedToCommandLine()) {
-                    if (output.getType() == DataType.URI){
-                        String filePath = output.getValue();
-                        filePath = filePath.substring(filePath.lastIndexOf(File.separatorChar) + 1, filePath.length());
-                        inputValues.add(filePath);
-                    }
-                }
-            }
-        }
-
-        jobDescriptor.setInputValues(inputValues);
-        jobDescriptor.setUserName(((GSISSHAbstractCluster) cluster).getServerInfo().getUserName());
-        jobDescriptor.setShellName("/bin/bash");
-        jobDescriptor.setAllEnvExport(true);
-        jobDescriptor.setOwner(((PBSCluster) cluster).getServerInfo().getUserName());
-
-        ResourceJobManager resourceJobManager = jobExecutionContext.getResourceJobManager();
-
-
-        ComputationalResourceScheduling taskScheduling = taskData.getTaskScheduling();
-        if (taskScheduling != null) {
-            int totalNodeCount = taskScheduling.getNodeCount();
-            int totalCPUCount = taskScheduling.getTotalCPUCount();
-
-
-            if (taskScheduling.getComputationalProjectAccount() != null) {
-                jobDescriptor.setAcountString(taskScheduling.getComputationalProjectAccount());
-            }
-            if (taskScheduling.getQueueName() != null) {
-                jobDescriptor.setQueueName(taskScheduling.getQueueName());
-            }
-
-            if (totalNodeCount > 0) {
-                jobDescriptor.setNodes(totalNodeCount);
-            }
-            if (taskScheduling.getComputationalProjectAccount() != null) {
-                jobDescriptor.setAcountString(taskScheduling.getComputationalProjectAccount());
-            }
-            if (taskScheduling.getQueueName() != null) {
-                jobDescriptor.setQueueName(taskScheduling.getQueueName());
-            }
-            if (totalCPUCount > 0) {
-                int ppn = totalCPUCount / totalNodeCount;
-                jobDescriptor.setProcessesPerNode(ppn);
-                jobDescriptor.setCPUCount(totalCPUCount);
-            }
-            if (taskScheduling.getWallTimeLimit() > 0) {
-                jobDescriptor.setMaxWallTime(String.valueOf(taskScheduling.getWallTimeLimit()));
-                if(resourceJobManager.getResourceJobManagerType().equals(ResourceJobManagerType.LSF)){
-                    jobDescriptor.setMaxWallTimeForLSF(String.valueOf(taskScheduling.getWallTimeLimit()));
-                }
-            }
-            if (taskScheduling.getTotalPhysicalMemory() > 0) {
-                jobDescriptor.setUsedMemory(taskScheduling.getTotalPhysicalMemory() + "");
-            }
-        } else {
-            logger.error("Task scheduling cannot be null at this point..");
-        }
-        ApplicationDeploymentDescription appDepDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
-        List<String> moduleCmds = appDepDescription.getModuleLoadCmds();
-        if (moduleCmds != null) {
-            for (String moduleCmd : moduleCmds) {
-                jobDescriptor.addModuleLoadCommands(moduleCmd);
-            }
-        }
-        List<String> preJobCommands = appDepDescription.getPreJobCommands();
-        if (preJobCommands != null) {
-            for (String preJobCommand : preJobCommands) {
-                jobDescriptor.addPreJobCommand(parseCommand(preJobCommand, jobExecutionContext));
-            }
-        }
-
-        List<String> postJobCommands = appDepDescription.getPostJobCommands();
-        if (postJobCommands != null) {
-            for (String postJobCommand : postJobCommands) {
-                jobDescriptor.addPostJobCommand(parseCommand(postJobCommand, jobExecutionContext));
-            }
-        }
-
-        ApplicationParallelismType parallelism = appDepDescription.getParallelism();
-        if (parallelism != null){
-            if (parallelism == ApplicationParallelismType.MPI || parallelism == ApplicationParallelismType.OPENMP || parallelism == ApplicationParallelismType.OPENMP_MPI){
-                Map<JobManagerCommand, String> jobManagerCommands = resourceJobManager.getJobManagerCommands();
-                if (jobManagerCommands != null && !jobManagerCommands.isEmpty()) {
-                    for (JobManagerCommand command : jobManagerCommands.keySet()) {
-                        if (command == JobManagerCommand.SUBMISSION) {
-                            String commandVal = jobManagerCommands.get(command);
-                            jobDescriptor.setJobSubmitter(commandVal);
-                        }
-                    }
-                }
-            }
-        }
-        return jobDescriptor;
-    }
-
-    public static boolean isEmailBasedJobMonitor(JobExecutionContext jobExecutionContext) throws AppCatalogException {
-        if (jobExecutionContext.getPreferredJobSubmissionProtocol() == JobSubmissionProtocol.SSH) {
-            String jobSubmissionInterfaceId = jobExecutionContext.getPreferredJobSubmissionInterface().getJobSubmissionInterfaceId();
-            SSHJobSubmission sshJobSubmission = jobExecutionContext.getAppCatalog().getComputeResource().getSSHJobSubmission(jobSubmissionInterfaceId);
-            MonitorMode monitorMode = sshJobSubmission.getMonitorMode();
-            return monitorMode != null && monitorMode == MonitorMode.JOB_EMAIL_NOTIFICATION_MONITOR;
-        } else {
-            return false;
-        }
-    }
-
-    private static int generateJobName() {
-        Random random = new Random();
-        int i = random.nextInt(Integer.MAX_VALUE);
-        i = i + 99999999;
-        if(i<0) {
-            i = i * (-1);
-        }
-        return i;
-    }
-
-    private static String parseCommand(String value, JobExecutionContext jobExecutionContext) {
-        String parsedValue = value.replaceAll("\\$workingDir", jobExecutionContext.getWorkingDir());
-        parsedValue = parsedValue.replaceAll("\\$inputDir", jobExecutionContext.getInputDir());
-        parsedValue = parsedValue.replaceAll("\\$outputDir", jobExecutionContext.getOutputDir());
-        return parsedValue;
-    }
-    /**
-     * This method can be used to set the Security Context if its not set and later use it in other places
-     * @param jobExecutionContext
-     * @param authenticationInfo
-     * @param userName
-     * @param hostName
-     * @param port
-     * @return
-     * @throws GFacException
-     */
-    public static String prepareSecurityContext(JobExecutionContext jobExecutionContext, AuthenticationInfo authenticationInfo
-            , String userName, String hostName, int port) throws GFacException {
-        ServerInfo serverInfo = new ServerInfo(userName, hostName);
-        String key = userName+hostName+port;
-        SSHAuthWrapper sshAuthWrapper = new SSHAuthWrapper(serverInfo, authenticationInfo, key);
-        if (jobExecutionContext.getSecurityContext(key) == null) {
-            try {
-                GFACSSHUtils.addSecurityContext(jobExecutionContext, sshAuthWrapper);
-            } catch (ApplicationSettingsException e) {
-                logger.error(e.getMessage());
-                try {
-                    StringWriter errors = new StringWriter();
-                    e.printStackTrace(new PrintWriter(errors));
-                    GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
-                } catch (GFacException e1) {
-                    logger.error(e1.getLocalizedMessage());
-                }
-                throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
-            }
-        }
-        return key;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/HandleOutputs.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/HandleOutputs.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/HandleOutputs.java
deleted file mode 100644
index 704528f..0000000
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/HandleOutputs.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.apache.airavata.gfac.ssh.util;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.airavata.gfac.core.context.JobExecutionContext;
-import org.apache.airavata.gfac.core.handler.GFacHandlerException;
-import org.apache.airavata.gfac.core.utils.GFacUtils;
-import org.apache.airavata.gsi.ssh.api.Cluster;
-import org.apache.airavata.model.appcatalog.appinterface.DataType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * To handle outputs of different data types
- * 
- */
-public class HandleOutputs {
-	private static final Logger log = LoggerFactory.getLogger(HandleOutputs.class);
-
-	public static List<OutputDataObjectType> handleOutputs(JobExecutionContext jobExecutionContext, Cluster cluster) throws GFacHandlerException {
-		List<OutputDataObjectType> outputArray = new ArrayList<OutputDataObjectType>();
-		try {
-			String outputDataDir = File.separator + "tmp" + File.separator + jobExecutionContext.getExperimentID();
-			(new File(outputDataDir)).mkdirs();
-
-			List<OutputDataObjectType> outputs = jobExecutionContext.getTaskData().getApplicationOutputs();
-			List<String> outputList = cluster.listDirectory(jobExecutionContext.getWorkingDir());
-			boolean missingOutput = false;
-
-			for (OutputDataObjectType output : outputs) {
-				// FIXME: Validation of outputs based on required and optional and search based on REGEX provided in search.
-
-				if (DataType.URI == output.getType()) {
-                    // for failed jobs outputs are not generated. So we should not download outputs
-                    if (GFacUtils.isFailedJob(jobExecutionContext)){
-                       continue;
-                    }
-					String outputFile = output.getValue();
-					String fileName = outputFile.substring(outputFile.lastIndexOf(File.separatorChar) + 1, outputFile.length());
-
-					if (output.getLocation() == null && !outputList.contains(fileName) && output.isIsRequired()) {
-						missingOutput = true;
-					} else {
-						cluster.scpFrom(outputFile, outputDataDir);
-						String localFile = outputDataDir + File.separator + fileName;
-						jobExecutionContext.addOutputFile(localFile);
-						output.setValue(localFile);
-						outputArray.add(output);
-					}
-
-				} else if (DataType.STDOUT == output.getType()) {
-					String downloadFile = jobExecutionContext.getStandardOutput();
-					String fileName = downloadFile.substring(downloadFile.lastIndexOf(File.separatorChar) + 1, downloadFile.length());
-					cluster.scpFrom(downloadFile, outputDataDir);
-					String localFile = outputDataDir + File.separator + fileName;
-					jobExecutionContext.addOutputFile(localFile);
-					jobExecutionContext.setStandardOutput(localFile);
-					output.setValue(localFile);
-					outputArray.add(output);
-
-				} else if (DataType.STDERR == output.getType()) {
-					String downloadFile = jobExecutionContext.getStandardError();
-					String fileName = downloadFile.substring(downloadFile.lastIndexOf(File.separatorChar) + 1, downloadFile.length());
-					cluster.scpFrom(downloadFile, outputDataDir);
-					String localFile = outputDataDir + File.separator + fileName;
-					jobExecutionContext.addOutputFile(localFile);
-					jobExecutionContext.setStandardError(localFile);
-					output.setValue(localFile);
-					outputArray.add(output);
-
-				}
-			}
-			if (outputArray == null || outputArray.isEmpty()) {
-				log.error("Empty Output returned from the Application, Double check the application and ApplicationDescriptor output Parameter Names");
-				if (jobExecutionContext.getTaskData().getAdvancedOutputDataHandling() == null) {
-					throw new GFacHandlerException("Empty Output returned from the Application, Double check the application"
-							+ "and ApplicationDescriptor output Parameter Names");
-				}
-			}
-
-			if (missingOutput) {
-				String arrayString = Arrays.deepToString(outputArray.toArray());
-				log.error(arrayString);
-				throw new GFacHandlerException("Required output is missing");
-			}
-		} catch (Exception e) {
-			throw new GFacHandlerException(e);
-		}
-		jobExecutionContext.getTaskData().setApplicationOutputs(outputArray);
-		return outputArray;
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-ssh/src/main/resources/errors.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/resources/errors.properties b/modules/gfac/gfac-ssh/src/main/resources/errors.properties
deleted file mode 100644
index 88c41b8..0000000
--- a/modules/gfac/gfac-ssh/src/main/resources/errors.properties
+++ /dev/null
@@ -1,197 +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.
-#
-
-# Directly copied from jglobus. Not a good way to manager error properties.
-1 = Parameter not supported
-2 = The RSL length is greater than the maximum allowed
-3 = No resources available
-4 = Bad directory specified
-5 = The executable does not exist
-6 = Insufficient funds
-7 = Authentication with the remote server failed
-8 = Job cancelled by user
-9 = Job cancelled by system
-
-10 = Data transfer to the server failed
-11 = The stdin file does not exist
-12 = The connection to the server failed (check host and port)
-13 = The provided RSL 'maxtime' value is invalid (not an integer or must be greater than 0)
-14 = The provided RSL 'count' value is invalid (not an integer or must be greater than 0)
-15 = The job manager received an invalid RSL
-16 = Could not connect to job manager
-17 = The job failed when the job manager attempted to run it
-18 = Paradyn error
-19 = The provided RSL 'jobtype' value is invalid
-
-20 = The provided RSL 'myjob' value is invalid
-21 = The job manager failed to locate an internal script argument file
-22 = The job manager failed to create an internal script argument file
-23 = The job manager detected an invalid job state
-24 = The job manager detected an invalid script response
-25 = The job manager detected an invalid job state
-26 = The provided RSL 'jobtype' value is not supported by this job manager
-27 = Unimplemented
-28 = The job manager failed to create an internal script submission file
-29 = The job manager cannot find the user proxy
-
-30 = The job manager failed to open the user proxy
-31 = The job manager failed to cancel the job as requested
-32 = System memory allocation failed
-33 = The interprocess job communication initialization failed
-34 = The interprocess job communication setup failed
-35 = The provided RSL 'host count' value is invalid
-36 = One of the provided RSL parameters is unsupported
-37 = The provided RSL 'queue' parameter is invalid
-38 = The provided RSL 'project' parameter is invalid
-39 = The provided RSL string includes variables that could not be identified
-
-40 = The provided RSL 'environment' parameter is invalid
-41 = The provided RSL 'dryrun' parameter is invalid
-42 = The provided RSL is invalid (an empty string)
-43 = The job manager failed to stage the executable
-44 = The job manager failed to stage the stdin file
-45 = The requested job manager type is invalid
-46 = The provided RSL 'arguments' parameter is invalid
-47 = The gatekeeper failed to run the job manager
-48 = The provided RSL could not be properly parsed
-49 = There is a version mismatch between GRAM components
-
-50 = The provided RSL 'arguments' parameter is invalid
-51 = The provided RSL 'count' parameter is invalid
-52 = The provided RSL 'directory' parameter is invalid
-53 = The provided RSL 'dryrun' parameter is invalid
-54 = The provided RSL 'environment' parameter is invalid
-55 = The provided RSL 'executable' parameter is invalid
-56 = The provided RSL 'host_count' parameter is invalid
-57 = The provided RSL 'jobtype' parameter is invalid
-58 = The provided RSL 'maxtime' parameter is invalid
-59 = The provided RSL 'myjob' parameter is invalid
-
-60 = The provided RSL 'paradyn' parameter is invalid
-61 = The provided RSL 'project' parameter is invalid
-62 = The provided RSL 'queue' parameter is invalid
-63 = The provided RSL 'stderr' parameter is invalid
-64 = The provided RSL 'stdin' parameter is invalid
-65 = The provided RSL 'stdout' parameter is invalid
-66 = The job manager failed to locate an internal script
-67 = The job manager failed on the system call pipe()
-68 = The job manager failed on the system call fcntl()
-69 = The job manager failed to create the temporary stdout filename
-
-70 = The job manager failed to create the temporary stderr filename
-71 = The job manager failed on the system call fork()
-72 = The executable file permissions do not allow execution
-73 = The job manager failed to open stdout
-74 = The job manager failed to open stderr
-75 = The cache file could not be opened in order to relocate the user proxy
-76 = Cannot access cache files in ~/.globus/.gass_cache, check permissions, quota, and disk space
-77 = The job manager failed to insert the contact in the client contact list
-78 = The contact was not found in the job manager's client contact list
-79 = Connecting to the job manager failed.  Possible reasons: job terminated, invalid job contact, network problems, ...
-
-80 = The syntax of the job contact is invalid
-81 = The executable parameter in the RSL is undefined
-82 = The job manager service is misconfigured.  condor arch undefined
-83 = The job manager service is misconfigured.  condor os undefined
-84 = The provided RSL 'min_memory' parameter is invalid
-85 = The provided RSL 'max_memory' parameter is invalid
-86 = The RSL 'min_memory' value is not zero or greater
-87 = The RSL 'max_memory' value is not zero or greater
-88 = The creation of a HTTP message failed
-89 = Parsing incoming HTTP message failed
-
-90 = The packing of information into a HTTP message failed
-91 = An incoming HTTP message did not contain the expected information
-92 = The job manager does not support the service that the client requested
-93 = The gatekeeper failed to find the requested service
-94 = The jobmanager does not accept any new requests (shutting down)
-95 = The client failed to close the listener associated with the callback URL
-96 = The gatekeeper contact cannot be parsed
-97 = The job manager could not find the 'poe' command
-98 = The job manager could not find the 'mpirun' command
-99 = The provided RSL 'start_time' parameter is invalid"
-100 = The provided RSL 'reservation_handle' parameter is invalid
-
-101 = The provided RSL 'max_wall_time' parameter is invalid
-102 = The RSL 'max_wall_time' value is not zero or greater
-103 = The provided RSL 'max_cpu_time' parameter is invalid
-104 = The RSL 'max_cpu_time' value is not zero or greater
-105 = The job manager is misconfigured, a scheduler script is missing
-106 = The job manager is misconfigured, a scheduler script has invalid permissions
-107 = The job manager failed to signal the job
-108 = The job manager did not recognize/support the signal type
-109 = The job manager failed to get the job id from the local scheduler
-
-110 = The job manager is waiting for a commit signal
-111 = The job manager timed out while waiting for a commit signal
-112 = The provided RSL 'save_state' parameter is invalid
-113 = The provided RSL 'restart' parameter is invalid
-114 = The provided RSL 'two_phase' parameter is invalid
-115 = The RSL 'two_phase' value is not zero or greater
-116 = The provided RSL 'stdout_position' parameter is invalid
-117 = The RSL 'stdout_position' value is not zero or greater
-118 = The provided RSL 'stderr_position' parameter is invalid
-119 = The RSL 'stderr_position' value is not zero or greater
-
-120 = The job manager restart attempt failed
-121 = The job state file doesn't exist
-122 = Could not read the job state file
-123 = Could not write the job state file
-124 = The old job manager is still alive
-125 = The job manager state file TTL expired
-126 = It is unknown if the job was submitted
-127 = The provided RSL 'remote_io_url' parameter is invalid
-128 = Could not write the remote io url file
-129 = The standard output/error size is different
-
-130 = The job manager was sent a stop signal (job is still running)
-131 = The user proxy expired (job is still running)
-132 = The job was not submitted by original jobmanager
-133 = The job manager is not waiting for that commit signal
-134 = The provided RSL scheduler specific parameter is invalid
-135 = The job manager could not stage in a file
-136 = The scratch directory could not be created
-137 = The provided 'gass_cache' parameter is invalid
-138 = The RSL contains attributes which are not valid for job submission
-139 = The RSL contains attributes which are not valid for stdio update
-
-140 = The RSL contains attributes which are not valid for job restart
-141 = The provided RSL 'file_stage_in' parameter is invalid
-142 = The provided RSL 'file_stage_in_shared' parameter is invalid
-143 = The provided RSL 'file_stage_out' parameter is invalid
-144 = The provided RSL 'gass_cache' parameter is invalid
-145 = The provided RSL 'file_cleanup' parameter is invalid
-146 = The provided RSL 'scratch_dir' parameter is invalid
-147 = The provided scheduler-specific RSL parameter is invalid
-148 = A required RSL attribute was not defined in the RSL spec
-149 = The gass_cache attribute points to an invalid cache directory
-
-150 = The provided RSL 'save_state' parameter has an invalid value
-151 = The job manager could not open the RSL attribute validation file
-152 = The  job manager could not read the RSL attribute validation file
-153 = The provided RSL 'proxy_timeout' is invalid
-154 = The RSL 'proxy_timeout' value is not greater than zero
-155 = The job manager could not stage out a file
-156 = The job contact string does not match any which the job manager is handling
-157 = Proxy delegation failed
-158 = The job manager could not lock the state lock file
-
-1000 = Failed to start up callback handler
-1003 = Job contact not set

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-ssh/src/main/resources/service.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/resources/service.properties b/modules/gfac/gfac-ssh/src/main/resources/service.properties
deleted file mode 100644
index 391bfea..0000000
--- a/modules/gfac/gfac-ssh/src/main/resources/service.properties
+++ /dev/null
@@ -1,58 +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.
-#
-#
-
-
-#
-# Class which implemented Scheduler interface. It will be used to determine a Provider
-#
-scheduler.class= org.apache.airavata.core.gfac.scheduler.impl.SchedulerImpl
-
-#
-# Data Service Plugins classes
-#
-datachain.classes= org.apache.airavata.core.gfac.extension.data.RegistryDataService
-
-#
-# Pre execution Plugins classes. For example, GridFTP Input Staging
-#
-prechain.classes= org.apache.airavata.core.gfac.extension.pre.GridFtpInputStaging 
-prechain.classes= org.apache.airavata.core.gfac.extension.pre.HttpInputStaging
-
-#
-# Post execution Plugins classes. For example, GridFTP Output Staging
-#
-postchain.classes= org.apache.airavata.core.gfac.extension.post.GridFtpOutputStaging
-postchain.classes= org.apache.airavata.core.gfac.extension.post.OutputRegister
-
-#
-# SSH private key location. It will be used by SSHProvider
-#
-# ssh.key=/home/user/.ssh/id_rsa
-# ssh.keypass=
-# ssh.username=usernameAtHost
-
-#
-# MyProxy credential. It will be used by GridFTP Plugins and GramProvider.
-#
-# myproxy.server=myproxy.teragrid.org
-# myproxy.user=username
-# myproxy.pass=password
-# myproxy.life=3600
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/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
deleted file mode 100644
index c65f386..0000000
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
+++ /dev/null
@@ -1,252 +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.core.gfac.services.impl;
-//
-//import org.apache.airavata.commons.gfac.type.ActualParameter;
-//import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-//import org.apache.airavata.commons.gfac.type.HostDescription;
-//import org.apache.airavata.commons.gfac.type.ServiceDescription;
-//import org.apache.airavata.gfac.GFacConfiguration;
-//import org.apache.airavata.gfac.GFacException;
-//import org.apache.airavata.gfac.SecurityContext;
-//import org.apache.airavata.gfac.core.context.ApplicationContext;
-//import org.apache.airavata.gfac.core.context.JobExecutionContext;
-//import org.apache.airavata.gfac.core.context.MessageContext;
-//import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
-//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.JobManagerConfiguration;
-//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.TaskDetails;
-//import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-//import org.apache.airavata.schemas.gfac.*;
-//import org.testng.annotations.BeforeClass;
-//import org.testng.annotations.Test;
-//
-//import java.io.File;
-//import java.net.URL;
-//import java.util.ArrayList;
-//import java.util.Date;
-//import java.util.List;
-//import java.util.UUID;
-//
-//public class BigRed2TestWithSSHAuth {
-//    private JobExecutionContext jobExecutionContext;
-//
-//    private String userName;
-//    private String password;
-//    private String passPhrase;
-//    private String hostName;
-//    private String workingDirectory;
-//    private String privateKeyPath;
-//    private String publicKeyPath;
-//
-//    @BeforeClass
-//    public void setUp() throws Exception {
-//
-//        System.out.println("Test case name " + this.getClass().getName());
-////        System.setProperty("ssh.host","bigred2.uits.iu.edu");        //default ssh host
-////        System.setProperty("ssh.user", "lginnali");
-////        System.setProperty("ssh.private.key.path", "/Users/lahirugunathilake/.ssh/id_dsa");
-////        System.setProperty("ssh.public.key.path", "/Users/lahirugunathilake/.ssh/id_dsa.pub");
-////        System.setProperty("ssh.working.directory", "/tmp");
-//
-//        this.hostName = "bigred2.uits.iu.edu";
-//        this.hostName = System.getProperty("ssh.host");
-//        this.userName = System.getProperty("ssh.username");
-//        this.password = System.getProperty("ssh.password");
-//        this.privateKeyPath = System.getProperty("private.ssh.key");
-//        this.publicKeyPath = System.getProperty("public.ssh.key");
-//        this.passPhrase = System.getProperty("ssh.keypass");
-//        this.workingDirectory = System.getProperty("ssh.working.directory");
-//
-//
-//         if (this.userName == null
-//                || (this.password==null && (this.publicKeyPath == null || this.privateKeyPath == null)) || this.workingDirectory == null) {
-//            System.out.println("########### In order to test you have to either username password or private,public keys");
-//            System.out.println("Use -Dssh.username=xxx -Dssh.password=yyy -Dssh.keypass=zzz " +
-//                    "-Dprivate.ssh.key -Dpublic.ssh.key -Dssh.working.directory ");
-//        }
-//        URL resource = BigRed2TestWithSSHAuth.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
-//        assert resource != null;
-//        System.out.println(resource.getFile());
-//        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), null);
-//
-////        gFacConfiguration.setMyProxyLifeCycle(3600);
-////        gFacConfiguration.setMyProxyServer("myproxy.teragrid.org");
-////        gFacConfiguration.setMyProxyUser("*****");
-////        gFacConfiguration.setMyProxyPassphrase("*****");
-////        gFacConfiguration.setTrustedCertLocation("./certificates");
-////        //have to set InFlwo Handlers and outFlowHandlers
-////        gFacConfiguration.setInHandlers(Arrays.asList(new String[] {"org.apache.airavata.gfac.handler.GramDirectorySetupHandler","org.apache.airavata.gfac.handler.GridFTPInputHandler"}));
-////        gFacConfiguration.setOutHandlers(Arrays.asList(new String[] {"org.apache.airavata.gfac.handler.GridFTPOutputHandler"}));
-//
-//        /*
-//        * Host
-//        */
-//        HostDescription host = new HostDescription(SSHHostType.type);
-//        host.getType().setHostAddress(hostName);
-//        host.getType().setHostName(hostName);
-//        ((SSHHostType)host.getType()).setHpcResource(true);
-//        /*
-//        * App
-//        */
-//        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
-//        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
-//        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
-//        name.setStringValue("EchoLocal");
-//        app.setApplicationName(name);
-//
-//        app.setCpuCount(1);
-//        app.setJobType(JobTypeType.SERIAL);
-//        app.setNodeCount(1);
-//        app.setProcessorsPerNode(1);
-//
-//        /*
-//        * Use bat file if it is compiled on Windows
-//        */
-//        app.setExecutableLocation("/bin/echo");
-//
-//        /*
-//        * Default tmp location
-//        */
-//        String tempDir = "/tmp";
-//        String date = (new Date()).toString();
-//        date = date.replaceAll(" ", "_");
-//        date = date.replaceAll(":", "_");
-//
-//        tempDir = tempDir + File.separator
-//                + "SimpleEcho" + "_" + date + "_" + UUID.randomUUID();
-//
-//        System.out.println(tempDir);
-//        app.setScratchWorkingDirectory(tempDir);
-//        app.setStaticWorkingDirectory(tempDir);
-//        app.setInputDataDirectory(tempDir + File.separator + "inputData");
-//        app.setOutputDataDirectory(tempDir + File.separator + "outputData");
-//        app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout");
-//        app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr");
-//        app.setMaxWallTime(5);
-//        app.setJobSubmitterCommand("aprun -n 1");
-//        app.setInstalledParentPath("/opt/torque/torque-4.2.3.1/bin/");
-//
-//        /*
-//        * Service
-//        */
-//        ServiceDescription serv = new ServiceDescription();
-//        serv.getType().setName("SimpleEcho");
-//
-//        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
-//
-//        InputParameterType input = InputParameterType.Factory.newInstance();
-//        input.setParameterName("echo_input");
-//        input.setParameterType(StringParameterType.Factory.newInstance());
-//        inputList.add(input);
-//
-//        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
-//
-//                .size()]);
-//        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
-//        OutputParameterType output = OutputParameterType.Factory.newInstance();
-//        output.setParameterName("echo_output");
-//        output.setParameterType(StringParameterType.Factory.newInstance());
-//        outputList.add(output);
-//
-//        OutputParameterType[] outputParamList = outputList
-//                .toArray(new OutputParameterType[outputList.size()]);
-//
-//        serv.getType().setInputParametersArray(inputParamList);
-//        serv.getType().setOutputParametersArray(outputParamList);
-//
-//        jobExecutionContext = new JobExecutionContext(gFacConfiguration, serv.getType().getName());
-//        // Adding security context
-//        jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, getSecurityContext(app));
-//        ApplicationContext applicationContext = new ApplicationContext();
-//        jobExecutionContext.setApplicationContext(applicationContext);
-//        applicationContext.setServiceDescription(serv);
-//        applicationContext.setApplicationDeploymentDescription(appDesc);
-//        applicationContext.setHostDescription(host);
-//
-//        MessageContext inMessage = new MessageContext();
-//        ActualParameter echo_input = new ActualParameter();
-//        ((StringParameterType) echo_input.getType()).setValue("echo_output=hello");
-//        inMessage.addParameter("echo_input", echo_input);
-//
-//
-//        jobExecutionContext.setInMessageContext(inMessage);
-//
-//        MessageContext outMessage = new MessageContext();
-//        ActualParameter echo_out = new ActualParameter();
-////		((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
-//        outMessage.addParameter("echo_output", echo_out);
-//        jobExecutionContext.setRegistry(RegistryFactory.getLoggingRegistry());
-//        jobExecutionContext.setTaskData(new TaskDetails("11323"));
-//        jobExecutionContext.setOutMessageContext(outMessage);
-//
-//    }
-//
-//
-//    private SecurityContext getSecurityContext(HpcApplicationDeploymentType app) {
-//         try {
-//
-//        AuthenticationInfo authenticationInfo = null;
-//        if (password != null) {
-//            authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
-//        } else {
-//            authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath,
-//                    this.passPhrase);
-//        }
-//        // Server info
-//        ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
-//
-//        Cluster pbsCluster = null;
-//        SSHSecurityContext sshSecurityContext = null;
-//
-//            JobManagerConfiguration pbsJobManager = CommonUtils.getPBSJobManager(app.getInstalledParentPath());
-//            pbsCluster = new PBSCluster(serverInfo, authenticationInfo, pbsJobManager);
-//
-//
-//            sshSecurityContext = new SSHSecurityContext();
-//            sshSecurityContext.setPbsCluster(pbsCluster);
-//            sshSecurityContext.setUsername(userName);
-//            sshSecurityContext.setKeyPass(passPhrase);
-//            sshSecurityContext.setPrivateKeyLoc(privateKeyPath);
-//             return sshSecurityContext;
-//        } catch (SSHApiException e) {
-//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-//        }
-//        return null;
-//    }
-//
-//    @Test
-//    public void testSSHProvider() throws GFacException {
-//        BetterGfacImpl gFacAPI = new BetterGfacImpl();
-//        gFacAPI.submitJob(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID(), jobExecutionContext.getGatewayID());
-//        org.junit.Assert.assertNotNull(jobExecutionContext.getJobDetails().getJobDescription());
-//        org.junit.Assert.assertNotNull(jobExecutionContext.getJobDetails().getJobID());
-//    }
-//
-//}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/CredentialStoreTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/CredentialStoreTest.java b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/CredentialStoreTest.java
deleted file mode 100644
index d42ea52..0000000
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/CredentialStoreTest.java
+++ /dev/null
@@ -1,135 +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.core.gfac.services.impl;
-//
-//import junit.framework.Assert;
-//import org.apache.airavata.client.AiravataAPIFactory;
-//import org.apache.airavata.client.api.AiravataAPI;
-//import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-//import org.apache.airavata.common.exception.AiravataConfigurationException;
-//import org.apache.airavata.common.exception.ApplicationSettingsException;
-//import org.apache.airavata.common.utils.ClientSettings;
-//import org.apache.airavata.common.utils.DBUtil;
-//import org.apache.airavata.common.utils.ServerSettings;
-//import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
-//import org.apache.airavata.credential.store.store.CredentialReader;
-//import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
-//import org.apache.airavata.gfac.GFacException;
-//import org.apache.airavata.gfac.RequestData;
-//import org.apache.airavata.gfac.ssh.security.TokenizedSSHAuthInfo;
-//import org.apache.airavata.gsi.ssh.api.SSHApiException;
-//import org.apache.airavata.gsi.ssh.api.ServerInfo;
-//import org.apache.airavata.gsi.ssh.impl.PBSCluster;
-//import org.apache.airavata.gsi.ssh.util.CommonUtils;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-//import org.apache.airavata.registry.api.AiravataRegistryFactory;
-//import org.apache.airavata.registry.api.AiravataUser;
-//import org.apache.airavata.registry.api.Gateway;
-//import org.apache.airavata.registry.api.exception.RegAccessorInstantiateException;
-//import org.apache.airavata.registry.api.exception.RegAccessorInvalidException;
-//import org.apache.airavata.registry.api.exception.RegAccessorUndefinedException;
-//import org.apache.airavata.registry.api.exception.RegException;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.testng.annotations.BeforeTest;
-//import org.testng.annotations.Test;
-//
-//import java.util.UUID;
-//
-//public class CredentialStoreTest {
-//    private final static Logger logger = LoggerFactory.getLogger(CredentialStoreTest.class);
-//
-//    @BeforeTest
-//    public void testGSISSHProvider() throws GFacException, IllegalAccessException, ClassNotFoundException, InstantiationException, ApplicationSettingsException, SSHApiException {
-//        System.setProperty("credential.store.keystore.url", "/Users/lahirugunathilake/Downloads/airavata_sym.jks");
-//        System.setProperty("credential.store.keystore.alias", "airavata");
-//        System.setProperty("credential.store.keystore.password", "airavata");
-//        System.setProperty("myproxy.username", "ogce");
-//        System.setProperty("myproxy.password", "");
-//        System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
-//        System.setProperty("credential.store.jdbc.url","jdbc:mysql://gw85.iu.xsede.org:3306/airavata_gta_prod");
-//        System.setProperty("credential.store.jdbc.user","gtaAiravataUser");
-//        System.setProperty("credential.store.jdbc.password","gtaAiravataPWD");
-//        System.setProperty("credential.store.jdbc.driver","com.mysql.jdbc.Driver");
-//
-//
-//
-//            UUID uuid = UUID.randomUUID();
-//            System.out.println("TokenId: " + uuid.toString());
-////            String publicKey = registry.createCredential("default",uuid.toString(),"lginnali" );
-////            System.out.println("Public-Key: " +publicKey);
-////            String tokenId = uuid.toString();
-//            String tokenId = "2c308fa9-99f8-4baa-92e4-d062e311483c";
-//            CredentialReader credentialReader = new CredentialReaderImpl(new DBUtil("jdbc:mysql://gw85.iu.xsede.org:3306/airavata_gta_prod",
-//                    "ptaAiravataUser", "ptaAiravataPWD", "com.mysql.jdbc.Driver"));
-//
-//
-//            RequestData requestData = new RequestData();
-//            requestData.setMyProxyUserName("cgateway");
-//            requestData.setTokenId(tokenId);
-//            requestData.setGatewayId("default");
-//            TokenizedSSHAuthInfo tokenizedSSHAuthInfo = new TokenizedSSHAuthInfo(credentialReader, requestData);
-//
-//            SSHCredential credentials = tokenizedSSHAuthInfo.getCredentials();
-//            ServerInfo serverInfo = new ServerInfo("cgateway", "bigred2.uits.iu.edu");
-//
-//            PBSCluster pbsCluster = new PBSCluster(serverInfo, tokenizedSSHAuthInfo, CommonUtils.getPBSJobManager("/opt/torque/bin/"));
-//            Assert.assertNotNull(pbsCluster);
-//            return;
-//
-//    }
-//
-//    @Test
-//    public static void main(String[] args) {
-//        try {
-//            new CredentialStoreTest().testGSISSHProvider();
-//        } catch (GFacException e) {
-//            e.printStackTrace();
-//        } catch (IllegalAccessException e) {
-//            e.printStackTrace();
-//        } catch (ClassNotFoundException e) {
-//            e.printStackTrace();
-//        } catch (InstantiationException e) {
-//            e.printStackTrace();
-//        } catch (ApplicationSettingsException e) {
-//            e.printStackTrace();
-//        } catch (SSHApiException e) {
-//            e.printStackTrace();
-//        }
-//    }
-//
-//    private static AiravataAPI getAiravataAPI() throws AiravataAPIInvocationException, ApplicationSettingsException {
-//        AiravataAPI airavataAPI;
-//        try {
-//            String sysUser = ClientSettings.getSetting("admin");
-//            String gateway = ClientSettings.getSetting("default");
-//            airavataAPI = AiravataAPIFactory.getAPI(gateway, sysUser);
-//        } catch (AiravataAPIInvocationException e) {
-//            logger.error("Unable to create airavata API", e.getMessage());
-//            throw new AiravataAPIInvocationException(e);
-//        } catch (ApplicationSettingsException e) {
-//            logger.error("Unable to create airavata API", e.getMessage());
-//            throw new ApplicationSettingsException(e.getMessage());
-//        }
-//        return airavataAPI;
-//    }
-//
-//}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/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
deleted file mode 100644
index b115b6c..0000000
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.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.core.gfac.services.impl;
-//
-//import java.io.File;
-//import java.net.URL;
-//import java.util.ArrayList;
-//import java.util.Date;
-//import java.util.List;
-//import java.util.UUID;
-//
-//import org.apache.airavata.commons.gfac.type.ActualParameter;
-//import org.apache.airavata.commons.gfac.type.ApplicationDescription;
-//import org.apache.airavata.commons.gfac.type.HostDescription;
-//import org.apache.airavata.commons.gfac.type.MappingFactory;
-//import org.apache.airavata.commons.gfac.type.ServiceDescription;
-//import org.apache.airavata.gfac.GFacConfiguration;
-//import org.apache.airavata.gfac.GFacException;
-//import org.apache.airavata.gfac.core.context.ApplicationContext;
-//import org.apache.airavata.gfac.core.context.JobExecutionContext;
-//import org.apache.airavata.gfac.core.context.MessageContext;
-//import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
-//import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
-//import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
-//import org.apache.airavata.schemas.gfac.InputParameterType;
-//import org.apache.airavata.schemas.gfac.OutputParameterType;
-//import org.apache.airavata.schemas.gfac.SSHHostType;
-//import org.apache.airavata.schemas.gfac.StringParameterType;
-//import org.apache.commons.lang.SystemUtils;
-//import org.junit.Assert;
-//import org.junit.Before;
-//import org.junit.Test;
-//
-//public class SSHProviderTestWithSSHAuth {
-//	private JobExecutionContext jobExecutionContext;
-//    @Before
-//    public void setUp() throws Exception {
-//
-//    	URL resource = SSHProviderTestWithSSHAuth.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
-//        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null);
-////        gFacConfiguration.s
-//        //have to set InFlwo Handlers and outFlowHandlers
-//        ApplicationContext applicationContext = new ApplicationContext();
-//        HostDescription host = new HostDescription(SSHHostType.type);
-//        host.getType().setHostName("bigred");
-//        host.getType().setHostAddress("bigred2.uits.iu.edu");
-//        applicationContext.setHostDescription(host);
-//        /*
-//           * App
-//           */
-//        ApplicationDescription appDesc = new ApplicationDescription();
-//        ApplicationDeploymentDescriptionType app = appDesc.getType();
-//        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
-//        name.setStringValue("EchoSSH");
-//        app.setApplicationName(name);
-//
-//        /*
-//           * Use bat file if it is compiled on Windows
-//           */
-//        if (SystemUtils.IS_OS_WINDOWS) {
-//            URL url = this.getClass().getClassLoader().getResource("echo.bat");
-//            app.setExecutableLocation(url.getFile());
-//        } else {
-//            //for unix and Mac
-//            app.setExecutableLocation("/bin/echo");
-//        }
-//
-//        /*
-//         * Job location
-//        */
-//        String tempDir = "/tmp";
-//        String date = (new Date()).toString();
-//        date = date.replaceAll(" ", "_");
-//        date = date.replaceAll(":", "_");
-//
-//        tempDir = tempDir + File.separator
-//                + "EchoSSH" + "_" + date + "_" + UUID.randomUUID();
-//
-//        app.setScratchWorkingDirectory(tempDir);
-//        app.setStaticWorkingDirectory(tempDir);
-//        app.setInputDataDirectory(tempDir + File.separator + "input");
-//        app.setOutputDataDirectory(tempDir + File.separator + "output");
-//        app.setStandardOutput(tempDir + File.separator + "echo.stdout");
-//        app.setStandardError(tempDir + File.separator + "echo.stderr");
-//
-//        applicationContext.setApplicationDeploymentDescription(appDesc);
-//
-//        /*
-//           * Service
-//           */
-//        ServiceDescription serv = new ServiceDescription();
-//        serv.getType().setName("EchoSSH");
-//
-//        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
-//        InputParameterType input = InputParameterType.Factory.newInstance();
-//        input.setParameterName("echo_input");
-//        input.setParameterType(StringParameterType.Factory.newInstance());
-//        inputList.add(input);
-//        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
-//                .size()]);
-//
-//        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
-//        OutputParameterType output = OutputParameterType.Factory.newInstance();
-//        output.setParameterName("echo_output");
-//        output.setParameterType(StringParameterType.Factory.newInstance());
-//        outputList.add(output);
-//        OutputParameterType[] outputParamList = outputList
-//                .toArray(new OutputParameterType[outputList.size()]);
-//
-//        serv.getType().setInputParametersArray(inputParamList);
-//        serv.getType().setOutputParametersArray(outputParamList);
-//
-//        jobExecutionContext = new JobExecutionContext(gFacConfiguration,serv.getType().getName());
-//        jobExecutionContext.setApplicationContext(applicationContext);
-//
-//        // Add security context
-//        jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, getSecurityContext());
-//        /*
-//        * Host
-//        */
-//        applicationContext.setServiceDescription(serv);
-//
-//        MessageContext inMessage = new MessageContext();
-//        ActualParameter echo_input = new ActualParameter();
-//		((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
-//        inMessage.addParameter("echo_input", echo_input);
-//
-//        jobExecutionContext.setInMessageContext(inMessage);
-//
-//        MessageContext outMessage = new MessageContext();
-//        ActualParameter echo_out = new ActualParameter();
-////		((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
-//        outMessage.addParameter("echo_output", echo_out);
-//
-//        jobExecutionContext.setOutMessageContext(outMessage);
-//
-//    }
-//
-//	private SSHSecurityContext getSecurityContext() {
-//		SSHSecurityContext context = new SSHSecurityContext();
-//        context.setUsername("lginnali");
-//        context.setPrivateKeyLoc("~/.ssh/id_dsa");
-//        context.setKeyPass("i want to be free");
-//		return context;
-//	}
-//
-//    @Test
-//    public void testLocalProvider() throws GFacException {
-//        BetterGfacImpl gFacAPI = new BetterGfacImpl();
-//        gFacAPI.submitJob(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID(), jobExecutionContext.getGatewayID());
-//        MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
-//        Assert.assertEquals(MappingFactory.toString((ActualParameter)outMessageContext.getParameter("echo_output")), "hello");
-//    }
-//}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-ssh/src/test/resources/PBSTemplate.xslt
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/resources/PBSTemplate.xslt b/modules/gfac/gfac-ssh/src/test/resources/PBSTemplate.xslt
deleted file mode 100644
index cf8dfb6..0000000
--- a/modules/gfac/gfac-ssh/src/test/resources/PBSTemplate.xslt
+++ /dev/null
@@ -1,75 +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. -->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12">
-<xsl:output method="text" />
-<xsl:template match="/ns:JobDescriptor">
-#! /bin/sh
-# PBS batch job submission script generated by Apache Airavata
-#   <xsl:choose>
-    <xsl:when test="ns:shellName">
-##PBS -S <xsl:value-of select="ns:shellName"/>
-    </xsl:when></xsl:choose>
-    <xsl:choose>
-    <xsl:when test="ns:queueName">
-#PBS -q <xsl:value-of select="ns:queueName"/>
-    </xsl:when>
-    </xsl:choose>
-    <xsl:choose>
-    <xsl:when test="ns:mailOptions">
-#PBS -m <xsl:value-of select="ns:mailOptions"/>
-    </xsl:when>
-    </xsl:choose>
-    <xsl:choose>
-<xsl:when test="ns:acountString">
-#PBS -A <xsl:value-of select="ns:acountString"/>
-    </xsl:when>
-    </xsl:choose>
-    <xsl:choose>
-    <xsl:when test="ns:maxWallTime">
-#PBS -l walltime=<xsl:value-of select="ns:maxWallTime"/>
-    </xsl:when>
-    </xsl:choose>
-    <xsl:choose>
-    <xsl:when test="ns:standardOutFile">
-#PBS -o <xsl:value-of select="ns:standardOutFile"/>
-    </xsl:when>
-    </xsl:choose>
-    <xsl:choose>
-    <xsl:when test="ns:standardOutFile">
-#PBS -e <xsl:value-of select="ns:standardErrorFile"/>
-    </xsl:when>
-    </xsl:choose>
-    <xsl:choose>
-    <xsl:when test="(ns:nodes) and (ns:processesPerNode)">
-#PBS -l nodes=<xsl:value-of select="ns:nodes"/>:ppn=<xsl:value-of select="ns:processesPerNode"/>
-<xsl:text>&#xa;</xsl:text>
-    </xsl:when>
-    </xsl:choose>
-<xsl:for-each select="ns:exports/ns:name">
-<xsl:value-of select="."/>=<xsl:value-of select="./@value"/><xsl:text>&#xa;</xsl:text>
-export<xsl:text>   </xsl:text><xsl:value-of select="."/>
-<xsl:text>&#xa;</xsl:text>
-</xsl:for-each>
-<xsl:for-each select="ns:preJobCommands/ns:command">
-      <xsl:value-of select="."/><xsl:text>   </xsl:text>
-    </xsl:for-each>
-cd <xsl:text>   </xsl:text><xsl:value-of select="ns:workingDirectory"/><xsl:text>&#xa;</xsl:text>
-    <xsl:choose><xsl:when test="ns:jobSubmitterCommand != ''">
-<xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text>   </xsl:text>
-<xsl:value-of select="ns:cpuCount"/><xsl:text>   </xsl:text>
-    </xsl:when></xsl:choose><xsl:value-of select="ns:executablePath"/><xsl:text>   </xsl:text>
-<xsl:for-each select="ns:inputs/ns:input">
-      <xsl:value-of select="."/><xsl:text>   </xsl:text>
-    </xsl:for-each>
-<xsl:for-each select="ns:postJobCommands/ns:command">
-      <xsl:value-of select="."/><xsl:text>   </xsl:text>
-</xsl:for-each>
-
-</xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-ssh/src/test/resources/logging.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/resources/logging.properties b/modules/gfac/gfac-ssh/src/test/resources/logging.properties
deleted file mode 100644
index 0584d38..0000000
--- a/modules/gfac/gfac-ssh/src/test/resources/logging.properties
+++ /dev/null
@@ -1,42 +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.
-#
-#
-#default/fallback log4j configuration
-#
-
-# Set root logger level to WARN and its only appender to A1.
-log4j.rootLogger=INFO, A1, A2
-
-# A1 is set to be a rolling file appender with default params
-log4j.appender.A1=org.apache.log4j.RollingFileAppender
-log4j.appender.A1.File=target/seclogs.txt
-
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
-
-# A2 is a console appender
-log4j.appender.A2=org.apache.log4j.ConsoleAppender
-
-# A2 uses PatternLayout.
-log4j.appender.A2.layout=org.apache.log4j.PatternLayout
-log4j.appender.A2.layout.ConversionPattern=%d [%t] %-5p %c{1} %x - %m%n
-
-log4j.logger.unicore.security=INFO
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/pom.xml b/modules/gfac/pom.xml
index 7f661ae..0414afc 100644
--- a/modules/gfac/pom.xml
+++ b/modules/gfac/pom.xml
@@ -31,14 +31,11 @@
                 <activeByDefault>true</activeByDefault>
             </activation>
             <modules>
+                <module>gfac-service</module>
+                <module>gfac-client</module>
                 <module>gfac-core</module>
-                <module>gfac-ssh</module>
-                <module>gfac-local</module>
-                <module>gfac-gsissh</module>
+                <module>gfac-impl</module>
                 <module>gfac-bes</module>
-                <module>gfac-monitor</module>
-                <module>airavata-gfac-service</module>
-                <module>airavata-gfac-stubs</module>
                 <module>gfac-application-specific-handlers</module>
             </modules>
         </profile>

http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACEmbeddedJobSubmitter.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACEmbeddedJobSubmitter.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACEmbeddedJobSubmitter.java
index e93ae71..e506556 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACEmbeddedJobSubmitter.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACEmbeddedJobSubmitter.java
@@ -21,24 +21,17 @@
 package org.apache.airavata.orchestrator.core.impl;
 
 
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.MonitorPublisher;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.credential.store.store.CredentialReader;
 import org.apache.airavata.gfac.client.GFACInstance;
-import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
-import org.apache.airavata.gfac.core.cpi.GFac;
-import org.apache.airavata.gfac.core.utils.GFacUtils;
+import org.apache.airavata.gfac.core.GFac;
+import org.apache.airavata.gfac.core.GFacUtils;
 import org.apache.airavata.orchestrator.core.context.OrchestratorContext;
 import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
 import org.apache.airavata.orchestrator.core.job.JobSubmitter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.eventbus.EventBus;
-
-import java.io.IOException;
-
 /**
  * This is the simplest implementation for JobSubmitter,
  * This is calling gfac invocation methods to invoke the gfac embedded mode,so this does not really implement
@@ -54,7 +47,6 @@ public class GFACEmbeddedJobSubmitter implements JobSubmitter {
 
     public void initialize(OrchestratorContext orchestratorContext) throws OrchestratorException {
         this.orchestratorContext = orchestratorContext;
-        gfac = BetterGfacImpl.getInstance();
     }
 
     public GFACInstance selectGFACInstance() throws OrchestratorException {