Package org.apache.uima.uimacpp
Class UimacppAnalysisComponent
- java.lang.Object
-
- org.apache.uima.analysis_component.AnalysisComponent_ImplBase
-
- org.apache.uima.uimacpp.UimacppAnalysisComponent
-
- All Implemented Interfaces:
AnalysisComponent
public class UimacppAnalysisComponent extends AnalysisComponent_ImplBase
-
-
Field Summary
Fields Modifier and Type Field Description private AnalysisEngineImplBaseaeprivate static java.lang.Class<UimacppAnalysisComponent>CLASS_NAMEcurrent classprivate UimacppEngineengineprivate Loggerlogprivate static java.lang.StringLOG_RESOURCE_BUNDLEresource bundle for log messagesprivate ResourceCreationSpecifierresourceDescriptionprivate static intTAF_LOGLEVEL_ERRORprivate static intTAF_LOGLEVEL_MESSAGEprivate static intTAF_LOGLEVEL_OFFprivate static intTAF_LOGLEVEL_WARNINGprivate booleantsReinitprivate UimaContextuimaContext
-
Constructor Summary
Constructors Constructor Description UimacppAnalysisComponent(ResourceCreationSpecifier aeDescription, AnalysisEngineImplBase ae)
-
Method Summary
All Methods Static 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 voidfinalize()intgetCasInstancesRequired()Returns the maximum number of CAS instances that this AnalysisComponent expects to use at the same time.protected CASgetEmptyCAS()static intgetLoggingLevel()Get the logging level of the logger for TAFAnnotator.java.lang.Class<CAS>getRequiredCasInterface()Returns the specific CAS interface that this AnalysisComponent requires the framework to pass to itsAnalysisComponent.process(AbstractCas)method.booleanhasNext()Asks if this AnalysisComponent has another CAS to output.voidinitialize(UimaContext context)Performs any startup tasks required by this component.static voidlog(int msglevel, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String message)private voidlogJTafException(UimacppException e)AbstractCasnext()Gets the next output CAS.voidprocess(AbstractCas aCAS)Inputs a CAS to the AnalysisComponent.voidprocess(CAS aCAS)voidprocess(CAS cas, ResultSpecification aResultSpec)voidreconfigure()Notifies this AnalysisComponent that its configuration parameters have changed.voidtypeSystemInit(TypeSystem ts)-
Methods inherited from class org.apache.uima.analysis_component.AnalysisComponent_ImplBase
getContext, getLogger, getResultSpecification, setResultSpecification
-
-
-
-
Field Detail
-
engine
private UimacppEngine engine
-
ae
private AnalysisEngineImplBase ae
-
resourceDescription
private ResourceCreationSpecifier resourceDescription
-
log
private Logger log
-
tsReinit
private boolean tsReinit
-
uimaContext
private UimaContext uimaContext
-
LOG_RESOURCE_BUNDLE
private static final java.lang.String LOG_RESOURCE_BUNDLE
resource bundle for log messages- See Also:
- Constant Field Values
-
CLASS_NAME
private static final java.lang.Class<UimacppAnalysisComponent> CLASS_NAME
current class
-
TAF_LOGLEVEL_OFF
private static final int TAF_LOGLEVEL_OFF
- See Also:
- Constant Field Values
-
TAF_LOGLEVEL_MESSAGE
private static final int TAF_LOGLEVEL_MESSAGE
- See Also:
- Constant Field Values
-
TAF_LOGLEVEL_WARNING
private static final int TAF_LOGLEVEL_WARNING
- See Also:
- Constant Field Values
-
TAF_LOGLEVEL_ERROR
private static final int TAF_LOGLEVEL_ERROR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UimacppAnalysisComponent
public UimacppAnalysisComponent(ResourceCreationSpecifier aeDescription, AnalysisEngineImplBase ae)
-
-
Method Detail
-
initialize
public void initialize(UimaContext context) 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- Overrides:
initializein classAnalysisComponent_ImplBase- Parameters:
context- the UIMA Context- Throws:
ResourceInitializationException- wraps exceptions thrown from called routines- See Also:
AnalysisComponent.initialize(org.apache.uima.UimaContext)
-
typeSystemInit
public void typeSystemInit(TypeSystem ts) throws AnnotatorConfigurationException, AnnotatorInitializationException
- Parameters:
ts- TypeSystem to use in the initialization- Throws:
AnnotatorConfigurationException- pass thruAnnotatorInitializationException- pass thru- See Also:
CasAnnotator_ImplBase.typeSystemInit(TypeSystem)
-
reconfigure
public void reconfigure()
Description copied from class:AnalysisComponent_ImplBaseNotifies this AnalysisComponent that its configuration parameters have changed. This implementation just callsAnalysisComponent_ImplBase.destroy()followed byAnalysisComponent_ImplBase.initialize(UimaContext). Subclasses can override to provide more efficient reconfiguration logic if necessary.- Specified by:
reconfigurein interfaceAnalysisComponent- Overrides:
reconfigurein classAnalysisComponent_ImplBase- See Also:
AnalysisComponent.reconfigure()
-
process
public void process(CAS cas, ResultSpecification aResultSpec) throws AnnotatorProcessException
- Parameters:
cas- the CAS to processaResultSpec- the Result Specification to use- Throws:
AnnotatorProcessException- wraps exceptions thrown from called methods- See Also:
GenericAnnotator.process(CAS, ResultSpecification)
-
process
public void process(CAS aCAS) throws AnalysisEngineProcessException
- Throws:
AnalysisEngineProcessException
-
process
public void process(AbstractCas aCAS) throws AnalysisEngineProcessException
Description copied from interface:AnalysisComponentInputs a CAS to the AnalysisComponent. The AnalysisComponent "owns" this CAS until such time asAnalysisComponent.hasNext()is called and returns false or untilprocessis called again (see class description).- Parameters:
aCAS- A CAS that this AnalysisComponent should process. The framework will ensure that aCAS implements the specific CAS interface specified by theAnalysisComponent.getRequiredCasInterface()method.- Throws:
AnalysisEngineProcessException- if a problem occurs during processing
-
hasNext
public boolean hasNext() throws AnalysisEngineProcessExceptionDescription copied from interface:AnalysisComponentAsks if this AnalysisComponent has another CAS to output. If this method returns true, then a call toAnalysisComponent.next()should retrieve the next output CAS. When this method returns false, the AnalysisComponent gives up control of the initial CAS that was passed to itsAnalysisComponent.process(AbstractCas)method.- Returns:
- true if this AnalysisComponent has another CAS to output, false if not.
- Throws:
AnalysisEngineProcessException- if a problem occurs during processing
-
next
public AbstractCas next() throws AnalysisEngineProcessException
Description copied from interface:AnalysisComponentGets the next output CAS. The framework will only call this method after first callingAnalysisComponent.hasNext()and checking that it returns true.The AnalysisComponent can obtain a new CAS by calling
UimaContext.getEmptyCas(Class)(or instead, one of the helper methods in the ImplBase class that it extended).- Returns:
- the next output CAS.
- Throws:
AnalysisEngineProcessException- if a problem occurs during processing
-
getRequiredCasInterface
public java.lang.Class<CAS> getRequiredCasInterface()
Description copied from interface:AnalysisComponentReturns the specific CAS interface that this AnalysisComponent requires the framework to pass to itsAnalysisComponent.process(AbstractCas)method.- Returns:
- the required CAS interface. This must specify a subtype of
AbstractCas.
-
getCasInstancesRequired
public int getCasInstancesRequired()
Description copied from interface:AnalysisComponentReturns the maximum number of CAS instances that this AnalysisComponent expects to use at the same time. This only applies to CasMultipliers. Most CasMultipliers will only need one CAS at a time. Only if there is a clear need should this be overridden to return something greater than 1.- Returns:
- the number of CAS instances required by this AnalysisComponent.
-
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- Overrides:
batchProcessCompletein classAnalysisComponent_ImplBase- 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- Overrides:
collectionProcessCompletein classAnalysisComponent_ImplBase- 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- Overrides:
destroyin classAnalysisComponent_ImplBase- See Also:
BaseAnnotator.destroy()
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
getLoggingLevel
public static int getLoggingLevel()
Get the logging level of the logger for TAFAnnotator. TAF only supports three levels of logging. All logging levels INFO and below are mapped to the TAF message level.- Returns:
- the logging level
-
log
public static void log(int msglevel, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String message)
-
logJTafException
private void logJTafException(UimacppException e)
-
getEmptyCAS
protected CAS getEmptyCAS()
-
-