org.apache.uima.flow
Interface Flow

All Known Implementing Classes:
CasFlow_ImplBase, JCasFlow_ImplBase

public interface Flow

A Flow object is responsible for routing a single CAS through an Aggregate Analysis Engine.

Typically, developers extend CasFlow_ImplBase or JCasFlow_ImplBase depending on which CAS interface they wish to use.


Method Summary
 void aborted()
          Called by the framework if processing has been aborted for the CAS that was being routed by this Flow object.
 boolean continueOnFailure(String failedAeKey, Exception failure)
          May be called by the framework to ask the FlowController if processing of the CAS can continue after a failure occurred while executing the last Step that the Flow Controller returned.
 Flow newCasProduced(AbstractCas newCas, String producedBy)
          Called by the framework if the CAS that is being routed by this Flow has been sent to a CAS Multiplier which has then created a new CAS derived from that original CAS.
 Step next()
          Gets the next destination for the CAS.
 

Method Detail

next

Step next()
          throws AnalysisEngineProcessException
Gets the next destination for the CAS. This is defined by a Step object. There may be different kinds of Step objects to indicate different kinds of routing actions.

Returns:
the next destination for the CAS
Throws:
AnalysisEngineProcessException - if a failure occurs while determining the next destination

newCasProduced

Flow newCasProduced(AbstractCas newCas,
                    String producedBy)
                    throws AnalysisEngineProcessException
Called by the framework if the CAS that is being routed by this Flow has been sent to a CAS Multiplier which has then created a new CAS derived from that original CAS.

It is not required for a Flow implementation to support the production of new CASes in the middle of the flow, in which case this method may throw an exception.

If implemented, this method should construct a new Flow object that will be used to route the new CAS. The new Flow object then takes over all responsibility for that CAS.

Parameters:
newCas - the new CAS
producedBy - key of the AnalysisEngine (CAS Multiplier) that produced the new CAS
Returns:
a new Flow object that has responsibility for routing aCAS through the Aggregate Analysis Engine.
Throws:
AnalysisEngineProcessException

continueOnFailure

boolean continueOnFailure(String failedAeKey,
                          Exception failure)
May be called by the framework to ask the FlowController if processing of the CAS can continue after a failure occurred while executing the last Step that the Flow Controller returned.

If this method returns true, then the framework may continue to call the next() method to continue routing the CAS. If this method returns false, the framework will not make any more calls to the next() method, and will call the aborted() method.

In the case where the last Step was a ParallelStep, if at least one of the destinations resulted in a failure, this method will be called to report one of the failures. If this method returns true, but one of the other destinations in the ParallelStep resulted in a failure, this method will be called again to report the next failure. This continues until either this method returns false or there are no more failures.

Note that it is possible for processing of a CAS to be aborted without this method being called. This method is only called when an attempt is being made to continue processing of the CAS following an error, which may be an application configuration decision.

Parameters:
failedAeKey - The key of the analysis engine that failed.
failure - the Exception that occurred
Returns:
true if the FlowController decides that processing of the CAS can continue; false if processing of the CAS should be aborted.

aborted

void aborted()
Called by the framework if processing has been aborted for the CAS that was being routed by this Flow object. No further processing will take place on the CAS after this method is called, so the framework will not call the next() method again.

This method provides the Flow object with an opportunity to clean up any resources. Also, it could be used to allow the FlowController to reuse a Flow object if desired.



Copyright © 2010 The Apache Software Foundation. All Rights Reserved.