// Add Configuration Parameter Overrides for CPE
UimaCollectionReader ucr = (UimaCollectionReader)list.get(0);
if (ucr.getConfigParamsModel() != null) {
List cpeOverrideList = ucr.getConfigParamsModel().getCpeParamModelList();
if (cpeOverrideList != null && cpeOverrideList.size() > 0) {
CasProcessorConfigurationParameterSettings settings =
CpeDescriptorFactory.produceCasProcessorConfigurationParameterSettings();
cr.setConfigurationParameterSettings(settings);
for (int k=0; k<cpeOverrideList.size(); ++k) {
ConfigParameterModel m = (ConfigParameterModel) cpeOverrideList.get(k);
if (m.getCpeValue() != null) {
settings.setParameterValue (m.getName(), m.getCpeValue());
}
}
}
}
}
// Add CAS Initializer
list = getUimaCasInitializers();
if (list != null && list.size() > 0) {
String aCasInitializerPath = "";
CpeCollectionReaderCasInitializer ci = null;
aCasInitializerPath = ((UimaCasInitializer)list.get(0)).getXmlDescriptor();
if (resolve) {
ci = cpeDesc.addCasInitializer(resolveUimaXmlDescriptor(aCasInitializerPath));
} else {
ci = cpeDesc.addCasInitializer(aCasInitializerPath);
}
// Trace.err("Add Cas Init: " + aCasInitializerPath);
// Add Configuration Parameter Overrides for CPE
UimaCasInitializer uci = (UimaCasInitializer)list.get(0);
if (uci.getConfigParamsModel() != null) {
List cpeOverrideList = uci.getConfigParamsModel().getCpeParamModelList();
if (cpeOverrideList != null && cpeOverrideList.size() > 0) {
CasProcessorConfigurationParameterSettings settings =
CpeDescriptorFactory.produceCasProcessorConfigurationParameterSettings();
ci.setConfigurationParameterSettings(settings);
for (int k=0; k<cpeOverrideList.size(); ++k) {
ConfigParameterModel m = (ConfigParameterModel) cpeOverrideList.get(k);
if (m.getCpeValue() != null) {
settings.setParameterValue (m.getName(), m.getCpeValue());
}
}
}
}
}
// Add Cas Processors (AE, Cas Consumer)
list = getUimaCasProcessors();
for (int i=0; i<list.size(); ++i) {
UimaCasProcessor u = (UimaCasProcessor) list.get(i);
CpeCasProcessor casProc;
// if (u.getCasProcessorCategory() == UimaCasProcessor.CASPROCESSOR_CAT_SERVICE) {
// casProc = CpeDescriptorFactory.produceRemoteCasProcessor(u.getInstanceName());
// } else {
// casProc = CpeDescriptorFactory.produceCasProcessor(u.getInstanceName());
// }
casProc = CpeDescriptorFactory.produceCasProcessor(u.getInstanceName());
if (resolve) {
casProc.setDescriptor(resolveUimaXmlDescriptor(u.getXmlDescriptor()));
} else {
casProc.setDescriptor(u.getXmlDescriptor());
}
// Add Error Handlings
if (u.getCasProcessorErrorHandling() != null) {
setCasProcessorErrorHandling(casProc, u.getCasProcessorErrorHandling());
} else {
// Set values from default, if any
// setCasProcessorErrorHandling(casProc, getDefaultCasProcessorSettings().getErrorHandling());
}
// Set <checkpoint batch="10000"/>
if (u.getBatchSize() != -1) {
casProc.setBatchSize(u.getBatchSize());
} else {
// Check if default value is defined
if (getDefaultCasProcessorSettings().getCasProcBatchSize() != -1) {
casProc.setBatchSize(getDefaultCasProcessorSettings().getCasProcBatchSize());
}
}
// Add Configuration Parameter Overrides for CPE
List cpeOverrideList = u.getConfigParamsModel().getCpeParamModelList();
if (cpeOverrideList != null && cpeOverrideList.size() > 0) {
CasProcessorConfigurationParameterSettings settings =
CpeDescriptorFactory.produceCasProcessorConfigurationParameterSettings();
casProc.setConfigurationParameterSettings(settings);
for (int k=0; k<cpeOverrideList.size(); ++k) {
ConfigParameterModel m = (ConfigParameterModel) cpeOverrideList.get(k);
if (m.getCpeValue() != null) {
settings.setParameterValue (m.getName(), m.getCpeValue());
}
}
}
// // Add Error Handlings