public ProcessingContainer deployCasProcessor(List aCasProcessorList, boolean redeploy)
throws ResourceConfigurationException {
String name = null;
CasProcessor casProcessor = null;
CasProcessorConfiguration casProcessorConfig = null;
ProcessingContainer processingContainer = null;
String deployModel = null;
try {
for (int i = 0; i < aCasProcessorList.size(); i++) {
casProcessor = (CasProcessor) aCasProcessorList.get(i);
// Container may have already been instantiated. This will be the case if the CPM is
// configured for concurrent
// processing ( more than one processing pipeline). There is only one container per
// CasProcessor type.
// So each instance of the same CasProcessor will be associated with a single container.
// Inside the
// container instances are pooled. When deploying the very first CasProcessor of each type,
// the
// container will be created and initialized. Any subsequent deployments of this
// CasProcessor will
// simply use it, and will be added to this container's instance pool.
if (processingContainer == null) {
ProcessingResourceMetaData metaData = casProcessor.getProcessingResourceMetaData();
CpeCasProcessor cpeCasProcessor = (CpeCasProcessor) cpeFactory.casProcessorConfigMap
.get(metaData.getName());
if (engine != null) {
boolean parallelizable = engine.isParallizable(casProcessor, metaData.getName());
cpeCasProcessor.setIsParallelizable(parallelizable);
}
casProcessorPool = new ServiceProxyPool();
// Instantiate an object that encapsulates CasProcessor configuration
casProcessorConfig = new CasProcessorConfigurationJAXBImpl(cpeCasProcessor);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(
Level.FINEST,
this.getClass().getName(),
"initialize",
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_cp_checkpoint__FINEST",
new Object[] { Thread.currentThread().getName(),
String.valueOf(casProcessorConfig.getBatchSize()) });// Checkpoint().getBatch())});
}
// Associate CasProcessor configuration from CPE descriptor with this container
processingContainer = new ProcessingContainer_Impl(casProcessorConfig, metaData,
casProcessorPool);
// Determine deployment model for this CasProcessor
deployModel = casProcessorConfig.getDeploymentType();
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
"initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_cp_deployment__FINEST",
new Object[] { Thread.currentThread().getName(), deployModel });
}
// Each CasProcessor must have a name
name = casProcessorConfig.getName();
if (name == null) {
if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE,
this.getClass().getName(), "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_cp_no_name__SEVERE",
new Object[] { Thread.currentThread().getName() });
}
throw new ResourceConfigurationException(
InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING, new Object[] { "name",
"casProcessor" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING",
new Object[] { Thread.currentThread().getName(), "n/a", "name",
"casProcessor" })));
}
} else {
// Assumption is that the container already exists and it contains CasProcessor
// configuration
casProcessorConfig = processingContainer.getCasProcessorConfiguration();
if (casProcessorConfig == null) {
throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND,
new Object[] { "<casProcessor>", "<casProcessors>" }, new Exception(
CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,