in uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java [820:942]
public void process(CAS aCAS, String anInputCasReferenceId, String aNewCasReferenceId,
String newCASProducedBy) // throws AnalysisEngineProcessException, AsynchAEException
{
FlowContainer flow = null;
try {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(), "process",
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_lookup_flow__FINE",
new Object[] { getComponentName(), anInputCasReferenceId });
}
try {
// Lookup a Flow object associated with an input CAS.
if (flowMap.containsKey(anInputCasReferenceId)) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
"process", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_retrieve_flow_object__FINEST",
new Object[] { getComponentName(), anInputCasReferenceId });
}
// Retrieve an input CAS Flow object from the flow cache. This Flow object will be used
// to compute
// subordinate Flow for the new CAS.
flow = (FlowContainer) flowMap.get(anInputCasReferenceId);
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
"process", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_retrieved_flow_object_ok__FINEST",
new Object[] { getComponentName(), anInputCasReferenceId });
}
}
if (flow != null) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(
Level.FINE,
CLASS_NAME.getName(),
"process",
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_lookup_flow_ok__FINE",
new Object[] { getComponentName(), aNewCasReferenceId, newCASProducedBy,
anInputCasReferenceId, });
}
// Compute subordinate Flow from the Flow associated with the
// input CAS.
synchronized (flowControllerContainer) {
flow = flow.newCasProduced(aCAS, newCASProducedBy);
}
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(
Level.FINE,
CLASS_NAME.getName(),
"process",
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_new_flow_ok__FINE",
new Object[] { getComponentName(), aNewCasReferenceId, newCASProducedBy,
anInputCasReferenceId, });
}
// Check if the local cache already contains an entry for the Cas id.
// A colocated Cas Multiplier may have already registered this CAS
// in the parent's controller
if (localCache.lookupEntry(aNewCasReferenceId) == null) {
// Add this Cas Id to the local cache. Every input CAS goes through here
CasStateEntry casStateEntry = localCache.createCasStateEntry(aNewCasReferenceId);
casStateEntry.setInputCasReferenceId(anInputCasReferenceId);
}
// Save the subordinate Flow Object in a cache. Flow exists in the
// cache until the CAS is fully processed or it is
// explicitly deleted when processing of this CAS cannot continue
flowMap.put(aNewCasReferenceId, flow);
// Register the fact that this is a new CAS and the fact that is was produced
// by this aggregate. It is important to register this to determine how to
// handle the CAS in delegate Aggregate services. When the CAS is processed
// in the Delegate Aggregate, the CAS produced in the parent Aggregate cannot
// be dropped in the delegate. Check Final Step logic.
getInProcessCache().getCacheEntryForCAS(aNewCasReferenceId).setNewCas(true,
getComponentName());
getLocalCache().lookupEntry(anInputCasReferenceId).decrementOutstandingFlowCounter();
} else {
throw new AsynchAEException(
"Flow Object Not In Flow Cache. Expected Flow Object in FlowCache for Cas Reference Id:"
+ anInputCasReferenceId);
}
} catch (Throwable t) {
// Any error here is automatic termination
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"process", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_service_exception_WARNING", getComponentName());
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(), "process",
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING",
t);
}
sendReplyWithShutdownException(anInputCasReferenceId);
handleAction(ErrorHandler.TERMINATE, null, null);
return;
}
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(
Level.FINEST,
CLASS_NAME.getName(),
"process",
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_executing_step__FINEST",
new Object[] { getComponentName(), aNewCasReferenceId, newCASProducedBy,
anInputCasReferenceId, });
}
// Continue with Steps. The CAS has been produced by the CAS Multiplier
executeFlowStep(flow, aNewCasReferenceId, true);
} catch (Exception e) {
HashMap map = new HashMap();
map.put(AsynchAEMessage.Command, AsynchAEMessage.Process);
handleError(map, e);
}
}