private void registerInputsFromValues()

in taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java [172:203]


	private void registerInputsFromValues(Map<String, InputWorkflowPort> portMap,
			CommandLineOptions options, Path inputs) throws InvalidOptionException {
		String[] inputParams = options.getInputValues();
		for (int i = 0; i < inputParams.length; i = i + 2) {
			String inputName = inputParams[i];
			try {
				String inputValue = 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 = checkForDepthMismatch(1, port.getDepth(), inputName,
							inputValue.split(delimiter));
					setValue(portPath, value);
				} else {
					Object value = checkForDepthMismatch(0, port.getDepth(), inputName, inputValue);
					setValue(portPath, value);
				}

			} catch (IndexOutOfBoundsException e) {
				throw new InvalidOptionException("Missing input value for input " + inputName);
			} catch (IOException e) {
				throw new InvalidOptionException("Error creating value for input " + inputName);
			}
		}
	}