in taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshToolInvocation.java [372:430]
public String setOneInput(ReferenceService referenceService,
T2Reference t2Reference, ScriptInput input)
throws InvocationException {
String target = null;
String remoteName = null;
if (input.isFile()) {
remoteName = input.getTag();
} else if (input.isTempFile()) {
remoteName = "tempfile." + (nTempFiles++) + ".tmp";
}
if (input.isFile() || input.isTempFile()) {
SshReference sshRef = getAsSshReference(referenceService,
t2Reference, workerNode);
target = workerNode.getDirectory() + tmpname + "/" + remoteName;
logger.info("Target is " + target);
if (sshRef != null) {
if (!input.isForceCopy()) {
String linkCommand = workerNode.getLinkCommand();
if (linkCommand != null) {
String actualLinkCommand = getActualOsCommand(
linkCommand, sshRef.getFullPath(), remoteName,
target);
precedingCommands.add(actualLinkCommand);
return target;
}
}
String copyCommand = workerNode.getCopyCommand();
if (copyCommand != null) {
String actualCopyCommand = getActualOsCommand(copyCommand,
sshRef.getFullPath(), remoteName, target);
precedingCommands.add(actualCopyCommand);
return target;
}
}
try {
ChannelSftp sftp = SshPool.getSftpPutChannel(workerNode,
askUserForPw);
synchronized (getNodeLock(workerNode)) {
InputStream r = getAsStream(referenceService, t2Reference);
sftp.put(r, target);
r.close();
}
} catch (SftpException e) {
throw new InvocationException(e);
} catch (JSchException e) {
throw new InvocationException(e);
} catch (IOException e) {
throw new InvocationException(e);
}
return target;
} else {
String value = (String) referenceService.renderIdentifier(
t2Reference, String.class, this.getContext());
return value;
}
}