public abstract class FlowController_ImplBase extends Object implements FlowController
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 and Description |
---|
FlowController_ImplBase() |
Modifier and Type | Method and Description |
---|---|
void |
addAnalysisEngines(Collection<String> aKeys)
Does nothing by default.
|
void |
batchProcessComplete()
Completes the processing of a batch of CASes.
|
void |
collectionProcessComplete()
Notifies this component that processing of an entire collection has been completed.
|
void |
destroy()
Frees all resources held by this FlowController.
|
protected FlowControllerContext |
getContext()
Gets the FlowControllerContext for this FlowController.
|
void |
initialize(FlowControllerContext aContext)
Performs any startup tasks required by this component.
|
void |
reconfigure()
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
computeFlow, getRequiredCasInterface
public void initialize(FlowControllerContext aContext) throws ResourceInitializationException
FlowController
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.
initialize
in interface FlowController
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.ResourceInitializationException
- if the FlowController cannot initialize successfully.public void reconfigure() throws ResourceInitializationException, ResourceConfigurationException
FlowController
UimaContext
and take appropriate action to reconfigure itself.
In the abstract base classes provided by the framework, this is generally implemented by
calling destroy
followed by initialize
. If a more efficient
implementation is needed, you can override that implementation.
reconfigure
in interface FlowController
ResourceInitializationException
- if this component encounters a problem in reinitializing itself from the new
configurationResourceConfigurationException
- if the new configuration is invalidpublic void batchProcessComplete() throws AnalysisEngineProcessException
FlowController
batchProcessComplete
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.
batchProcessComplete
in interface FlowController
AnalysisEngineProcessException
- if this component encounters a problem in flushing its state to persistent storagepublic void collectionProcessComplete() throws AnalysisEngineProcessException
FlowController
collectionProcessComplete
in interface FlowController
AnalysisEngineProcessException
- if this component encounters a problem in its end-of-collection processingpublic void destroy()
FlowController
destroy
in interface FlowController
public void addAnalysisEngines(Collection<String> aKeys)
addAnalysisEngines
in interface FlowController
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 in
FlowControllerContext.getAnalysisEngineMetaDataMap()
.FlowController.addAnalysisEngines(java.util.Collection)
public void removeAnalysisEngines(Collection<String> aKeys) throws AnalysisEngineProcessException
removeAnalysisEngines
in interface FlowController
aKeys
- a Collection of Strings, each of which is the key of an Analysis Engine to which CASes
may no longer be routed.AnalysisEngineProcessException
- if the FlowController cannot continue with these
Analysis Engines removed, or doesn't support removing Analysis Engines at all.FlowController.removeAnalysisEngines(java.util.Collection)
protected FlowControllerContext getContext()
Copyright © 2006–2017 The Apache Software Foundation. All rights reserved.