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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnalysisEngines
(Collection<String> aKeys) Does nothing by default.void
Completes the processing of a batch of CASes.void
Notifies this component that processing of an entire collection has been completed.void
destroy()
Frees all resources held by this FlowController.protected FlowControllerContext
Gets the FlowControllerContext for this FlowController.protected Logger
Gets the logger for this FlowControllervoid
initialize
(FlowControllerContext aContext) Performs any startup tasks required by this component.void
Alerts this FlowController that the values of its configuration parameters or external resources have changed.void
removeAnalysisEngines
(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, wait
Methods inherited from interface org.apache.uima.flow.FlowController
computeFlow, getRequiredCasInterface
-
Constructor Details
-
FlowController_ImplBase
public FlowController_ImplBase()
-
-
Method Details
-
initialize
Description copied from interface:FlowController
Performs 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
FlowControllerContext
that 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:
initialize
in 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:FlowController
Alerts this FlowController that the values of its configuration parameters or external resources have changed. This FlowController should re-read its configuration from theUimaContext
and take appropriate action to reconfigure itself.In the abstract base classes provided by the framework, this is generally implemented by calling
destroy
followed byinitialize
. If a more efficient implementation is needed, you can override that implementation.- Specified by:
reconfigure
in 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:FlowController
Completes 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 ofbatchProcessComplete
is 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:
batchProcessComplete
in interfaceFlowController
- Throws:
AnalysisEngineProcessException
- if this component encounters a problem in flushing its state to persistent storage
-
collectionProcessComplete
Description copied from interface:FlowController
Notifies 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:
collectionProcessComplete
in interfaceFlowController
- Throws:
AnalysisEngineProcessException
- if this component encounters a problem in its end-of-collection processing
-
destroy
public void destroy()Description copied from interface:FlowController
Frees all resources held by this FlowController. The framework calls this method only once, when it is finished using this component.- Specified by:
destroy
in interfaceFlowController
-
addAnalysisEngines
Does nothing by default. Subclasses may override this to support adding new AnalysisEngines to the flow.- Specified by:
addAnalysisEngines
in 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:
removeAnalysisEngines
in 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
-