in taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/ssh/SshToolInvocation.java [486:533]
public static void load(File directory) {
File invocationsFile = new File(directory, SSH_INVOCATION_FILE);
if (!invocationsFile.exists()) {
return;
}
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(invocationsFile));
String line = reader.readLine();
while (line != null) {
String[] parts = line.split(" ");
if (parts.length != 2) {
break;
}
String runId = parts[0];
String urlString = parts[1];
Set<SshUrl> urls = runIdToTempDir.get(runId);
if (urls == null) {
urls = new HashSet<SshUrl>();
runIdToTempDir.put(runId, urls);
}
URI uri = new URI(urlString);
String fullPath = uri.getPath();
String path = fullPath.substring(0, fullPath.lastIndexOf("/"));
String tempDir = fullPath.substring(fullPath.lastIndexOf("/"));
SshNode node = SshNodeFactory.getInstance().getSshNode(
uri.getHost(), uri.getPort(), path);
SshUrl newUrl = new SshUrl(node);
newUrl.setSubDirectory(tempDir);
urls.add(newUrl);
line = reader.readLine();
}
} catch (FileNotFoundException e) {
logger.error(e);
} catch (URISyntaxException e) {
logger.error(e);
} catch (IOException e) {
logger.error(e);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
logger.error(e);
}
}
}
}