in taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java [205:237]
private void regesterInputsFromFiles(Map<String, InputWorkflowPort> portMap,
CommandLineOptions options, Path inputs, URL url) throws InvalidOptionException {
String[] inputParams = options.getInputFiles();
for (int i = 0; i < inputParams.length; i = i + 2) {
String inputName = inputParams[i];
try {
URL inputURL = new URL(url, inputParams[i + 1]);
InputWorkflowPort port = portMap.get(inputName);
if (port == null) {
throw new InvalidOptionException("Cannot find an input port named '"
+ inputName + "'");
}
Path portPath = DataBundles.getPort(inputs, inputName);
if (options.hasDelimiterFor(inputName)) {
String delimiter = options.inputDelimiter(inputName);
Object value = IOUtils.toString(inputURL.openStream()).split(delimiter);
value = checkForDepthMismatch(1, port.getDepth(), inputName, value);
setValue(portPath, value);
} else {
Object value = IOUtils.toByteArray(inputURL.openStream());
value = checkForDepthMismatch(0, port.getDepth(), inputName, value);
setValue(portPath, value);
}
} catch (IndexOutOfBoundsException e) {
throw new InvalidOptionException("Missing input filename for input " + inputName);
} catch (IOException e) {
throw new InvalidOptionException("Could not read input " + inputName + ": "
+ e.getMessage());
}
}
}