}
return destURI.getPath();
}
private void stageOutputFiles(InvocationContext invocationContext,String outputFileStagingPath) throws ProviderException {
MessageContext<ActualParameter> outputNew = new ParameterContextImpl();
MessageContext<Object> input = invocationContext.getOutput();
for (Iterator<String> iterator = input.getNames(); iterator.hasNext(); ) {
String paramName = iterator.next();
String paramValue = input.getStringValue(paramName);
ActualParameter actualParameter = (ActualParameter) input
.getValue(paramName);
//TODO: Review this with type
GlobusHostType host = (GlobusHostType) invocationContext.getExecutionDescription().getHost().getType();
GridFtp ftp = new GridFtp();
gssContext = (GSISecurityContext) invocationContext.getSecurityContext(MYPROXY_SECURITY_CONTEXT);
GSSCredential gssCred = null;
try {
gssCred = gssContext.getGssCredentails();
} catch (SecurityException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
try {
if ("URI".equals(actualParameter.getType().getType().toString())) {
for (String endpoint : host.getGridFTPEndPointArray()) {
((URIParameterType) actualParameter.getType()).setValue(doStaging(outputFileStagingPath,
paramValue, actualParameter, ftp, gssCred, endpoint));
}
} else if ("URIArray".equals(actualParameter.getType().getType().toString())) {
List<String> split = Arrays.asList(paramValue.split(","));
List<String> newFiles = new ArrayList<String>();
for (String endpoint : host.getGridFTPEndPointArray()) {
for (String paramValueEach : split) {
newFiles.add(doStaging(outputFileStagingPath, paramValueEach, actualParameter, ftp, gssCred, endpoint));
}
((URIArrayType) actualParameter.getType()).setValueArray(newFiles.toArray(new String[newFiles.size()]));
}
}
} catch (URISyntaxException e) {
throw new ProviderException(e.getMessage(), e, invocationContext);
} catch (ToolsException e) {
throw new ProviderException(e.getMessage(), e, invocationContext);
}
outputNew.add(paramName, actualParameter);
}
invocationContext.setOutput(outputNew);
}