in taverna-server-webapp/src/main/java/org/apache/taverna/server/master/InputREST.java [167:197]
private InDesc setRemoteInput(String name, Reference ref, String delimiter,
UriInfo ui) throws BadStateChangeException,
BadPropertyValueException, FilesystemAccessException {
URITemplate tmpl = new URITemplate(ui.getBaseUri()
+ "/runs/{runName}/wd/{path:.+}");
MultivaluedMap<String, String> mvm = new MetadataMap<>();
if (!tmpl.match(ref.contents, mvm)) {
throw new BadPropertyValueException(
"URI in reference does not refer to local disk resource");
}
try {
File from = fileUtils.getFile(
support.getRun(mvm.get("runName").get(0)),
SyntheticDirectoryEntry.make(mvm.get("path").get(0)));
File to = run.getWorkingDirectory().makeEmptyFile(
support.getPrincipal(), randomUUID().toString());
to.copy(from);
Input i = support.getInput(run, name);
if (i == null)
i = run.makeInput(name);
i.setFile(to.getFullName());
i.setDelimiter(delimiter);
return new InDesc(i, ui);
} catch (UnknownRunException e) {
throw new BadStateChangeException("may not copy from that run", e);
} catch (NoDirectoryEntryException e) {
throw new BadStateChangeException("source does not exist", e);
}
}