//TODO: why it is tightly coupled with gridftp
// GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
//TODO: make it more reusable
HostDescriptionType hostType = jobExecutionContext.getApplicationContext().getHostDescription().getType();
if(hostType instanceof GlobusHostType){
gridFTPEndpointArray = ((GlobusHostType) hostType).getGridFTPEndPointArray();
}
else if (hostType instanceof UnicoreHostType){
gridFTPEndpointArray = ((UnicoreHostType) hostType).getGridFTPEndPointArray();
}
else {
//TODO
}
ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
ApplicationDeploymentDescriptionType app = applicationDeploymentDescription.getType();
GridFtp ftp = new GridFtp();
try {
GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentails();
if (gridFTPEndpointArray == null || gridFTPEndpointArray.length == 0) {
gridFTPEndpointArray = new String[]{hostType.getHostAddress()};
}
boolean success = false;
GFacHandlerException pe = null;// = new ProviderException("");
for (String endpoint : gridFTPEndpointArray) {
try {