}
try {
// Launch one instance of fenced CasProcessor per pipeline -Adam
serviceUrls = controller.deploy(name, aCasProcessorList.size());
ServiceProxyPool casProcessorPool = new ServiceProxyPool();
// Deploy one Cas Processor at a time in sequential order
for (int i = 0; i < aCasProcessorList.size(); i++) {
cProcessor = (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 = cProcessor.getProcessingResourceMetaData();
CpeCasProcessor casProcessorType = (CpeCasProcessor) cpeFactory.casProcessorConfigMap
.get(metaData.getName());
// Create a pool to hold instances of CasProcessors. Instances are managed by a container
// through
// getCasProcessor() and releaseProcessor() methods.
// Create CasProcess Configuration holding info defined in the CPE descriptor
casProcessorConfig = new CasProcessorConfigurationJAXBImpl(casProcessorType, cpeFactory.getResourceManager());
// Associate CasProcessor configuration from CPE descriptor with this container
processingContainer = new ProcessingContainer_Impl(casProcessorConfig, metaData,
casProcessorPool);
processingContainer.setCasProcessorDeployer(this);
processingContainer.setSingleFencedService(true);
// Instantiate an object that encapsulates CasProcessor configuration
// Determine deployment model for this CasProcessor
// 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_unable_to_read_meta__SEVERE", Thread.currentThread().getName());
}
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_casprocessor_no_name_found__SEVERE", new Object[] { Thread
.currentThread().getName() });
}
}
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
"initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_deploying_service__FINEST",
new Object[] { Thread.currentThread().getName(), name });
}
// Launch one instance of the fenced CasProcessor
// URL[] urls = controller.deploy(name, 1); //Commented out by Adam -- deployment is now
// done outside of loop
if (cProcessor instanceof CasObjectNetworkCasProcessorImpl) {
((CasObjectNetworkCasProcessorImpl) cProcessor).connect(serviceUrls[i]);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
"initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_service_deployed__FINEST",
new Object[] { Thread.currentThread().getName(), name });
}
}
// Add CasProcess to the instance pool
casProcessorPool.addCasProcessor(cProcessor);
}
// There is one instance of ProcessingContainer for set of CasProcessors
if (processingContainer == null) {
throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,