Class ASB_impl
- java.lang.Object
-
- org.apache.uima.resource.Resource_ImplBase
-
- org.apache.uima.analysis_engine.asb.impl.ASB_impl
-
public class ASB_impl extends Resource_ImplBase implements ASB
A simpleASB
implementation. This implementation is not specific to any transport technology. It simply uses theResourceFactory
to acquire instances of its delegate AnalysisEngines and then communicates with these delegate AnalysisEngines through theAnalysisEngine
interface. Any communication with remote AnalysisEngine services is done through aAnalysisEngineServiceAdapter
and is not the concern of this ASB implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
ASB_impl.AggregateCasIterator
Inner class implementing the CasIterator returned from the processAndOutputNewCASes(CAS) method.private static class
ASB_impl.DummyAnalysisEngine
Dummy analysis engine to use in place of remote AE when in "verification mode".(package private) static class
ASB_impl.StackFrame
A frame on the processing stack for this Aggregate AE.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Class<ASB_impl>
CLASS_NAME
current classprivate static java.lang.String
LOG_RESOURCE_BUNDLE
resource bundle for log messagesprivate UimaContextAdmin
mAggregateUimaContext
UimaContext of the Aggregate AE containing this ASB.private java.util.Map<java.lang.String,ProcessingResourceMetaData>
mAllComponentMetaDataMap
Map from String key to component (AnalysisEngine or FlowController) metadata.private java.util.Map<java.lang.String,AnalysisEngine>
mComponentAnalysisEngineMap
Map from String key to delegate AnalysisEngine for all component AnalysisEngines within this ASB.private java.util.Map<java.lang.String,AnalysisEngineMetaData>
mComponentAnalysisEngineMetaDataMap
Map from String key to delegate AnalysisEngineMetaData for all component AnalysisEngines within this ASB.private FlowControllerContainer
mFlowControllerContainer
private java.util.Map<java.lang.String,java.lang.Object>
mInitParams
Initialization parameters passed to this ASB's initialize method.private boolean
mOutputNewCASes
Whether this aggregate is declared to output new CASes.private SofaMapping[]
mSofaMappings
-
Fields inherited from interface org.apache.uima.analysis_engine.asb.ASB
PARAM_AGGREGATE_ANALYSIS_ENGINE_NAME
-
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 ASB_impl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Releases all resources held by thisResource
.java.util.Map<java.lang.String,ProcessingResourceMetaData>
getAllComponentMetaData()
Gets the metadata for all components known to this ASB.java.util.Map<java.lang.String,AnalysisEngineMetaData>
getComponentAnalysisEngineMetaData()
Gets metadata for all of the component AnalysisEngines known to thisASB
.java.util.Map<java.lang.String,AnalysisEngine>
getComponentAnalysisEngines()
Gets references to the component AnalysisEngines known to thisASB
.FlowControllerContainer
getFlowControllerContainer()
Not public API.protected AnalysisEngineManagementImpl
getMBean()
Gets the MBean that provides the management interface to this AE.protected void
initFlowController(FlowControllerDeclaration aFlowControllerDeclaration, UimaContextAdmin aParentContext, AnalysisEngineMetaData aAggregateMetadata)
boolean
initialize(ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams)
Initializes this ASB.CasIterator
process(CAS aCAS)
Invokes the processing of the aggregate on the given input CAS.void
setup(java.util.Map<java.lang.String,ResourceSpecifier> aSpecifiers, UimaContextAdmin aParentContext, FlowControllerDeclaration aFlowControllerDeclaration, AnalysisEngineMetaData aAggregateMetadata)
Called after calling initialize() (see above) by the Aggregate Analysis Engine to provide this ASB with information it needs to operate.-
Methods inherited from class org.apache.uima.resource.Resource_ImplBase
getCasManager, getLogger, getMetaData, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, loadUserClass, loadUserClassOrThrow, setContextHolder, setContextHolderX, setLogger, setMetaData, withContextHolder
-
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.resource.Resource
getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger
-
-
-
-
Field Detail
-
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<ASB_impl> CLASS_NAME
current class
-
mComponentAnalysisEngineMap
private java.util.Map<java.lang.String,AnalysisEngine> mComponentAnalysisEngineMap
Map from String key to delegate AnalysisEngine for all component AnalysisEngines within this ASB.
-
mComponentAnalysisEngineMetaDataMap
private java.util.Map<java.lang.String,AnalysisEngineMetaData> mComponentAnalysisEngineMetaDataMap
Map from String key to delegate AnalysisEngineMetaData for all component AnalysisEngines within this ASB.
-
mAllComponentMetaDataMap
private java.util.Map<java.lang.String,ProcessingResourceMetaData> mAllComponentMetaDataMap
Map from String key to component (AnalysisEngine or FlowController) metadata.
-
mInitParams
private java.util.Map<java.lang.String,java.lang.Object> mInitParams
Initialization parameters passed to this ASB's initialize method. They will be passed along to the delegate AnalysisEngines.
-
mSofaMappings
private SofaMapping[] mSofaMappings
-
mFlowControllerContainer
private FlowControllerContainer mFlowControllerContainer
-
mOutputNewCASes
private boolean mOutputNewCASes
Whether this aggregate is declared to output new CASes.
-
mAggregateUimaContext
private UimaContextAdmin mAggregateUimaContext
UimaContext of the Aggregate AE containing this ASB.
-
-
Method Detail
-
initialize
public boolean initialize(ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams) throws ResourceInitializationException
Initializes this ASB.- Specified by:
initialize
in interfaceResource
- Overrides:
initialize
in classResource_ImplBase
- Parameters:
aSpecifier
- describes how to create this ASB.aAdditionalParams
- parameters which are passed along to the delegate Analysis Engines when they are constructed- Returns:
- true if and only if initialization completed successfully. Returns false if this
implementation cannot handle the given
ResourceSpecifier
. - Throws:
ResourceInitializationException
- if a failure occurs during initialization.- See Also:
Resource.initialize(ResourceSpecifier, Map)
-
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()
-
setup
public void setup(java.util.Map<java.lang.String,ResourceSpecifier> aSpecifiers, UimaContextAdmin aParentContext, FlowControllerDeclaration aFlowControllerDeclaration, AnalysisEngineMetaData aAggregateMetadata) throws ResourceInitializationException
Called after calling initialize() (see above) by the Aggregate Analysis Engine to provide this ASB with information it needs to operate.- Specified by:
setup
in interfaceASB
- Parameters:
aSpecifiers
- the specifiers for all component AEs within this Aggregate. The ASB will instantiate those AEs.aParentContext
- UIMA context for the aggregate AEaFlowControllerDeclaration
- declaration (key and specifier) of FlowController to be used for this aggregate.aAggregateMetadata
- metadata for the aggregate AE- Throws:
ResourceInitializationException
- passthru
-
initFlowController
protected void initFlowController(FlowControllerDeclaration aFlowControllerDeclaration, UimaContextAdmin aParentContext, AnalysisEngineMetaData aAggregateMetadata) throws ResourceInitializationException
- Throws:
ResourceInitializationException
-
getComponentAnalysisEngineMetaData
public java.util.Map<java.lang.String,AnalysisEngineMetaData> getComponentAnalysisEngineMetaData()
Description copied from interface:ASB
Gets metadata for all of the component AnalysisEngines known to thisASB
.- Specified by:
getComponentAnalysisEngineMetaData
in interfaceASB
- Returns:
- a Map from String keys (the same keys used in
AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiers()
toAnalysisEngineMetaData
values. - See Also:
ASB.getComponentAnalysisEngineMetaData()
-
getComponentAnalysisEngines
public java.util.Map<java.lang.String,AnalysisEngine> getComponentAnalysisEngines()
Description copied from interface:ASB
Gets references to the component AnalysisEngines known to thisASB
.- Specified by:
getComponentAnalysisEngines
in interfaceASB
- Returns:
- a Map from String keys (the same keys used in
AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiers()
toAnalysisEngine
objects. - See Also:
ASB.getComponentAnalysisEngines()
-
getAllComponentMetaData
public java.util.Map<java.lang.String,ProcessingResourceMetaData> getAllComponentMetaData()
Description copied from interface:ASB
Gets the metadata for all components known to this ASB. This includes the FlowController as well as the component AnalysisEngines.- Specified by:
getAllComponentMetaData
in interfaceASB
- Returns:
- a Map from String keys (the same keys used in the aggregate AE descriptor) to
ProcessingResourceMetaData
values.
-
process
public CasIterator process(CAS aCAS) throws AnalysisEngineProcessException
Description copied from interface:ASB
Invokes the processing of the aggregate on the given input CAS. This returns a CasIterator that provides access to the one or more output CASes generated from the processing. The input CAS, including any modifications made to it during processing, will always be the very last element returned by theCasIterator
.If the aggregate does not generate any output CASes of the input CAS, an empty
CasIterator
will be returned.- Specified by:
process
in interfaceASB
- Parameters:
aCAS
- the CAS to process- Returns:
- an iterator over all output CASes
- Throws:
AnalysisEngineProcessException
- -
-
getFlowControllerContainer
public FlowControllerContainer getFlowControllerContainer()
Not public API. Is declared public so it can be used by test case.- Specified by:
getFlowControllerContainer
in interfaceASB
- Returns:
- an instance of
FlowControllerContainer
-
getMBean
protected AnalysisEngineManagementImpl getMBean()
Gets the MBean that provides the management interface to this AE. Returns the same object as UimaContext.getManagementInterface() but casted to the AnalysisEngineManagement type.- Returns:
- the MBean for the management interface to this AE
-
-