uima-ducc-common/src/main/java/org/apache/uima/ducc/common/uima/UimaHelper.java [256:405]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	private static void addOverrides(List<List<String>> overrides,
			AnalysisEngineDescription desc, ResourceSpecifier[] specifiers,
			List<String> flowNames) throws Exception {

		ConfigurationParameterDeclarations aggregateDeclarations = desc
				.getAnalysisEngineMetaData()
				.getConfigurationParameterDeclarations();
		ConfigurationParameterSettings aggregateSetttings = desc
				.getAnalysisEngineMetaData()
				.getConfigurationParameterSettings();
		int indx = 0;
		for (List<String> componentOverrides : overrides) {
			if ( specifiers[indx] instanceof ResourceCreationSpecifier ) {
				addComponentOverrides(flowNames.get(indx), componentOverrides,
						(ResourceCreationSpecifier) specifiers[indx],
						aggregateDeclarations, aggregateSetttings);
			}
			indx++;
		}
		
	}
	
	/**
	 * Modifies aggregate descriptor by adding component specific overrides.
	 * 
	 * @param key
	 *            - component key
	 * @param componentOverrides
	 *            - List of override params where element is expressed as String
	 *            with format <name>=<value>
	 * @param specifier
	 *            - component resource specifier
	 * @param aggregateDeclarations
	 *            - aggregate ConfigurationParameterDeclarations
	 * @param aggregateSetttings
	 *            - aggregate ConfigurationParameterSettings
	 */
	private static void addComponentOverrides(String key,
			List<String> componentOverrides,
//			AnalysisEngineDescription specifier,
			ResourceCreationSpecifier specifier,
			ConfigurationParameterDeclarations aggregateDeclarations,
			ConfigurationParameterSettings aggregateSetttings) throws Exception {

		if (componentOverrides == null || componentOverrides.isEmpty()) { // no
																			// overrides
			return; // nothing to do
		}
		processOverrides(key, componentOverrides,
			specifier, aggregateDeclarations,
			//	(ResourceCreationSpecifier) specifier, aggregateDeclarations,
				aggregateSetttings);

	}

	private static void processOverrides(String key,
			List<String> componentOverrides,
			ResourceCreationSpecifier specifier,
			ConfigurationParameterDeclarations aggregateDeclarations,
			ConfigurationParameterSettings aggregateSetttings) throws Exception {
		// Process overrides
		for (String cmOverride : componentOverrides) {
			System.out.println(".... Processing Override:"+cmOverride);
			// each override is expressed as <name>=<value> pair, so split on
			// the first '=' found ... in case the value contains an '='
			String[] nvp = cmOverride.split("=", 2);
			// Fetch component parameter declarations to get the primitive type
			// of the parameter
			ConfigurationParameterDeclarations componentParameterDeclarations = specifier
					.getMetaData().getConfigurationParameterDeclarations();
			// Iterate over component parameter declarations looking to find one
			// with the same name
			// as provided in the override. On match, add an override to the
			// aggregate and preserve
			// the type defined for the parameter in the component descriptor.
			// If no match, throw
			// an exception
			boolean found = false;
			for (ConfigurationParameter parameter : componentParameterDeclarations
					.getConfigurationParameters()) {
				if (nvp[0].equals(parameter.getName())) {
					addParam(key, nvp, parameter, aggregateDeclarations);
					addParamValue(nvp, parameter, aggregateSetttings);
					found = true;
					break;
				}
			}
			if (!found) {
				throw new UIMARuntimeException(
						new InvalidOverrideParameterException(
								"Override Parameter:"
										+ nvp[0]
										+ " is not defined for the component with key: "
										+ key));
			}
		}

	}

	/**
	 * Adds parameter to aggregate ConfigurationParameterDeclarations.
	 * 
	 * @param key
	 *            - component key
	 * @param nvp
	 *            - override name value pair
	 * @param parameter
	 *            - matching ConfigurationParameter instance from component
	 *            descriptor or null
	 * @param aggregateDeclarations
	 *            - aggregate ConfigurationParameterDeclarations instance
	 */
	private static void addParam(String key, String[] nvp,
			ConfigurationParameter parameter,
			ConfigurationParameterDeclarations aggregateDeclarations) {
		ConfigurationParameter cfgParam = new ConfigurationParameter_impl();
		cfgParam.setName(nvp[0]);
		if (parameter == null) { // component descriptor doesnt contain a
									// parameter provided in the override list.
									// Default to String
			cfgParam.setType("String"); // create String param as default
		} else {
			cfgParam.setType(parameter.getType());
		}
//		if ( key.equals(FlowControllerKey)) {
//			cfgParam.addOverride(key + "/ActionAfterCasMultiplier");
//		} else {
//			cfgParam.addOverride(key + "/" + nvp[0]);
//		}
		cfgParam.addOverride(key + "/" + nvp[0]);
		aggregateDeclarations.addConfigurationParameter(cfgParam);

	}

	private static void addParamValue(String[] nvp,
			ConfigurationParameter parameter,
			ConfigurationParameterSettings aggregateSettings) {

		Object value = nvp[1]; // default is String value
		if (parameter != null) {
			if (parameter.getType().equals("Integer")) {
				value = Integer.parseInt(nvp[1]);
			} else if (parameter.getType().equals("Boolean")) {
				value = Boolean.parseBoolean(nvp[1]);
			} else if (parameter.getType().equals("Float")) {
				value = Float.parseFloat(nvp[1]);
			}
			aggregateSettings.setParameterValue(nvp[0], value);
		} else {
			aggregateSettings.setParameterValue(nvp[0], value);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



uima-ducc-user/src/main/java/org/apache/uima/ducc/user/common/UimaUtils.java [266:415]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	private static void addOverrides(List<List<String>> overrides,
			AnalysisEngineDescription desc, ResourceSpecifier[] specifiers,
			List<String> flowNames) throws Exception {

		ConfigurationParameterDeclarations aggregateDeclarations = desc
				.getAnalysisEngineMetaData()
				.getConfigurationParameterDeclarations();
		ConfigurationParameterSettings aggregateSetttings = desc
				.getAnalysisEngineMetaData()
				.getConfigurationParameterSettings();
		int indx = 0;
		for (List<String> componentOverrides : overrides) {
			if ( specifiers[indx] instanceof ResourceCreationSpecifier ) {
				addComponentOverrides(flowNames.get(indx), componentOverrides,
						(ResourceCreationSpecifier) specifiers[indx],
						aggregateDeclarations, aggregateSetttings);
			}
			indx++;
		}
		
	}
	
	/**
	 * Modifies aggregate descriptor by adding component specific overrides.
	 * 
	 * @param key
	 *            - component key
	 * @param componentOverrides
	 *            - List of override params where element is expressed as String
	 *            with format <name>=<value>
	 * @param specifier
	 *            - component resource specifier
	 * @param aggregateDeclarations
	 *            - aggregate ConfigurationParameterDeclarations
	 * @param aggregateSetttings
	 *            - aggregate ConfigurationParameterSettings
	 */
	private static void addComponentOverrides(String key,
			List<String> componentOverrides,
//			AnalysisEngineDescription specifier,
			ResourceCreationSpecifier specifier,
			ConfigurationParameterDeclarations aggregateDeclarations,
			ConfigurationParameterSettings aggregateSetttings) throws Exception {

		if (componentOverrides == null || componentOverrides.isEmpty()) { // no
																			// overrides
			return; // nothing to do
		}
		processOverrides(key, componentOverrides,
			specifier, aggregateDeclarations,
			//	(ResourceCreationSpecifier) specifier, aggregateDeclarations,
				aggregateSetttings);

	}

	private static void processOverrides(String key,
			List<String> componentOverrides,
			ResourceCreationSpecifier specifier,
			ConfigurationParameterDeclarations aggregateDeclarations,
			ConfigurationParameterSettings aggregateSetttings) throws Exception {
		// Process overrides
		for (String cmOverride : componentOverrides) {
			System.out.println(".... Processing Override:"+cmOverride);
			// each override is expressed as <name>=<value> pair, so split on
			// the first '=' found ... in case the value contains an '='
			String[] nvp = cmOverride.split("=", 2);
			// Fetch component parameter declarations to get the primitive type
			// of the parameter
			ConfigurationParameterDeclarations componentParameterDeclarations = specifier
					.getMetaData().getConfigurationParameterDeclarations();
			// Iterate over component parameter declarations looking to find one
			// with the same name
			// as provided in the override. On match, add an override to the
			// aggregate and preserve
			// the type defined for the parameter in the component descriptor.
			// If no match, throw
			// an exception
			boolean found = false;
			for (ConfigurationParameter parameter : componentParameterDeclarations
					.getConfigurationParameters()) {
				if (nvp[0].equals(parameter.getName())) {
					addParam(key, nvp, parameter, aggregateDeclarations);
					addParamValue(nvp, parameter, aggregateSetttings);
					found = true;
					break;
				}
			}
			if (!found) {
				throw new UIMARuntimeException(
						new InvalidOverrideParameterException(
								"Override Parameter:"
										+ nvp[0]
										+ " is not defined for the component with key: "
										+ key));
			}
		}

	}

	/**
	 * Adds parameter to aggregate ConfigurationParameterDeclarations.
	 * 
	 * @param key
	 *            - component key
	 * @param nvp
	 *            - override name value pair
	 * @param parameter
	 *            - matching ConfigurationParameter instance from component
	 *            descriptor or null
	 * @param aggregateDeclarations
	 *            - aggregate ConfigurationParameterDeclarations instance
	 */
	private static void addParam(String key, String[] nvp,
			ConfigurationParameter parameter,
			ConfigurationParameterDeclarations aggregateDeclarations) {
		ConfigurationParameter cfgParam = new ConfigurationParameter_impl();
		cfgParam.setName(nvp[0]);
		if (parameter == null) { // component descriptor doesnt contain a
									// parameter provided in the override list.
									// Default to String
			cfgParam.setType("String"); // create String param as default
		} else {
			cfgParam.setType(parameter.getType());
		}
//		if ( key.equals(FlowControllerKey)) {
//			cfgParam.addOverride(key + "/ActionAfterCasMultiplier");
//		} else {
//			cfgParam.addOverride(key + "/" + nvp[0]);
//		}
		cfgParam.addOverride(key + "/" + nvp[0]);
		aggregateDeclarations.addConfigurationParameter(cfgParam);

	}

	private static void addParamValue(String[] nvp,
			ConfigurationParameter parameter,
			ConfigurationParameterSettings aggregateSettings) {

		Object value = nvp[1]; // default is String value
		if (parameter != null) {
			if (parameter.getType().equals("Integer")) {
				value = Integer.parseInt(nvp[1]);
			} else if (parameter.getType().equals("Boolean")) {
				value = Boolean.parseBoolean(nvp[1]);
			} else if (parameter.getType().equals("Float")) {
				value = Float.parseFloat(nvp[1]);
			}
			aggregateSettings.setParameterValue(nvp[0], value);
		} else {
			aggregateSettings.setParameterValue(nvp[0], value);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



