Class AnalysisEngineImplBase
- java.lang.Object
-
- org.apache.uima.resource.Resource_ImplBase
-
- org.apache.uima.resource.ConfigurableResource_ImplBase
-
- org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase
-
- All Implemented Interfaces:
AnalysisEngine,TextAnalysisEngine,CasObjectProcessor,CasProcessor,ConfigurableResource,Resource
- Direct Known Subclasses:
AggregateAnalysisEngine_impl,AnalysisEngineProcessorAdapter,AnalysisEngineServiceAdapter,MultiprocessingAnalysisEngine_impl,PearAnalysisEngineWrapper,PrimitiveAnalysisEngine_impl,UimacppAnalysisEngineImpl
public abstract class AnalysisEngineImplBase extends ConfigurableResource_ImplBase implements TextAnalysisEngine
Provides functionality common to Analysis Engine implementations.
-
-
Field Summary
Fields Modifier and Type Field Description private static booleanisMDCprotected static java.lang.StringLOG_RESOURCE_BUNDLEresource bundle for log messagesprivate java.lang.StringmMBeanNamePrefixAn optional name prefix for this AnalysisEngine's MBean.private java.lang.ObjectmMBeanServerThe JMX MBeanServer that this AnalysisEngine registers with to publish its statistics.private java.util.PropertiesmPerformanceTuningSettingsPerformance Tuning setting in effect for this Analysis Engine.private UimaTimermProcessTimerprivate booleanmProcessTraceEnabledstatic java.lang.StringPARAM_VERIFICATION_MODEKey that must be inserted into the aAdditionalParams map to turn on verification mode.-
Fields inherited from interface org.apache.uima.analysis_engine.AnalysisEngine
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_PERIOD
-
Fields inherited from interface org.apache.uima.resource.Resource
PARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_MANAGER, PARAM_CONFIG_PARAM_SETTINGS, PARAM_EXTERNAL_OVERRIDE_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT
-
-
Constructor Summary
Constructors Constructor Description AnalysisEngineImplBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbatchProcessComplete()Notifies this AnalysisEngine that processing of a batch has completed.voidbatchProcessComplete(ProcessTrace aTrace)Completes the processing of a batch.protected ProcessTracebuildProcessTraceFromMBeanStats()protected voidbuildProcessTraceFromMBeanStats(ProcessTrace trace)Modify an existing ProcessTrace object by adding events that represent the last excecution of this AnalysisEngine.protected voidcallInitializeMethod(AnalysisComponent component, UimaContext context)protected voidcallProcessMethod(AnalysisComponent component, AbstractCas cas)voidcollectionProcessComplete()Notifies this AnalysisEngine that processing of an entire collection has completed.voidcollectionProcessComplete(ProcessTrace aTrace)Completes the processing of an entire collection.ResultSpecificationcreateResultSpecification()A factory method used to create an instance ofResultSpecificationfor use with this AnalysisEngine.ResultSpecificationcreateResultSpecification(TypeSystem aTypeSystem)A factory method used to create an instance ofResultSpecificationfor use with this AnalysisEngine.protected voidenterBatchProcessComplete()protected voidenterCollectionProcessComplete()protected voidenterProcess()protected voidexitBatchProcessComplete()protected voidexitCollectionProcessComplete()protected voidexitProcess()protected voidfinalize()AnalysisEngineMetaDatagetAnalysisEngineMetaData()Gets the metadata that describes thisAnalysisEngine.protected ConfigurationParameterSettingsgetCurrentConfigParameterSettings()Kludge - make this public (but not part of AnalysisEngine interface) so that TAFAnnotator can access it.java.lang.String[]getFeatureNamesForType(java.lang.String aTypeName)Gets the names of the features that are defined on one of the CAS types that this AE inputs or outputs.AnalysisEngineManagementgetManagementInterface()Gets an object that can be used to do monitoring or management of this AnalysisEngine.protected AnalysisEngineManagementImplgetMBean()protected java.lang.StringgetMBeanNamePrefix()protected java.lang.ObjectgetMBeanServer()java.util.PropertiesgetPerformanceTuningSettings()Gets the performance tuning settings in effect for this Analysis Engine.ProcessingResourceMetaDatagetProcessingResourceMetaData()Gets the metadata that describes thisCasProcesor.booleaninitialize(ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams)Initializes thisResourcefrom aResourceSpecifier.protected booleanisProcessTraceEnabled()Gets whether the Process Trace (which collects performance stats for this AnalysisEngine) is enabled.booleanisReadOnly()Gets whether this is a read-only CAS Processor, which does not modify the CAS.booleanisStateless()Gets whether this is a stateless CAS Processor.CASnewCAS()Creates a new Common Analysis System appropriate for this Analysis Engine.JCasnewJCas()Similar toAnalysisEngine.newCAS()but wraps the new CAS objects with the Java-object-basedJCasinterface.protected voidnormalizeIsoLangCodes(ProcessingResourceMetaData md)private voidpopMDCstring(java.lang.String key, java.lang.String prev)voidprocess(AnalysisProcessData aProcessData, ResultSpecification aResultSpec)Deprecated.ProcessTraceprocess(CAS aCAS)Invokes this AnalysisEngine's analysis logic.ProcessTraceprocess(CAS aCAS, ResultSpecification aResultSpec)Invokes this AnalysisEngine's analysis logic.voidprocess(CAS aCAS, ResultSpecification aResultSpec, ProcessTrace aTrace)Invokes this AnalysisEngine's analysis logic.ProcessTraceprocess(JCas aJCas)Similar toAnalysisEngine.process(CAS)but uses the Java-object-basedJCasinterface instead of the generalCASinterface.ProcessTraceprocess(JCas aJCas, ResultSpecification aResultSpec)Similar toAnalysisEngine.process(CAS,ResultSpecification)but uses the Java-object-basedJCasinterface instead of the generalCASinterface.voidprocess(JCas aJCas, ResultSpecification aResultSpec, ProcessTrace aTrace)Similar toAnalysisEngine.process(CAS, ResultSpecification, ProcessTrace)but uses the Java-object-basedJCasinterface instead of the generalCASinterface.CasIteratorprocessAndOutputNewCASes(CAS aCAS)Processes a CAS, possibly producing multiple CASes as a result.JCasIteratorprocessAndOutputNewCASes(JCas aJCas)Default implementation of processAndOutputNewCASes(JCas) method.voidprocessCas(CAS aCAS)Process a single CAS.voidprocessCas(CAS[] aCASes)Processes multiple CASes.private java.lang.StringpushMDCstring(java.lang.String key, java.lang.String value)voidresetResultSpecificationToDefault()protected voidsetMetaData(ResourceMetaData aMetaData)Sets theResourceMetaDataobject associated with thisResource.protected voidsetPerformanceTuningSettings(java.util.Properties aSettings)Sets the performance tuning settings in effect for this Analysis Engine.voidsetResultSpecification(ResultSpecification aResultSpec)Sets the list of output types and features that the application wants this AnalysisEngine to produce.voidtypeSystemInit(TypeSystem aTypeSystem)From the CAS Processor interface.private voidwithContexts(AnalysisComponent component, UimaContext context, AbstractCas cas, Runnable_withException r)-
Methods inherited from class org.apache.uima.resource.ConfigurableResource_ImplBase
getConfigParameterValue, getConfigParameterValue, reconfigure, setConfigParameterValue, setConfigParameterValue
-
Methods inherited from class org.apache.uima.resource.Resource_ImplBase
destroy, getCasManager, getLogger, getMetaData, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, loadUserClass, loadUserClassOrThrow, setContextHolder, setContextHolderX, setLogger, withContextHolder
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.uima.analysis_engine.AnalysisEngine
getLogger, getResourceManager, reconfigure, setLogger
-
Methods inherited from interface org.apache.uima.resource.ConfigurableResource
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
-
Methods inherited from interface org.apache.uima.resource.Resource
destroy, getMetaData, getUimaContext, getUimaContextAdmin
-
-
-
-
Field Detail
-
LOG_RESOURCE_BUNDLE
protected static final java.lang.String LOG_RESOURCE_BUNDLE
resource bundle for log messages- See Also:
- Constant Field Values
-
PARAM_VERIFICATION_MODE
public static final java.lang.String PARAM_VERIFICATION_MODE
Key that must be inserted into the aAdditionalParams map to turn on verification mode. Also passed down to delegates.- See Also:
- Constant Field Values
-
mPerformanceTuningSettings
private java.util.Properties mPerformanceTuningSettings
Performance Tuning setting in effect for this Analysis Engine.
-
mProcessTimer
private UimaTimer mProcessTimer
-
mProcessTraceEnabled
private boolean mProcessTraceEnabled
-
mMBeanServer
private java.lang.Object mMBeanServer
The JMX MBeanServer that this AnalysisEngine registers with to publish its statistics.
-
mMBeanNamePrefix
private java.lang.String mMBeanNamePrefix
An optional name prefix for this AnalysisEngine's MBean.
-
isMDC
private static final boolean isMDC
-
-
Method Detail
-
setMetaData
protected void setMetaData(ResourceMetaData aMetaData)
Description copied from class:Resource_ImplBaseSets theResourceMetaDataobject associated with thisResource. 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.- Overrides:
setMetaDatain classResource_ImplBase- Parameters:
aMetaData- metadata to assign to thisResource
-
batchProcessComplete
public void batchProcessComplete() throws AnalysisEngineProcessExceptionDescription copied from interface:AnalysisEngineNotifies this AnalysisEngine that processing of a batch has completed. It is up to the caller to determine the size of a batch. Components (particularly CAS Consumers) inside this Analysis Engine may respond to this event, for example by writing data to the disk.- Specified by:
batchProcessCompletein interfaceAnalysisEngine- Throws:
AnalysisEngineProcessException- if an exception occurs during processing
-
collectionProcessComplete
public void collectionProcessComplete() throws AnalysisEngineProcessExceptionDescription copied from interface:AnalysisEngineNotifies this AnalysisEngine that processing of an entire collection has completed. It is up to the caller to determine when this has occurred. Components (particularly CAS Consumers) inside this Analysis Engine may respond to this event, for example by writing data to the disk.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
fixedFloworcapabilityLanguageFlow, 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 nofixedFloworcapabilityLanguageFlow, then all components in the aggregate will be called in arbitrary order.- Specified by:
collectionProcessCompletein interfaceAnalysisEngine- Throws:
AnalysisEngineProcessException- if an exception occurs during processing
-
processAndOutputNewCASes
public CasIterator processAndOutputNewCASes(CAS aCAS) throws AnalysisEngineProcessException
Description copied from interface:AnalysisEngineProcesses a CAS, possibly producing multiple CASes as a result. The application uses theCasIteratorinterface to step through the output CASes.If this Analysis Engine does not produce output CASes, then the
CasIteratorwill return no elements. You can check if an AnalysisEngine is capable of producing output CASes by checking theOperationalProperties.getOutputsNewCASes()operational property (getAnalysisEngineMetaData().getOperationalProperties().getOutputsNewCASes()).Once this method is called, the AnalysisEngine "owns"
aCASuntil such time as theCasIterator.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 callCasIterator.release(), which will stop further processing from occurring, and ownership ofaCASwill revert to the caller.- Specified by:
processAndOutputNewCASesin interfaceAnalysisEngine- Parameters:
aCAS- the CAS to be processed- Returns:
- an object for iterating through any output CASes
- Throws:
AnalysisEngineProcessException- if a failure occurs during processing
-
initialize
public boolean initialize(ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams) throws ResourceInitializationException
Description copied from interface:ResourceInitializes thisResourcefrom aResourceSpecifier. Applications do not need to call this method. It is called automatically by theResourceFactoryand cannot be called a second time.- Specified by:
initializein interfaceAnalysisEngine- Specified by:
initializein interfaceResource- Overrides:
initializein classResource_ImplBase- Parameters:
aSpecifier- specifies how to create a resource or locate an existing resource service.aAdditionalParams- a Map containing additional parameters. May benullif there are no parameters. Each class that implements this interface can decide what additional parameters it supports.- Returns:
- true if and only if initialization completed successfully. Returns false if the given
ResourceSpecifieris not of an appropriate type for this Resource. If theResourceSpecifieris of an appropriate type but is invalid or if some other failure occurs, an exception should be thrown. - Throws:
ResourceInitializationException- if a failure occurs during initialization.- See Also:
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 block
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
getAnalysisEngineMetaData
public AnalysisEngineMetaData getAnalysisEngineMetaData()
Description copied from interface:AnalysisEngineGets the metadata that describes thisAnalysisEngine. This is just a convenience method that callsResource.getMetaData()and casts the result to aAnalysisEngineMetaData.- Specified by:
getAnalysisEngineMetaDatain interfaceAnalysisEngine- Returns:
- an object containing all metadata for this AnalysisEngine
- See Also:
AnalysisEngine.getAnalysisEngineMetaData()
-
getProcessingResourceMetaData
public ProcessingResourceMetaData getProcessingResourceMetaData()
Description copied from interface:CasProcessorGets the metadata that describes thisCasProcesor.- Specified by:
getProcessingResourceMetaDatain interfaceCasProcessor- Returns:
- an object containing all metadata for this CasProcessor
- See Also:
CasProcessor.getProcessingResourceMetaData()
-
newCAS
public CAS newCAS() throws ResourceInitializationException
Description copied from interface:AnalysisEngineCreates a new Common Analysis System appropriate for this Analysis Engine. An application can pre-populate this CAS, then pass it to theAnalysisEngine.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 toAnalysisEngine.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.- Specified by:
newCASin interfaceAnalysisEngine- Returns:
- a new
CASappropriate for this AnalysisEngine. - Throws:
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.- See Also:
AnalysisEngine.newCAS()
-
newJCas
public JCas newJCas() throws ResourceInitializationException
Description copied from interface:AnalysisEngineSimilar toAnalysisEngine.newCAS()but wraps the new CAS objects with the Java-object-basedJCasinterface.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 toAnalysisEngine.process(JCas).- Specified by:
newJCasin interfaceAnalysisEngine- Returns:
- a new
CASappropriate for this AnalysisEngine. - Throws:
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.- See Also:
AnalysisEngine.newJCas()
-
process
public ProcessTrace process(CAS aCAS, ResultSpecification aResultSpec) throws ResultNotSupportedException, AnalysisEngineProcessException
Description copied from interface:AnalysisEngineInvokes this AnalysisEngine's analysis logic. Prior to calling this method, the caller must ensure that the CAS has been populated with the artifact to be analyzed as well as any inputs required by this AnalysisEngine (as defined by this AnalysisEngine'sCapabilityspecification.)This version of the
processmethod takes aResultSpecificationas an argument. TheResultSpecificationis alist of output types and features that the application wants this AnalysisEngine to produce. If you are going to use the sameResultSpecificationfor multiple calls toprocess, it is not recommended to use this method. Instead callAnalysisEngine.setResultSpecification(ResultSpecification)once and then callAnalysisEngine.process(CAS)for each CAS that you want to process.- Specified by:
processin interfaceAnalysisEngine- Parameters:
aCAS- 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.- Returns:
- an object containing information about which AnalysisEngine components have executed and information, such as timing, about that execution.
- Throws:
ResultNotSupportedException- if this AnalysisEngine is not capable of producing the results requested inaResultSpec.AnalysisEngineProcessException- if a failure occurs during processing.- See Also:
AnalysisEngine.process(org.apache.uima.cas.CAS, org.apache.uima.analysis_engine.ResultSpecification)
-
process
public void process(CAS aCAS, ResultSpecification aResultSpec, ProcessTrace aTrace) throws ResultNotSupportedException, AnalysisEngineProcessException
Description copied from interface:AnalysisEngineInvokes this AnalysisEngine's analysis logic. Prior to calling this method, the caller must ensure that the CAS has been populated with the artifact to be analyzed as well as any inputs required by this AnalysisEngine (as defined by this AnalysisEngine'sCapabilityspecification.)This version of the
processmethod takes aResultSpecificationas an argument. TheResultSpecificationis a list of output types and features that the application wants this AnalysisEngine to produce. If you are going to use the sameResultSpecificationfor multiple calls toprocess, it is not recommended to use this method. Instead callAnalysisEngine.setResultSpecification(ResultSpecification)once and then callAnalysisEngine.process(CAS)for each CAS that you want to process.This version of this method also takes a
ProcessTraceobject as a parameter. This allows trace events to be written to an existingProcessTracerather than a new one.- Specified by:
processin interfaceAnalysisEngine- Parameters:
aCAS- 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 recorded- Throws:
ResultNotSupportedException- if this AnalysisEngine is not capable of producing the results requested inaResultSpec.AnalysisEngineProcessException- if a failure occurs during processing.- See Also:
AnalysisEngine.process(org.apache.uima.cas.CAS, org.apache.uima.analysis_engine.ResultSpecification, org.apache.uima.util.ProcessTrace)
-
process
public ProcessTrace process(CAS aCAS) throws AnalysisEngineProcessException
Description copied from interface:AnalysisEngineInvokes this AnalysisEngine's analysis logic. Prior to calling this method, the caller must ensure that the CAS has been populated with the artifact to be analyzed as well as any inputs required by this AnalysisEngine (as defined by this AnalysisEngine'sCapabilityspecification.)This version of
processdoes not take aResultSpecificationparameter. You may specify aResultSpecificationby callingAnalysisEngine.setResultSpecification(ResultSpecification)prior to calling this method.- Specified by:
processin interfaceAnalysisEngine- Parameters:
aCAS- the CAS containing the inputs to the processing. Analysis results will also be written to this CAS.- Returns:
- an object containing information about which AnalysisEngine components have executed and information, such as timing, about that execution.
- Throws:
AnalysisEngineProcessException- if a failure occurs during processing.
-
process
public ProcessTrace process(JCas aJCas) throws AnalysisEngineProcessException
Description copied from interface:AnalysisEngineSimilar toAnalysisEngine.process(CAS)but uses the Java-object-basedJCasinterface instead of the generalCASinterface.- Specified by:
processin interfaceAnalysisEngine- Parameters:
aJCas- the JCas containing the inputs to the processing. Analysis results will also be written to this JCas.- Returns:
- an object containing information about which AnalysisEngine components have executed and information, such as timing, about that execution.
- Throws:
AnalysisEngineProcessException- if a failure occurs during processing.- See Also:
AnalysisEngine.process(org.apache.uima.jcas.JCas)
-
process
public ProcessTrace process(JCas aJCas, ResultSpecification aResultSpec) throws ResultNotSupportedException, AnalysisEngineProcessException
Description copied from interface:AnalysisEngineSimilar toAnalysisEngine.process(CAS,ResultSpecification)but uses the Java-object-basedJCasinterface instead of the generalCASinterface.This version of the
processmethod takes aResultSpecificationas an argument. TheResultSpecificationis a list of output types and features that the application wants this AnalysisEngine to produce. If you are going to use the sameResultSpecificationfor multiple calls toprocess, it is not recommended to use this method. Instead callAnalysisEngine.setResultSpecification(ResultSpecification)once and then callAnalysisEngine.process(JCas)for each CAS that you want to process.- Specified by:
processin interfaceAnalysisEngine- Parameters:
aJCas- 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.- Returns:
- an object containing information about which AnalysisEngine components have executed and information, such as timing, about that execution.
- Throws:
ResultNotSupportedException- if this AnalysisEngine is not capable of producing the results requested inaResultSpec.AnalysisEngineProcessException- if a failure occurs during processing.- See Also:
AnalysisEngine.process(org.apache.uima.jcas.JCas, org.apache.uima.analysis_engine.ResultSpecification)
-
process
public void process(JCas aJCas, ResultSpecification aResultSpec, ProcessTrace aTrace) throws ResultNotSupportedException, AnalysisEngineProcessException
Description copied from interface:AnalysisEngineSimilar toAnalysisEngine.process(CAS, ResultSpecification, ProcessTrace)but uses the Java-object-basedJCasinterface instead of the generalCASinterface.This version of the
processmethod takes aResultSpecificationas an argument. TheResultSpecificationis a list of output types and features that the application wants this AnalysisEngine to produce. If you are going to use the sameResultSpecificationfor multiple calls toprocess, it is not recommended to use this method. Instead callAnalysisEngine.setResultSpecification(ResultSpecification)once and then callAnalysisEngine.process(JCas)for each CAS that you want to process.This version of this method also takes a
ProcessTraceobject as a parameter. This allows trace events to be written to an existingProcessTracerather than a new one.- Specified by:
processin interfaceAnalysisEngine- Parameters:
aJCas- 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 recorded- Throws:
ResultNotSupportedException- if this AnalysisEngine is not capable of producing the results requested inaResultSpec.AnalysisEngineProcessException- if a failure occurs during processing.- See Also:
AnalysisEngine.process(org.apache.uima.jcas.JCas, org.apache.uima.analysis_engine.ResultSpecification, org.apache.uima.util.ProcessTrace)
-
process
@Deprecated public void process(AnalysisProcessData aProcessData, ResultSpecification aResultSpec) throws ResultNotSupportedException, AnalysisEngineProcessException
Deprecated.Description copied from interface:AnalysisEngineInvokes this AnalysisEngine's analysis logic. Prior to calling this method, the caller must ensure that the CAS has been populated with the artifact to be analyzed as well as any inputs required by this AnalysisEngine (as defined by this AnalysisEngine'sCapabilityspecification.)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
AnalysisProcessDataobject, which includes the CAS and the ProcessTrace.- Specified by:
processin interfaceAnalysisEngine- Parameters:
aProcessData- 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. Anullresult specification is equivalent to a request for all possible results.- Throws:
ResultNotSupportedException- if this AnalysisEngine is not capable of producing the results requested inaResultSpec.AnalysisEngineProcessException- if a failure occurs during processing.
-
processCas
public void processCas(CAS aCAS) throws ResourceProcessException
Description copied from interface:CasObjectProcessorProcess a single CAS.- Specified by:
processCasin interfaceCasObjectProcessor- Parameters:
aCAS- the CAS to be processed. Additional information may be added to this CAS (if this CAS processor is notread-only).- Throws:
ResourceProcessException- if processing fails
-
processCas
public void processCas(CAS[] aCASes) throws ResourceProcessException
Description copied from interface:CasObjectProcessorProcesses multiple CASes.- Specified by:
processCasin interfaceCasObjectProcessor- Parameters:
aCASes- an array of CASes to be processed. Additional information may be added to these CASes (if this CAS processor is notread-only).- Throws:
ResourceProcessException- if processing fails for any of the CASes- See Also:
CasObjectProcessor.processCas(org.apache.uima.cas.CAS[])
-
processAndOutputNewCASes
public JCasIterator processAndOutputNewCASes(JCas aJCas) throws AnalysisEngineProcessException
Default implementation of processAndOutputNewCASes(JCas) method. Calls the version of this method that takes a CAS, then wraps the resulting CasIterator in a JCasIterator.- Specified by:
processAndOutputNewCASesin interfaceAnalysisEngine- Parameters:
aJCas- the JCAS to be processed- Returns:
- an object for iterating through any output JCASes
- Throws:
AnalysisEngineProcessException- if a failure occurs during processing
-
createResultSpecification
public ResultSpecification createResultSpecification()
Description copied from interface:AnalysisEngineA factory method used to create an instance of
ResultSpecificationfor use with this AnalysisEngine. Applications use this method to constructResultSpecifications to pass to this AnalysisEngine'sAnalysisEngine.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.- Specified by:
createResultSpecificationin interfaceAnalysisEngine- Returns:
- a new instance of
ResultSpecification - See Also:
AnalysisEngine.createResultSpecification()
-
createResultSpecification
public ResultSpecification createResultSpecification(TypeSystem aTypeSystem)
Description copied from interface:AnalysisEngineA factory method used to create an instance ofResultSpecificationfor use with this AnalysisEngine. Applications use this method to constructResultSpecifications to pass to this AnalysisEngine'sAnalysisEngine.setResultSpecification(ResultSpecification)method.- Specified by:
createResultSpecificationin interfaceAnalysisEngine- Parameters:
aTypeSystem- the type system- Returns:
- a new instance of
ResultSpecification - See Also:
AnalysisEngine.createResultSpecification(TypeSystem)
-
getFeatureNamesForType
public java.lang.String[] getFeatureNamesForType(java.lang.String aTypeName)
Description copied from interface:AnalysisEngineGets the names of the features that are defined on one of the CAS types that this AE inputs or outputs. When a AE's capabilities are declared withallAnnotatorFeatures == true, this method can be used to determine all of the feature names.- Specified by:
getFeatureNamesForTypein interfaceAnalysisEngine- Parameters:
aTypeName- type for which to get features- Returns:
- an array of feature names. If
aTypeNameis not defined,nullwill be returned. - See Also:
AnalysisEngine.getFeatureNamesForType(java.lang.String)
-
isStateless
public boolean isStateless()
Description copied from interface:CasProcessorGets whether this is a stateless CAS Processor. Stateless CAS Processors do not maintain any data between calls to their process methods.- Specified by:
isStatelessin interfaceCasProcessor- Returns:
- true if this CAS processor is stateless, false if it is stateful.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:CasProcessorGets whether this is a read-only CAS Processor, which does not modify the CAS.- Specified by:
isReadOnlyin interfaceCasProcessor- Returns:
- true if this CAS processor does not modify the CAS, false if it does.
-
typeSystemInit
public void typeSystemInit(TypeSystem aTypeSystem) throws ResourceInitializationException
From the CAS Processor interface. Called by the CPM if the CAS type system changes - this does not need to do anything since the annotators' typeSystemInit methods are automatically called prior to processing whenever it is necessary.- Specified by:
typeSystemInitin interfaceCasObjectProcessor- Parameters:
aTypeSystem- the type system to use- Throws:
ResourceInitializationException- if the type system is not compatible with this Cas Consumer- See Also:
CasObjectProcessor.typeSystemInit(org.apache.uima.cas.TypeSystem)
-
getPerformanceTuningSettings
public java.util.Properties getPerformanceTuningSettings()
Gets the performance tuning settings in effect for this Analysis Engine.- Specified by:
getPerformanceTuningSettingsin interfaceAnalysisEngine- Returns:
- performance tuning settings
-
setResultSpecification
public void setResultSpecification(ResultSpecification aResultSpec)
Description copied from interface:AnalysisEngineSets the list of output types and features that the application wants this AnalysisEngine to produce. This is only a guideline. Annotators may use this information to avoid doing unnecessary work, but they are not required to do so.- Specified by:
setResultSpecificationin interfaceAnalysisEngine- Parameters:
aResultSpec- specifies the list of output types and features that the application is interested in.
-
resetResultSpecificationToDefault
public void resetResultSpecificationToDefault()
-
getManagementInterface
public AnalysisEngineManagement getManagementInterface()
Description copied from interface:AnalysisEngineGets an object that can be used to do monitoring or management of this AnalysisEngine.- Specified by:
getManagementInterfacein interfaceAnalysisEngine- Returns:
- an object exposing a management interface to this AE
-
batchProcessComplete
public void batchProcessComplete(ProcessTrace aTrace) throws ResourceProcessException, java.io.IOException
Description copied from interface:CasProcessorCompletes the processing of a batch. A collection may be divided into one or more batches - it is up to the CollectionProcessingManager or the application to determine the number and size of batches.- Specified by:
batchProcessCompletein interfaceCasProcessor- Parameters:
aTrace- an object that records information, such as timing, about this method's execution.- Throws:
ResourceProcessException- if an exception occurs during processingjava.io.IOException- if an I/O failure occurs
-
collectionProcessComplete
public void collectionProcessComplete(ProcessTrace aTrace) throws ResourceProcessException, java.io.IOException
Description copied from interface:CasProcessorCompletes the processing of an entire collection.- Specified by:
collectionProcessCompletein interfaceCasProcessor- Parameters:
aTrace- an object that records information, such as timing, about this method's execution.- Throws:
ResourceProcessException- if an exception occurs during processingjava.io.IOException- if an I/O failure occurs
-
setPerformanceTuningSettings
protected void setPerformanceTuningSettings(java.util.Properties aSettings)
Sets the performance tuning settings in effect for this Analysis Engine. This should be set from the initialize() method if the defaults are to be overriden.- Parameters:
aSettings- performance tuning settings
-
normalizeIsoLangCodes
protected void normalizeIsoLangCodes(ProcessingResourceMetaData md)
-
getCurrentConfigParameterSettings
protected ConfigurationParameterSettings getCurrentConfigParameterSettings()
Kludge - make this public (but not part of AnalysisEngine interface) so that TAFAnnotator can access it.- Returns:
- -
- See Also:
ConfigurationManager.getCurrentConfigParameterSettings(String)
-
getMBean
protected AnalysisEngineManagementImpl getMBean()
- Returns:
- the MBean that provides the management interface to this AE. Returns the same object as getManagementInterface() but casted to the AnalysisEngineManagement type.
-
enterProcess
protected void enterProcess()
-
exitProcess
protected void exitProcess()
-
enterBatchProcessComplete
protected void enterBatchProcessComplete()
-
exitBatchProcessComplete
protected void exitBatchProcessComplete()
-
enterCollectionProcessComplete
protected void enterCollectionProcessComplete()
-
exitCollectionProcessComplete
protected void exitCollectionProcessComplete()
-
buildProcessTraceFromMBeanStats
protected ProcessTrace buildProcessTraceFromMBeanStats()
- Returns:
- a constructed ProcessTrace object that represents the last execution of this AnalysisEngine. This is used so that we can return a ProcessTrace object from each process() call for backwards compatibility with version 1.x.
-
buildProcessTraceFromMBeanStats
protected void buildProcessTraceFromMBeanStats(ProcessTrace trace)
Modify an existing ProcessTrace object by adding events that represent the last excecution of this AnalysisEngine. This is used so that we can return a ProcessTrace object from each process() call for backwards compatibility with version 1.x.- Parameters:
trace- -
-
isProcessTraceEnabled
protected boolean isProcessTraceEnabled()
Gets whether the Process Trace (which collects performance stats for this AnalysisEngine) is enabled. This is controlled through the PerformanceTuningSettings passed to the initialize() method.- Returns:
- true if the ProcessTrace is enabled, false if not.
-
getMBeanServer
protected java.lang.Object getMBeanServer()
-
getMBeanNamePrefix
protected java.lang.String getMBeanNamePrefix()
-
callInitializeMethod
protected void callInitializeMethod(AnalysisComponent component, UimaContext context) throws ResourceInitializationException
- Throws:
ResourceInitializationException
-
callProcessMethod
protected void callProcessMethod(AnalysisComponent component, AbstractCas cas) throws java.lang.Exception
- Throws:
java.lang.Exception
-
withContexts
private void withContexts(AnalysisComponent component, UimaContext context, AbstractCas cas, Runnable_withException r) throws java.lang.Exception
- Throws:
java.lang.Exception
-
pushMDCstring
private java.lang.String pushMDCstring(java.lang.String key, java.lang.String value)
-
popMDCstring
private void popMDCstring(java.lang.String key, java.lang.String prev)
-
-