Class FlowController_ImplBase
- All Implemented Interfaces:
FlowController
- Direct Known Subclasses:
CasFlowController_ImplBase,JCasFlowController_ImplBase
JCasFlowController_ImplBase or CasFlowController_ImplBase,
depending on which CAS interface you would like to use.
This class implements the initialize(FlowControllerContext) method and stores the
FlowControllerContext in a private field where it can be accessed via the
getContext() method.
This class also provides a "dumb" implementation of the reconfigure() method, which
simply calls destroy() followed by initialize(FlowControllerContext).
Developers of FlowControllers with expensive initialization logic should override this method and
provide a more intelligent implementation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnalysisEngines(Collection<String> aKeys) Does nothing by default.voidCompletes the processing of a batch of CASes.voidNotifies this component that processing of an entire collection has been completed.voiddestroy()Frees all resources held by this FlowController.protected FlowControllerContextGets the FlowControllerContext for this FlowController.protected LoggerGets the logger for this FlowControllervoidinitialize(FlowControllerContext aContext) Performs any startup tasks required by this component.voidAlerts this FlowController that the values of its configuration parameters or external resources have changed.voidremoveAnalysisEngines(Collection<String> aKeys) Throws an AnalysisEngineProcessException by default.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.uima.flow.FlowController
computeFlow, getRequiredCasInterface
-
Constructor Details
-
FlowController_ImplBase
public FlowController_ImplBase()
-
-
Method Details
-
initialize
Description copied from interface:FlowControllerPerforms any startup tasks required by this component. The framework calls this method only once, just after the FlowController has been instantiated.The framework supplies this FlowController with a reference to the
FlowControllerContextthat it will use, for example to access configuration settings or resources. This FlowController should store a reference to this Context for later use.- Specified by:
initializein interfaceFlowController- Parameters:
aContext- Provides access to services and resources managed by the framework. This includes configuration parameters, logging, and access to external resources. Also provides the FlowController with the metadata of all of the AnalysisEngines that are possible targets for routing CASes.- Throws:
ResourceInitializationException- if the FlowController cannot initialize successfully.
-
reconfigure
Description copied from interface:FlowControllerAlerts this FlowController that the values of its configuration parameters or external resources have changed. This FlowController should re-read its configuration from theUimaContextand take appropriate action to reconfigure itself.In the abstract base classes provided by the framework, this is generally implemented by calling
destroyfollowed byinitialize. If a more efficient implementation is needed, you can override that implementation.- Specified by:
reconfigurein interfaceFlowController- Throws:
ResourceInitializationException- if this component encounters a problem in reinitializing itself from the new configurationResourceConfigurationException- if the new configuration is invalid
-
batchProcessComplete
Description copied from interface:FlowControllerCompletes the processing of a batch of CASes. The size of a batch is determined based on configuration provided by the application that is using this component. The purpose ofbatchProcessCompleteis to give this component the change to flush information from memory to persistent storage. In the event of an error, this allows the processing to be restarted from the end of the last completed batch.If this component's descriptor declares that it is
recoverable, then this component is required to be restartable from the end of the last completed batch.- Specified by:
batchProcessCompletein interfaceFlowController- Throws:
AnalysisEngineProcessException- if this component encounters a problem in flushing its state to persistent storage
-
collectionProcessComplete
Description copied from interface:FlowControllerNotifies this component that processing of an entire collection has been completed. In this method, this component should finish writing any output relating to the current collection.- Specified by:
collectionProcessCompletein interfaceFlowController- Throws:
AnalysisEngineProcessException- if this component encounters a problem in its end-of-collection processing
-
destroy
public void destroy()Description copied from interface:FlowControllerFrees all resources held by this FlowController. The framework calls this method only once, when it is finished using this component.- Specified by:
destroyin interfaceFlowController
-
addAnalysisEngines
Does nothing by default. Subclasses may override this to support adding new AnalysisEngines to the flow.- Specified by:
addAnalysisEnginesin interfaceFlowController- Parameters:
aKeys- a Collection of Strings, each of which is the key of an Analysis Engine to which CASes can be routed. These are the same keys as used inFlowControllerContext.getAnalysisEngineMetaDataMap().- See Also:
-
removeAnalysisEngines
Throws an AnalysisEngineProcessException by default. Subclasses may override this to support removing AnalysisEngines from the flow.- Specified by:
removeAnalysisEnginesin interfaceFlowController- Parameters:
aKeys- a Collection of Strings, each of which is the key of an Analysis Engine to which CASes may no longer be routed.- Throws:
AnalysisEngineProcessException- if the FlowController cannot continue with these Analysis Engines removed, or doesn't support removing Analysis Engines at all.- See Also:
-
getContext
Gets the FlowControllerContext for this FlowController. This provides access to configuration parameters, resources, and also to metadata for each AnalysisEngine that is available for this FlowController to route CASes to.- Returns:
- the FlowControllerContext for this FlowController
-
getLogger
Gets the logger for this FlowController- Returns:
- the logger for this FlowController
-