public void initialize(InvocationContext invocationContext) throws GfacException {
ExecutionContext appExecContext = invocationContext.getExecutionContext();
ExecutionModel model = appExecContext.getExecutionModel();
GridFtp ftp = new GridFtp();
try {
GSSCredential gssCred = ((GSISecurityContext) invocationContext.getSecurityContext(MYPROXY_SECURITY_CONTEXT)).getGssCredentails();
// get Hostname
String hostgridFTP = null;
if (model.getHostDesc().getHostConfiguration().getGridFTPArray() != null && model.getHostDesc().getHostConfiguration().getGridFTPArray().length > 0) {
hostgridFTP = model.getHostDesc().getHostConfiguration().getGridFTPArray(0).getEndPointReference();
} else {
hostgridFTP = model.getHost();
}
URI tmpdirURI = GfacUtils.createGsiftpURI(hostgridFTP, model.getTmpDir());
URI workingDirURI = GfacUtils.createGsiftpURI(hostgridFTP, model.getWorkingDir());
URI inputURI = GfacUtils.createGsiftpURI(hostgridFTP, model.getInputDataDir());
URI outputURI = GfacUtils.createGsiftpURI(hostgridFTP, model.getOutputDataDir());
log.info("Host FTP = " + hostgridFTP);
log.info("temp directory = " + tmpdirURI);
log.info("Working directory = " + workingDirURI);
log.info("Input directory = " + inputURI);
log.info("Output directory = " + outputURI);
ftp.makeDir(tmpdirURI, gssCred);
ftp.makeDir(workingDirURI, gssCred);
ftp.makeDir(inputURI, gssCred);
ftp.makeDir(outputURI, gssCred);
} catch (Exception e) {
e.printStackTrace();
}
}