Class UimacppAnalysisEngineImpl
- java.lang.Object
-
- org.apache.uima.resource.Resource_ImplBase
-
- org.apache.uima.resource.ConfigurableResource_ImplBase
-
- org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase
-
- org.apache.uima.analysis_engine.impl.UimacppAnalysisEngineImpl
-
- All Implemented Interfaces:
AnalysisEngine
,TextAnalysisEngine
,CasObjectProcessor
,CasProcessor
,ConfigurableResource
,Resource
public class UimacppAnalysisEngineImpl extends AnalysisEngineImplBase implements AnalysisEngine
Reference implementation ofAnalysisEngine
.
-
-
Field Summary
-
Fields inherited from class org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase
LOG_RESOURCE_BUNDLE, PARAM_VERIFICATION_MODE
-
Fields inherited from interface org.apache.uima.analysis_engine.AnalysisEngine
PARAM_CONFIG_PARAM_SETTINGS, PARAM_MBEAN_NAME_PREFIX, PARAM_MBEAN_SERVER, PARAM_NUM_SIMULTANEOUS_REQUESTS, PARAM_RESOURCE_MANAGER, 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 UimacppAnalysisEngineImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected AnalysisComponent
_getAnnotator()
For a primitive AnalysisEngine only, gets the Annotator.protected AnnotatorContext_impl
_getAnnotatorContext()
For a primitive AnalysisEngine only, gets the AnnotatorContext.protected java.util.Map<java.lang.String,ResourceSpecifier>
_getComponentCasProcessorSpecifierMap()
For an aggregate AnalysisEngine only, gets a Map from each component's key to the specifier for that component.void
batchProcessComplete()
Notifies this AnalysisEngine that processing of a batch has completed.protected CAS
callAnalysisComponentNext()
Calls the Analysis Component's next() method.protected void
callAnalysisComponentProcess(CAS aCAS)
Calls the Analysis Component's process method.void
collectionProcessComplete()
Notifies this AnalysisEngine that processing of an entire collection has completed.protected AnalysisProcessData_impl
createAnalysisProcessData()
Deprecated.void
destroy()
Releases all resources held by thisResource
.protected void
enableProhibitedAnnotatorCasFunctions(CAS aCAS, boolean aEnable)
Lock/unlock CAS functions to which Annotators should not have accessboolean
initialize(ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams)
Initializes thisResource
from aResourceSpecifier
.protected void
initializeAnalysisComponent()
A utility method that performs initialization logic for a primitive AnalysisEngine.protected void
mergeDelegateAnalysisEngineMetaData()
For an aggregate TAF AE, sets this aggregate AE's Type System, Type Priorities, and FS Index Descriptions equal to the result of merging the information from its delegate AEs.CasIterator
processAndOutputNewCASes(CAS aCAS)
Processes a CAS, possibly producing multiple CASes as a result.void
reconfigure()
Instructs this Resource to re-read its configuration parameter settings.void
setResultSpecification(ResultSpecification aResultSpec)
Sets the list of output types and features that the application wants this AnalysisEngine to produce.-
Methods inherited from class org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase
batchProcessComplete, buildProcessTraceFromMBeanStats, buildProcessTraceFromMBeanStats, collectionProcessComplete, createResultSpecification, createResultSpecification, enterBatchProcessComplete, enterCollectionProcessComplete, enterProcess, exitBatchProcessComplete, exitCollectionProcessComplete, exitProcess, finalize, getAnalysisEngineMetaData, getCurrentConfigParameterSettings, getFeatureNamesForType, getManagementInterface, getMBean, getMBeanNamePrefix, getMBeanServer, getPerformanceTuningSettings, getProcessingResourceMetaData, isProcessTraceEnabled, isReadOnly, isStateless, newCAS, newJCas, normalizeIsoLangCodes, process, process, process, process, process, process, process, processAndOutputNewCASes, processCas, processCas, resetResultSpecificationToDefault, setMetaData, setPerformanceTuningSettings, typeSystemInit
-
Methods inherited from class org.apache.uima.resource.ConfigurableResource_ImplBase
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
-
Methods inherited from class org.apache.uima.resource.Resource_ImplBase
getCasManager, getLogger, getMetaData, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger
-
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
createResultSpecification, createResultSpecification, getAnalysisEngineMetaData, getFeatureNamesForType, getLogger, getManagementInterface, getPerformanceTuningSettings, getResourceManager, newCAS, newJCas, process, process, process, process, process, process, process, processAndOutputNewCASes, setLogger
-
Methods inherited from interface org.apache.uima.collection.base_cpm.CasObjectProcessor
processCas, processCas, typeSystemInit
-
Methods inherited from interface org.apache.uima.collection.base_cpm.CasProcessor
batchProcessComplete, collectionProcessComplete, getProcessingResourceMetaData, isReadOnly, isStateless
-
Methods inherited from interface org.apache.uima.resource.ConfigurableResource
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
-
Methods inherited from interface org.apache.uima.resource.Resource
getMetaData, getUimaContext, getUimaContextAdmin
-
-
-
-
Method Detail
-
initialize
public boolean initialize(ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams) throws ResourceInitializationException
Description copied from interface:Resource
Initializes thisResource
from aResourceSpecifier
. Applications do not need to call this method. It is called automatically by theResourceFactory
and cannot be called a second time.- Specified by:
initialize
in interfaceAnalysisEngine
- Specified by:
initialize
in interfaceResource
- Overrides:
initialize
in classAnalysisEngineImplBase
- Parameters:
aSpecifier
- specifies how to create a resource or locate an existing resource service.aAdditionalParams
- a Map containing additional parameters. May benull
if 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. Reutrns false if the given
ResourceSpecifier
is not of an appropriate type for this Resource. If theResourceSpecifier
is of an appropriate type but is invalid or if some other failure occurs, an exception should be thrown. - Throws:
ResourceInitializationException
- or wraps invalid xml exception when processing imports- See Also:
Resource.initialize(ResourceSpecifier, Map)
-
setResultSpecification
public void setResultSpecification(ResultSpecification aResultSpec)
Description copied from interface:AnalysisEngine
Sets 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:
setResultSpecification
in interfaceAnalysisEngine
- Overrides:
setResultSpecification
in classAnalysisEngineImplBase
- Parameters:
aResultSpec
- specifies the list of output types and features that the application is interested in.
-
destroy
public void destroy()
Description copied from interface:Resource
Releases all resources held by thisResource
.- Specified by:
destroy
in interfaceResource
- Overrides:
destroy
in classResource_ImplBase
- See Also:
Resource.destroy()
-
processAndOutputNewCASes
public CasIterator processAndOutputNewCASes(CAS aCAS) throws AnalysisEngineProcessException
Description copied from interface:AnalysisEngine
Processes a CAS, possibly producing multiple CASes as a result. The application uses theCasIterator
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 theOperationalProperties.getOutputsNewCASes()
operational property (getAnalysisEngineMetaData().getOperationalProperties().getOutputsNewCASes()
).Once this method is called, the AnalysisEngine "owns"
aCAS
until 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 ofaCAS
will revert to the caller.- Specified by:
processAndOutputNewCASes
in interfaceAnalysisEngine
- Overrides:
processAndOutputNewCASes
in classAnalysisEngineImplBase
- Parameters:
aCAS
- the CAS to be processed- Returns:
- an object for iterating through any output CASes
- Throws:
AnalysisEngineProcessException
- if a failure occurs during processing
-
batchProcessComplete
public void batchProcessComplete() throws AnalysisEngineProcessException
Description copied from interface:AnalysisEngine
Notifies 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:
batchProcessComplete
in interfaceAnalysisEngine
- Overrides:
batchProcessComplete
in classAnalysisEngineImplBase
- Throws:
AnalysisEngineProcessException
- if an exception occurs during processing
-
collectionProcessComplete
public void collectionProcessComplete() throws AnalysisEngineProcessException
Description copied from interface:AnalysisEngine
Notifies 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
fixedFlow
orcapabilityLanguageFlow
, 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 nofixedFlow
orcapabilityLanguageFlow
, then all components in the aggregate will be called in arbitrary order.- Specified by:
collectionProcessComplete
in interfaceAnalysisEngine
- Overrides:
collectionProcessComplete
in classAnalysisEngineImplBase
- Throws:
AnalysisEngineProcessException
- if an exception occurs during processing
-
reconfigure
public void reconfigure() throws ResourceConfigurationException
Description copied from interface:ConfigurableResource
Instructs this Resource to re-read its configuration parameter settings.- Specified by:
reconfigure
in interfaceAnalysisEngine
- Specified by:
reconfigure
in interfaceConfigurableResource
- Overrides:
reconfigure
in classConfigurableResource_ImplBase
- Throws:
ResourceConfigurationException
- if the configuration is not valid- See Also:
AnalysisEngine.reconfigure()
-
callAnalysisComponentProcess
protected void callAnalysisComponentProcess(CAS aCAS) throws AnalysisEngineProcessException
Calls the Analysis Component's process method.- Parameters:
aCAS
- CAS to be processed by annotator- Throws:
AnalysisEngineProcessException
- -
-
initializeAnalysisComponent
protected void initializeAnalysisComponent() throws ResourceInitializationException
A utility method that performs initialization logic for a primitive AnalysisEngine.- Throws:
ResourceInitializationException
- if an initialization failure occurs
-
mergeDelegateAnalysisEngineMetaData
protected void mergeDelegateAnalysisEngineMetaData() throws ResourceInitializationException
For an aggregate TAF AE, sets this aggregate AE's Type System, Type Priorities, and FS Index Descriptions equal to the result of merging the information from its delegate AEs.- Throws:
ResourceInitializationException
- if an error occurs
-
enableProhibitedAnnotatorCasFunctions
protected void enableProhibitedAnnotatorCasFunctions(CAS aCAS, boolean aEnable)
Lock/unlock CAS functions to which Annotators should not have access- Parameters:
aCAS
- the CAS to be affectedaEnable
- false to lock out functions, true to re-enable them
-
callAnalysisComponentNext
protected CAS callAnalysisComponentNext() throws AnalysisEngineProcessException, ResultNotSupportedException
Calls the Analysis Component's next() method.- Returns:
- CAS returned by the analysis component
- Throws:
AnalysisEngineProcessException
- -ResultNotSupportedException
- -
-
createAnalysisProcessData
@Deprecated protected AnalysisProcessData_impl createAnalysisProcessData()
Deprecated.- Returns:
- -
-
_getAnnotator
protected AnalysisComponent _getAnnotator()
For a primitive AnalysisEngine only, gets the Annotator.- Returns:
- the Annotator
-
_getAnnotatorContext
protected AnnotatorContext_impl _getAnnotatorContext()
For a primitive AnalysisEngine only, gets the AnnotatorContext.- Returns:
- the AnnotatorContext
-
_getComponentCasProcessorSpecifierMap
protected java.util.Map<java.lang.String,ResourceSpecifier> _getComponentCasProcessorSpecifierMap()
For an aggregate AnalysisEngine only, gets a Map from each component's key to the specifier for that component.- Returns:
- a Map with String keys and ResourceSpecifier values
-
-