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) {
SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
String credentialStoreToken = jobExecutionContext.getCredentialStoreToken(); // this is set by the framework
RequestData requestData = new RequestData(ServerSettings.getDefaultUserGateway());
requestData.setTokenId(credentialStoreToken);
ServerInfo serverInfo = new ServerInfo(null, registeredHost.getType().getHostAddress());
Cluster pbsCluster = null;
try {
TokenizedSSHAuthInfo tokenizedSSHAuthInfo = new TokenizedSSHAuthInfo(requestData);
String installedParentPath = "/";
if (((SSHHostType) registeredHost.getType()).getHpcResource()) {
installedParentPath = ((HpcApplicationDeploymentType)
jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
}
SSHCredential credentials = tokenizedSSHAuthInfo.getCredentials();// this is just a call to get and set credentials in to this object,data will be used
serverInfo.setUserName(credentials.getPortalUserName());
// inside the pbsCluser object
pbsCluster = new PBSCluster(serverInfo, tokenizedSSHAuthInfo,
CommonUtils.getPBSJobManager(installedParentPath));
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
sshSecurityContext.setPbsCluster(pbsCluster);
jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, sshSecurityContext);
}
}