in taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java [63:115]
public void checkProvidedInputs(Map<String, InputWorkflowPort> portMap,
CommandLineOptions options) throws InputMismatchException, IOException {
if (options.hasInputBundle()) {
try (Bundle inputBundle = openInputBundle(options)) {
Path inputs = DataBundles.getInputs(inputBundle);
Set<String> expected = portMap.keySet();
Set<String> provided = DataBundles.getPorts(inputs).keySet();
if (! provided.containsAll(expected)) {
throw new InputMismatchException("Missing inputs", expected, provided);
}
}
// inputFiles/values ignored if input bundle is provided
return;
}
// we dont check for the document
Set<String> providedInputNames = new HashSet<String>();
for (int i = 0; i < options.getInputFiles().length; i += 2) {
// If it already contains a value for the input port, e.g
// two inputs are provided for the same port
if (providedInputNames.contains(options.getInputFiles()[i])) {
throw new InputMismatchException(
"Two input values were provided for the same input port "
+ options.getInputFiles()[i] + ".", null, null);
}
providedInputNames.add(options.getInputFiles()[i]);
}
for (int i = 0; i < options.getInputValues().length; i += 2) {
// If it already contains a value for the input port, e.g
// two inputs are provided for the same port
if (providedInputNames.contains(options.getInputValues()[i])) {
throw new InputMismatchException(
"Two input values were provided for the same input port "
+ options.getInputValues()[i] + ".", null, null);
}
providedInputNames.add(options.getInputValues()[i]);
}
if (portMap.size() * 2 != (options.getInputFiles().length + options.getInputValues().length)) {
throw new InputMismatchException(
"The number of inputs provided does not match the number of input ports.",
portMap.keySet(), providedInputNames);
}
for (String portName : portMap.keySet()) {
if (!providedInputNames.contains(portName)) {
throw new InputMismatchException(
"The provided inputs does not contain an input for the port '"
+ portName + "'", portMap.keySet(), providedInputNames);
}
}
}