Class AnalysisComponent_ImplBase
- java.lang.Object
-
- org.apache.uima.analysis_component.AnalysisComponent_ImplBase
-
- All Implemented Interfaces:
AnalysisComponent
- Direct Known Subclasses:
Annotator_ImplBase,CasMultiplier_ImplBase,JCasMultiplier_ImplBase,UimacppAnalysisComponent
public abstract class AnalysisComponent_ImplBase extends java.lang.Object implements AnalysisComponent
Implementation base class for AnalysisComponents. Normally developers do not extend this class directly. Instead extend one of the Annotator or CasMultiplier base classes.This class implements the
initialize(UimaContext)method and stores theUimaContextin a private field where it can be accessed via thegetContext()method.This class also provides a "dumb" implementation of the
reconfigure()method, which simply callsdestroy()followed byinitialize(UimaContext). Developers of AnalysisComponents with expensive initialization logic should override this method and provide a more intelligent implementation.
-
-
Field Summary
Fields Modifier and Type Field Description private UimaContextmContextprivate ResultSpecificationmResultSpecification
-
Constructor Summary
Constructors Constructor Description AnalysisComponent_ImplBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbatchProcessComplete()Completes the processing of a batch of CASes.voidcollectionProcessComplete()Notifies this AnalysisComponent that processing of an entire collection has been completed.voiddestroy()Frees all resources held by this AnalysisComponent.protected UimaContextgetContext()Gets the UimaContext for this AnalysisComponent.protected LoggergetLogger()protected ResultSpecificationgetResultSpecification()Gets the ResultSpecification for this AnalysisComponent.voidinitialize(UimaContext aContext)Performs any startup tasks required by this component.voidreconfigure()Notifies this AnalysisComponent that its configuration parameters have changed.voidsetResultSpecification(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
-
-
-
-
Field Detail
-
mContext
private UimaContext mContext
-
mResultSpecification
private ResultSpecification mResultSpecification
-
-
Method Detail
-
initialize
public void initialize(UimaContext aContext) throws ResourceInitializationException
Description copied from interface:AnalysisComponentPerforms 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
UimaContextthat it will use, for example to access configuration settings or resources. This AnalysisComponent should store a reference to its theUimaContextfor later use.- Specified by:
initializein 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
public void reconfigure() throws ResourceConfigurationException, ResourceInitializationExceptionNotifies 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:
reconfigurein 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:
AnalysisComponent.reconfigure()
-
batchProcessComplete
public void batchProcessComplete() throws AnalysisEngineProcessExceptionDescription copied from interface:AnalysisComponentCompletes 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 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:
batchProcessCompletein interfaceAnalysisComponent- Throws:
AnalysisEngineProcessException- if this component encounters a problem in flushing its state to persistent storage
-
collectionProcessComplete
public void collectionProcessComplete() throws AnalysisEngineProcessExceptionDescription copied from interface:AnalysisComponentNotifies 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:
collectionProcessCompletein interfaceAnalysisComponent- Throws:
AnalysisEngineProcessException- if this component encounters a problem in its end-of-collection processing
-
destroy
public void destroy()
Description copied from interface:AnalysisComponentFrees all resources held by this AnalysisComponent. The framework calls this method only once, when it is finished using this component.- Specified by:
destroyin interfaceAnalysisComponent
-
setResultSpecification
public void setResultSpecification(ResultSpecification aResultSpec)
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:
setResultSpecificationin interfaceAnalysisComponent- Parameters:
aResultSpec- the ResultSpecification for this Analysis Component to use.- See Also:
AnalysisComponent.setResultSpecification(ResultSpecification)
-
getContext
protected final UimaContext getContext()
Gets the UimaContext for this AnalysisComponent. This provides access to configuration parameters and external resources.- Returns:
- the UimaContext for this AnalysisComponent
-
getLogger
protected Logger getLogger()
- Returns:
- the Logger associated with this uima Analysis Engine component
-
getResultSpecification
protected ResultSpecification 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.
-
-