RequestData requestData = new RequestData(ServerSettings.getDefaultUserGateway());
requestData.setTokenId(credentialStoreToken);
PBSCluster pbsCluster = null;
GSISecurityContext context = null;
try {
TokenizedMyProxyAuthInfo tokenizedMyProxyAuthInfo = new TokenizedMyProxyAuthInfo(requestData);
GsisshHostType gsisshHostType = (GsisshHostType) registeredHost.getType();
ServerInfo serverInfo = new ServerInfo(requestData.getMyProxyUserName(), registeredHost.getType().getHostAddress(),
gsisshHostType.getPort());
JobManagerConfiguration jConfig = null;
String installedParentPath = ((HpcApplicationDeploymentType)
jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
String jobManager = ((GsisshHostType) registeredHost.getType()).getJobManager();
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.getSGEJobManager(installedParentPath);
}
}
pbsCluster = new PBSCluster(serverInfo, tokenizedMyProxyAuthInfo, jConfig);
context = new GSISecurityContext(tokenizedMyProxyAuthInfo.getCredentialReader(), requestData,pbsCluster);
} catch (Exception e) {
throw new GFacException("An error occurred while creating GSI security context", e);
}
jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, context);
}