Class AnalysisComponent_ImplBase
- All Implemented Interfaces:
AnalysisComponent
- Direct Known Subclasses:
Annotator_ImplBase
,CasMultiplier_ImplBase
,JCasMultiplier_ImplBase
,UimacppAnalysisComponent
This class implements the initialize(UimaContext)
method and stores the
UimaContext
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(UimaContext)
. Developers of
AnalysisComponents with expensive initialization logic should override this method and provide a
more intelligent implementation.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Completes the processing of a batch of CASes.void
Notifies this AnalysisComponent that processing of an entire collection has been completed.void
destroy()
Frees all resources held by this AnalysisComponent.protected final UimaContext
Gets the UimaContext for this AnalysisComponent.protected Logger
protected ResultSpecification
Gets the ResultSpecification for this AnalysisComponent.void
initialize
(UimaContext aContext) Performs any startup tasks required by this component.void
Notifies this AnalysisComponent that its configuration parameters have changed.void
setResultSpecification
(ResultSpecification aResultSpec) Sets the Result Specification for this Analysis Component.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.analysis_component.AnalysisComponent
getCasInstancesRequired, getRequiredCasInterface, hasNext, next, process
-
Constructor Details
-
AnalysisComponent_ImplBase
public AnalysisComponent_ImplBase()
-
-
Method Details
-
initialize
Description copied from interface:AnalysisComponent
Performs any startup tasks required by this component. The framework calls this method only once, just after the AnalysisComponent has been instantiated.The framework supplies this AnalysisComponent with a reference to the
UimaContext
that it will use, for example to access configuration settings or resources. This AnalysisComponent should store a reference to its theUimaContext
for later use.- Specified by:
initialize
in interfaceAnalysisComponent
- Parameters:
aContext
- Provides access to services and resources managed by the framework. This includes configuration parameters, logging, and access to external resources.- Throws:
ResourceInitializationException
- if this AnalysisComponent cannot initialize successfully.
-
reconfigure
Notifies this AnalysisComponent that its configuration parameters have changed. This implementation just callsdestroy()
followed byinitialize(UimaContext)
. Subclasses can override to provide more efficient reconfiguration logic if necessary.- Specified by:
reconfigure
in interfaceAnalysisComponent
- Throws:
ResourceConfigurationException
- if the configuration specified for this component is invalid.ResourceInitializationException
- if this component fails to reinitialize itself based on the new configuration.- See Also:
-
batchProcessComplete
Description copied from interface:AnalysisComponent
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 AnalysisComponent 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 interfaceAnalysisComponent
- Throws:
AnalysisEngineProcessException
- if this component encounters a problem in flushing its state to persistent storage
-
collectionProcessComplete
Description copied from interface:AnalysisComponent
Notifies this AnalysisComponent 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 interfaceAnalysisComponent
- Throws:
AnalysisEngineProcessException
- if this component encounters a problem in its end-of-collection processing
-
destroy
public void destroy()Description copied from interface:AnalysisComponent
Frees all resources held by this AnalysisComponent. The framework calls this method only once, when it is finished using this component.- Specified by:
destroy
in interfaceAnalysisComponent
-
setResultSpecification
Sets the Result Specification for this Analysis Component. This implementation just saves the Result Specification to a field, where it can later be accessed by callinggetResultSpecification()
. An AnalysisComponent implementation may override this method if it would like to do specific processing when its ResultSpecificatin is changed.- Specified by:
setResultSpecification
in interfaceAnalysisComponent
- Parameters:
aResultSpec
- the ResultSpecification for this Analysis Component to use.- See Also:
-
getContext
Gets the UimaContext for this AnalysisComponent. This provides access to configuration parameters and external resources.- Returns:
- the UimaContext for this AnalysisComponent
-
getLogger
- Returns:
- the Logger associated with this uima Analysis Engine component
-
getResultSpecification
Gets the ResultSpecification for this AnalysisComponent. The ResultSpecification is a set of types and features that this AnalysisComponent is asked to produce. An Analysis Component may (but is not required to) optimize its processing by omitting the generation of any types or features that are not part of the ResultSpecification.- Returns:
- the ResultSpecification for this Analysis Component to use.
-