}
ResourceSpecifier crrs = xmlParser.parseCollectionReaderDescription(in);
// CR overrides - throw up if trying to override an undefined parameter
ResourceCreationSpecifier specifier = (ResourceCreationSpecifier) crrs;
ConfigurationParameterDeclarations configurationParameterDeclarations = specifier.getMetaData().getConfigurationParameterDeclarations();
ConfigurationParameterSettings cps = specifier.getMetaData().getConfigurationParameterSettings();
if(crOverrides != null) {
// Tokenize override assignments on whitespace, honoring but stripping quotes
// Then create a map from all of them
ArrayList<String> toks = QuotedOptions.tokenizeList(crOverrides, true);
Map<String,String> map = QuotedOptions.parseAssignments(toks, false);
for (Entry<String, String> ent : map.entrySet()) {
String name = ent.getKey();
String value = ent.getValue();
String message = "config param: "+name+" = '"+value+"'";
mh.frameworkDebug(cid, mid, message);
ConfigurationParameter configurationParameter = UimaUtils.findConfigurationParameter(configurationParameterDeclarations, name);
if (configurationParameter == null) {
throw new ResourceConfigurationException(
ResourceConfigurationException.NONEXISTENT_PARAMETER, new Object[] { name, "CollectionReader" });
}
Object object = UimaUtils.getOverrideValueObject(configurationParameter, value);
cps.setParameterValue(name, object);
}
}
cr = UIMAFramework.produceCollectionReader(crrs);
// Change the heap size to reduce CAS size. The size here depends on what we intend to put into the CAS.
// If its just a pointer to data (like question id), the size of the heap can be reduced even more.