public abstract class AnalysisEngineImplBase extends ConfigurableResource_ImplBase implements TextAnalysisEngine
| Modifier and Type | Field and Description |
|---|---|
protected static String |
LOG_RESOURCE_BUNDLE
resource bundle for log messages
|
static String |
PARAM_VERIFICATION_MODE
Key that must be inserted into the aAdditionalParams map to turn on verification mode.
|
MDC_ANNOTATOR_CONTEXT_NAME, MDC_ANNOTATOR_IMPL_NAME, MDC_CAS_ID, MDC_ROOT_CONTEXT_ID, PARAM_CONFIG_PARAM_SETTINGS, PARAM_MBEAN_NAME_PREFIX, PARAM_MBEAN_SERVER, PARAM_NUM_SIMULTANEOUS_REQUESTS, PARAM_RESOURCE_MANAGER, PARAM_THROTTLE_EXCESSIVE_ANNOTATOR_LOGGING, PARAM_TIMEOUT_PERIODPARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_MANAGER, PARAM_EXTERNAL_OVERRIDE_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_UIMA_CONTEXT| Constructor and Description |
|---|
AnalysisEngineImplBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
batchProcessComplete()
Notifies this AnalysisEngine that processing of a batch has completed.
|
void |
batchProcessComplete(ProcessTrace aTrace)
Completes the processing of a batch.
|
protected ProcessTrace |
buildProcessTraceFromMBeanStats() |
protected void |
buildProcessTraceFromMBeanStats(ProcessTrace trace)
Modify an existing ProcessTrace object by adding events that represent the last excecution of
this AnalysisEngine.
|
protected void |
callInitializeMethod(AnalysisComponent component,
UimaContext context) |
protected void |
callProcessMethod(AnalysisComponent component,
AbstractCas cas) |
void |
collectionProcessComplete()
Notifies this AnalysisEngine that processing of an entire collection has completed.
|
void |
collectionProcessComplete(ProcessTrace aTrace)
Completes the processing of an entire collection.
|
ResultSpecification |
createResultSpecification()
A factory method used to create an instance of
ResultSpecification for use with this
AnalysisEngine. |
ResultSpecification |
createResultSpecification(TypeSystem aTypeSystem)
A factory method used to create an instance of
ResultSpecification for use with this
AnalysisEngine. |
protected void |
enterBatchProcessComplete() |
protected void |
enterCollectionProcessComplete() |
protected void |
enterProcess() |
protected void |
exitBatchProcessComplete() |
protected void |
exitCollectionProcessComplete() |
protected void |
exitProcess() |
protected void |
finalize() |
AnalysisEngineMetaData |
getAnalysisEngineMetaData()
Gets the metadata that describes this
AnalysisEngine. |
protected ConfigurationParameterSettings |
getCurrentConfigParameterSettings()
Kludge - make this public (but not part of AnalysisEngine interface) so that TAFAnnotator can
access it.
|
String[] |
getFeatureNamesForType(String aTypeName)
Gets the names of the features that are defined on one of the CAS types that this AE inputs or
outputs.
|
AnalysisEngineManagement |
getManagementInterface()
Gets an object that can be used to do monitoring or management of this AnalysisEngine.
|
protected AnalysisEngineManagementImpl |
getMBean() |
protected String |
getMBeanNamePrefix() |
protected Object |
getMBeanServer() |
Properties |
getPerformanceTuningSettings()
Gets the performance tuning settings in effect for this Analysis Engine.
|
ProcessingResourceMetaData |
getProcessingResourceMetaData()
Gets the metadata that describes this
CasProcesor. |
boolean |
initialize(ResourceSpecifier aSpecifier,
Map<String,Object> aAdditionalParams)
Initializes this
Resource from a ResourceSpecifier. |
protected boolean |
isProcessTraceEnabled()
Gets whether the Process Trace (which collects performance stats for this AnalysisEngine) is
enabled.
|
boolean |
isReadOnly()
Gets whether this is a read-only CAS Processor, which does not modify the CAS.
|
boolean |
isStateless()
Gets whether this is a stateless CAS Processor.
|
CAS |
newCAS()
Creates a new Common Analysis System appropriate for this Analysis Engine.
|
JCas |
newJCas()
Similar to
AnalysisEngine.newCAS() but wraps the new CAS objects with the Java-object-based
JCas interface. |
protected void |
normalizeIsoLangCodes(ProcessingResourceMetaData md) |
void |
process(AnalysisProcessData aProcessData,
ResultSpecification aResultSpec)
Deprecated.
|
ProcessTrace |
process(CAS aCAS)
Invokes this AnalysisEngine's analysis logic.
|
ProcessTrace |
process(CAS aCAS,
ResultSpecification aResultSpec)
Invokes this AnalysisEngine's analysis logic.
|
void |
process(CAS aCAS,
ResultSpecification aResultSpec,
ProcessTrace aTrace)
Invokes this AnalysisEngine's analysis logic.
|
ProcessTrace |
process(JCas aJCas)
Similar to
AnalysisEngine.process(CAS) but uses the Java-object-based JCas interface instead
of the general CAS interface. |
ProcessTrace |
process(JCas aJCas,
ResultSpecification aResultSpec)
Similar to
AnalysisEngine.process(CAS,ResultSpecification) but uses the Java-object-based
JCas interface instead of the general CAS interface. |
void |
process(JCas aJCas,
ResultSpecification aResultSpec,
ProcessTrace aTrace)
Similar to
AnalysisEngine.process(CAS, ResultSpecification, ProcessTrace) but uses the
Java-object-based JCas interface instead of the general CAS interface. |
CasIterator |
processAndOutputNewCASes(CAS aCAS)
Processes a CAS, possibly producing multiple CASes as a result.
|
JCasIterator |
processAndOutputNewCASes(JCas aJCas)
Default implementation of processAndOutputNewCASes(JCas) method.
|
void |
processCas(CAS aCAS)
Process a single CAS.
|
void |
processCas(CAS[] aCASes)
Processes multiple CASes.
|
void |
resetResultSpecificationToDefault() |
protected void |
setMetaData(ResourceMetaData aMetaData)
Sets the
ResourceMetaData object associated with this Resource. |
protected void |
setPerformanceTuningSettings(Properties aSettings)
Sets the performance tuning settings in effect for this Analysis Engine.
|
void |
setResultSpecification(ResultSpecification aResultSpec)
Sets the list of output types and features that the application wants this AnalysisEngine to
produce.
|
void |
typeSystemInit(TypeSystem aTypeSystem)
From the CAS Processor interface.
|
getConfigParameterValue, getConfigParameterValue, reconfigure, setConfigParameterValue, setConfigParameterValuedestroy, getCasManager, getLogger, getMetaData, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, loadUserClass, loadUserClassOrThrow, setContextHolder, setContextHolderX, setLogger, withContextHolderclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLogger, getResourceManager, reconfigure, setLoggergetConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValuedestroy, getMetaData, getUimaContext, getUimaContextAdminprotected static final String LOG_RESOURCE_BUNDLE
public static final String PARAM_VERIFICATION_MODE
protected void setMetaData(ResourceMetaData aMetaData)
Resource_ImplBaseResourceMetaData object associated with this Resource.
Any previously existing metadata will be replaced.
Resource subclasses should call this method during initialization in order to set the metadata
before any calls to Resource_ImplBase.getMetaData() are made.
setMetaData in class Resource_ImplBaseaMetaData - metadata to assign to this Resourcepublic void batchProcessComplete()
throws AnalysisEngineProcessException
AnalysisEnginebatchProcessComplete in interface AnalysisEngineAnalysisEngineProcessException - if an exception occurs during processingpublic void collectionProcessComplete()
throws AnalysisEngineProcessException
AnalysisEngine
If this AnalysisEngine is an aggregate, this method will call the collectionProcessComplete method of
all components of that aggregate. If the aggregate descriptor declares a fixedFlow or
capabilityLanguageFlow, then the components' collectionProcessComplete methods will be called
in the order specified by that flow element. Once all components in the flow have been called, any components
not declared in the flow will be called, in arbitrary order. If there is no fixedFlow or
capabilityLanguageFlow, then all components in the aggregate will be called in arbitrary order.
collectionProcessComplete in interface AnalysisEngineAnalysisEngineProcessException - if an exception occurs during processingpublic CasIterator processAndOutputNewCASes(CAS aCAS) throws AnalysisEngineProcessException
AnalysisEngineCasIterator interface to step through the output CASes.
If this Analysis Engine does not produce output CASes, then the CasIterator will
return no elements. You can check if an AnalysisEngine is capable of producing output CASes by
checking the
OperationalProperties.getOutputsNewCASes()
operational property (getAnalysisEngineMetaData().getOperationalProperties().getOutputsNewCASes()).
Once this method is called, the AnalysisEngine "owns" aCAS until such time as
the CasIterator.hasNext() method returns false. That is, the caller should not attempt
to modify or access the input CAS until it has read all of the elements from the CasIterator.
If the caller wants to abort the processing before having read all of the output CASes, it may
call CasIterator.release(), which will stop further processing from occurring, and
ownership of aCAS will revert to the caller.
processAndOutputNewCASes in interface AnalysisEngineaCAS - the CAS to be processedAnalysisEngineProcessException - if a failure occurs during processingpublic boolean initialize(ResourceSpecifier aSpecifier, Map<String,Object> aAdditionalParams) throws ResourceInitializationException
ResourceResource from a ResourceSpecifier. Applications
do not need to call this method. It is called automatically by the ResourceFactory
and cannot be called a second time.initialize in interface AnalysisEngineinitialize in interface Resourceinitialize in class Resource_ImplBaseaSpecifier - specifies how to create a resource or locate an existing resource service.aAdditionalParams - a Map containing additional parameters. May be null if there are no
parameters. Each class that implements this interface can decide what additional
parameters it supports.ResourceSpecifier is not of an appropriate type for this Resource. If
the ResourceSpecifier is of an appropriate type but is invalid or if
some other failure occurs, an exception should be thrown.ResourceInitializationException - if a failure occurs during initialization.multi-thread safe, given that each instance of this class is only called on one thread, once.
The critical parts that update shared information (in shared uima context) are inside a synchronize blockprotected void finalize()
throws Throwable
public AnalysisEngineMetaData getAnalysisEngineMetaData()
AnalysisEngineAnalysisEngine. This is just a
convenience method that calls Resource.getMetaData() and casts the result to a
AnalysisEngineMetaData.getAnalysisEngineMetaData in interface AnalysisEngineAnalysisEngine.getAnalysisEngineMetaData()public ProcessingResourceMetaData getProcessingResourceMetaData()
CasProcessorCasProcesor.getProcessingResourceMetaData in interface CasProcessorCasProcessor.getProcessingResourceMetaData()public CAS newCAS() throws ResourceInitializationException
AnalysisEngineAnalysisEngine.process(CAS) method. Then, when the process
method returns, the CAS will contain the results of the analysis.
Important: CAS creation is expensive, so if at all possible an application should reuse
CASes. When a CAS instance is no longer being used, call its CAS.reset() method, which
will remove all prior analysis information, and then reuse that same CAS instance for another
call to AnalysisEngine.process(CAS).
Note that the CAS allows multiple subjects of analysis (e.g. documents) and defines a separate
"view" for each of them. If your application wants to work with a single subject of analysis,
call the method CAS.getCurrentView() and operate on the returned view.
newCAS in interface AnalysisEngineCAS appropriate for this AnalysisEngine.ResourceInitializationException - if a CAS could not be created because this AnalysisEngine's CAS metadata (type
system, type priorities, or FS indexes) are invalid. Ideally this would be checked at
AnalysisEngine initialization time, and it will likely be moved in the future.AnalysisEngine.newCAS()public JCas newJCas() throws ResourceInitializationException
AnalysisEngineAnalysisEngine.newCAS() but wraps the new CAS objects with the Java-object-based
JCas interface.
Note: the JCas that is returned is equivalent to what you would get if you called
newCAS().getCurrentView().getJCas(). That is, this method returns a view of the
default Sofa, NOT a Base CAS.
Important: CAS creation is expensive, so if at all possible an application should reuse
CASes. When a JCas instance is no longer being used, call its JCas.reset() method,
which will remove all prior analysis information, and then reuse that same JCas instance for
another call to AnalysisEngine.process(JCas).
newJCas in interface AnalysisEngineCAS appropriate for this AnalysisEngine.ResourceInitializationException - if a CAS could not be created because this AnalysisEngine's CAS metadata (type
system, type priorities, or FS indexes) are invalid. Ideally this would be checked at
AnalysisEngine initialization time, and it will likely be moved in the future.AnalysisEngine.newJCas()public ProcessTrace process(CAS aCAS, ResultSpecification aResultSpec) throws ResultNotSupportedException, AnalysisEngineProcessException
AnalysisEngineCapability specification.)
This version of the process method takes a ResultSpecification as an
argument. The ResultSpecification is alist of output types and features that the
application wants this AnalysisEngine to produce. If you are going to use the same
ResultSpecification for multiple calls to process, it is not
recommended to use this method. Instead call
AnalysisEngine.setResultSpecification(ResultSpecification) once and then call AnalysisEngine.process(CAS)
for each CAS that you want to process.
process in interface AnalysisEngineaCAS - the CAS containing the inputs to the processing. Analysis results will also be written
to this CAS.aResultSpec - a list of outputs that this AnalysisEngine should produce.ResultNotSupportedException - if this AnalysisEngine is not capable of producing the results requested in
aResultSpec.AnalysisEngineProcessException - if a failure occurs during processing.AnalysisEngine.process(org.apache.uima.cas.CAS,
org.apache.uima.analysis_engine.ResultSpecification)public void process(CAS aCAS, ResultSpecification aResultSpec, ProcessTrace aTrace) throws ResultNotSupportedException, AnalysisEngineProcessException
AnalysisEngineCapability specification.)
This version of the process method takes a ResultSpecification as an
argument. The ResultSpecification is a list of output types and features that the
application wants this AnalysisEngine to produce. If you are going to use the same
ResultSpecification for multiple calls to process, it is not
recommended to use this method. Instead call
AnalysisEngine.setResultSpecification(ResultSpecification) once and then call AnalysisEngine.process(CAS)
for each CAS that you want to process.
This version of this method also takes a ProcessTrace object as a parameter.
This allows trace events to be written to an existing ProcessTrace rather than a
new one.
process in interface AnalysisEngineaCAS - the CAS containing the inputs to the processing. Analysis results will also be written
to this CAS.aResultSpec - a list of outputs that this AnalysisEngine should produce.aTrace - the object to which trace events will be recordedResultNotSupportedException - if this AnalysisEngine is not capable of producing the results requested in
aResultSpec.AnalysisEngineProcessException - if a failure occurs during processing.AnalysisEngine.process(org.apache.uima.cas.CAS,
org.apache.uima.analysis_engine.ResultSpecification, org.apache.uima.util.ProcessTrace)public ProcessTrace process(CAS aCAS) throws AnalysisEngineProcessException
AnalysisEngineCapability specification.)
This version of process does not take a ResultSpecification parameter.
You may specify a ResultSpecification by calling
AnalysisEngine.setResultSpecification(ResultSpecification) prior to calling this method.
process in interface AnalysisEngineaCAS - the CAS containing the inputs to the processing. Analysis results will also be written
to this CAS.AnalysisEngineProcessException - if a failure occurs during processing.public ProcessTrace process(JCas aJCas) throws AnalysisEngineProcessException
AnalysisEngineAnalysisEngine.process(CAS) but uses the Java-object-based JCas interface instead
of the general CAS interface.process in interface AnalysisEngineaJCas - the JCas containing the inputs to the processing. Analysis results will also be
written to this JCas.AnalysisEngineProcessException - if a failure occurs during processing.AnalysisEngine.process(org.apache.uima.jcas.JCas)public ProcessTrace process(JCas aJCas, ResultSpecification aResultSpec) throws ResultNotSupportedException, AnalysisEngineProcessException
AnalysisEngineAnalysisEngine.process(CAS,ResultSpecification) but uses the Java-object-based
JCas interface instead of the general CAS interface.
This version of the process method takes a ResultSpecification as an
argument. The ResultSpecification is a list of output types and features that the
application wants this AnalysisEngine to produce. If you are going to use the same
ResultSpecification for multiple calls to process, it is not
recommended to use this method. Instead call
AnalysisEngine.setResultSpecification(ResultSpecification) once and then call AnalysisEngine.process(JCas)
for each CAS that you want to process.
process in interface AnalysisEngineaJCas - the JCas containing the inputs to the processing. Analysis results will also be
written to this JCas.aResultSpec - a list of outputs that this AnalysisEngine should produce.ResultNotSupportedException - if this AnalysisEngine is not capable of producing the results requested in
aResultSpec.AnalysisEngineProcessException - if a failure occurs during processing.AnalysisEngine.process(org.apache.uima.jcas.JCas,
org.apache.uima.analysis_engine.ResultSpecification)public void process(JCas aJCas, ResultSpecification aResultSpec, ProcessTrace aTrace) throws ResultNotSupportedException, AnalysisEngineProcessException
AnalysisEngineAnalysisEngine.process(CAS, ResultSpecification, ProcessTrace) but uses the
Java-object-based JCas interface instead of the general CAS interface.
This version of the process method takes a ResultSpecification as an
argument. The ResultSpecification is a list of output types and features that the
application wants this AnalysisEngine to produce. If you are going to use the same
ResultSpecification for multiple calls to process, it is not
recommended to use this method. Instead call
AnalysisEngine.setResultSpecification(ResultSpecification) once and then call AnalysisEngine.process(JCas)
for each CAS that you want to process.
This version of this method also takes a ProcessTrace object as a parameter.
This allows trace events to be written to an existing ProcessTrace rather than a
new one.
process in interface AnalysisEngineaJCas - the JCas containing the inputs to the processing. Analysis results will also be
written to this JCas.aResultSpec - a list of outputs that this AnalysisEngine should produce.aTrace - the object to which trace events will be recordedResultNotSupportedException - if this AnalysisEngine is not capable of producing the results requested in
aResultSpec.AnalysisEngineProcessException - if a failure occurs during processing.AnalysisEngine.process(org.apache.uima.jcas.JCas,
org.apache.uima.analysis_engine.ResultSpecification, org.apache.uima.util.ProcessTrace)@Deprecated public void process(AnalysisProcessData aProcessData, ResultSpecification aResultSpec) throws ResultNotSupportedException, AnalysisEngineProcessException
AnalysisEngineCapability specification.)
This version of this method is not normally used directly by applications. It is used to call
Analysis Engines that are components within an aggregate Analysis Engine, so that they can
share all information in the AnalysisProcessData object, which includes the CAS and the
ProcessTrace.
process in interface AnalysisEngineaProcessData - the data that will be modified during processing. This includes the CAS and the
ProcessTrace.aResultSpec - a list of outputs that this AnalysisEngine should produce. A null
result specification is equivalent to a request for all possible results.ResultNotSupportedException - if this AnalysisEngine is not capable of producing the results requested in
aResultSpec.AnalysisEngineProcessException - if a failure occurs during processing.public void processCas(CAS aCAS) throws ResourceProcessException
CasObjectProcessorprocessCas in interface CasObjectProcessoraCAS - the CAS to be processed. Additional information may be added to this CAS (if this CAS
processor is not read-only).ResourceProcessException - if processing failspublic void processCas(CAS[] aCASes) throws ResourceProcessException
CasObjectProcessorprocessCas in interface CasObjectProcessoraCASes - an array of CASes to be processed. Additional information may be added to these CASes
(if this CAS processor is not read-only).ResourceProcessException - if processing fails for any of the CASesCasObjectProcessor.processCas(org.apache.uima.cas.CAS[])public JCasIterator processAndOutputNewCASes(JCas aJCas) throws AnalysisEngineProcessException
processAndOutputNewCASes in interface AnalysisEngineaJCas - the JCAS to be processedAnalysisEngineProcessException - if a failure occurs during processingpublic ResultSpecification createResultSpecification()
AnalysisEngineA factory method used to create an instance of ResultSpecification for use with this
AnalysisEngine. Applications use this method to construct ResultSpecifications
to pass to this AnalysisEngine's AnalysisEngine.setResultSpecification(ResultSpecification) method.
See also AnalysisEngine.createResultSpecification(TypeSystem) which should be used if the
type system associated with this result specification is known at this point in time.
createResultSpecification in interface AnalysisEngineResultSpecificationAnalysisEngine.createResultSpecification()public ResultSpecification createResultSpecification(TypeSystem aTypeSystem)
AnalysisEngineResultSpecification for use with this
AnalysisEngine. Applications use this method to construct ResultSpecifications
to pass to this AnalysisEngine's AnalysisEngine.setResultSpecification(ResultSpecification) method.createResultSpecification in interface AnalysisEngineaTypeSystem - the type systemResultSpecificationAnalysisEngine.createResultSpecification(TypeSystem)public String[] getFeatureNamesForType(String aTypeName)
AnalysisEngineallAnnotatorFeatures == true,
this method can be used to determine all of the feature names.getFeatureNamesForType in interface AnalysisEngineaTypeName - type for which to get featuresaTypeName is not defined,
null will be returned.AnalysisEngine.getFeatureNamesForType(java.lang.String)public boolean isStateless()
CasProcessorisStateless in interface CasProcessorpublic boolean isReadOnly()
CasProcessorisReadOnly in interface CasProcessorpublic void typeSystemInit(TypeSystem aTypeSystem) throws ResourceInitializationException
typeSystemInit in interface CasObjectProcessoraTypeSystem - the type system to useResourceInitializationException - if the type system is not compatible with this Cas ConsumerCasObjectProcessor.typeSystemInit(org.apache.uima.cas.TypeSystem)public Properties getPerformanceTuningSettings()
getPerformanceTuningSettings in interface AnalysisEnginepublic void setResultSpecification(ResultSpecification aResultSpec)
AnalysisEnginesetResultSpecification in interface AnalysisEngineaResultSpec - specifies the list of output types and features that the application is interested in.public void resetResultSpecificationToDefault()
public AnalysisEngineManagement getManagementInterface()
AnalysisEnginegetManagementInterface in interface AnalysisEnginepublic void batchProcessComplete(ProcessTrace aTrace) throws ResourceProcessException, IOException
CasProcessorbatchProcessComplete in interface CasProcessoraTrace - an object that records information, such as timing, about this method's execution.ResourceProcessException - if an exception occurs during processingIOException - if an I/O failure occurspublic void collectionProcessComplete(ProcessTrace aTrace) throws ResourceProcessException, IOException
CasProcessorcollectionProcessComplete in interface CasProcessoraTrace - an object that records information, such as timing, about this method's execution.ResourceProcessException - if an exception occurs during processingIOException - if an I/O failure occursprotected void setPerformanceTuningSettings(Properties aSettings)
aSettings - performance tuning settingsprotected void normalizeIsoLangCodes(ProcessingResourceMetaData md)
protected ConfigurationParameterSettings getCurrentConfigParameterSettings()
ConfigurationManager.getCurrentConfigParameterSettings(String)protected AnalysisEngineManagementImpl getMBean()
protected void enterProcess()
protected void exitProcess()
protected void enterBatchProcessComplete()
protected void exitBatchProcessComplete()
protected void enterCollectionProcessComplete()
protected void exitCollectionProcessComplete()
protected ProcessTrace buildProcessTraceFromMBeanStats()
protected void buildProcessTraceFromMBeanStats(ProcessTrace trace)
trace - -protected boolean isProcessTraceEnabled()
protected Object getMBeanServer()
protected String getMBeanNamePrefix()
protected void callInitializeMethod(AnalysisComponent component, UimaContext context) throws ResourceInitializationException
ResourceInitializationExceptionprotected void callProcessMethod(AnalysisComponent component, AbstractCas cas) throws Exception
ExceptionCopyright © 2006–2021 The Apache Software Foundation. All rights reserved.