Class FlowControllerContainer
- java.lang.Object
-
- org.apache.uima.resource.Resource_ImplBase
-
- org.apache.uima.resource.ConfigurableResource_ImplBase
-
- org.apache.uima.analysis_engine.asb.impl.FlowControllerContainer
-
- All Implemented Interfaces:
ConfigurableResource
,Resource
public class FlowControllerContainer extends ConfigurableResource_ImplBase
Container for a FlowController. Manages configuration parameters, resources, CAS interface conversions, and performance timing.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
initialized
private static java.lang.String
LOG_RESOURCE_BUNDLE
private FlowController
mFlowController
private java.lang.Object
mMBeanServer
private boolean
mSofaAware
private UimaTimer
mTimer
-
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 FlowControllerContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnalysisEngines(java.util.Collection<java.lang.String> aKeys)
Notifies this FlowController that new Analysis Enginesvoid
collectionProcessComplete()
FlowContainer
computeFlow(CAS aCAS)
Invokes the FlowController's computeFlow method, returning a Flow object that routes the given CAS through this aggregate.void
destroy()
Releases all resources held by thisResource
.protected void
finalize()
private FlowControllerContext
getFlowControllerContext()
AnalysisEngineManagementImpl
getMBean()
ProcessingResourceMetaData
getProcessingResourceMetaData()
java.lang.Class<? extends AbstractCas>
getRequiredCasInterface()
boolean
initialize(ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams)
Initializes thisResource
from aResourceSpecifier
.private FlowController
instantiateFlowController(ResourceCreationSpecifier aDescriptor)
Instantiates the FlowController class specified in the descriptor.(package private) boolean
isInitialized()
void
reconfigure()
Instructs this Resource to re-read its configuration parameter settings.void
removeAnalysisEngines(java.util.Collection<java.lang.String> aKeys)
Notifies this FlowController that some Analysis Engines are no longer available to route CASes to.-
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, loadUserClass, loadUserClassOrThrow, setContextHolder, setContextHolderX, setLogger, setMetaData, 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.resource.Resource
getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger
-
-
-
-
Field Detail
-
mFlowController
private FlowController mFlowController
-
mTimer
private UimaTimer mTimer
-
mSofaAware
private boolean mSofaAware
-
mMBeanServer
private java.lang.Object mMBeanServer
-
initialized
private boolean initialized
-
LOG_RESOURCE_BUNDLE
private static final java.lang.String LOG_RESOURCE_BUNDLE
- See Also:
- Constant Field Values
-
-
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 interfaceResource
- Overrides:
initialize
in classResource_ImplBase
- 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. Returns 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
- 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:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
getFlowControllerContext
private FlowControllerContext getFlowControllerContext()
-
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 interfaceConfigurableResource
- Overrides:
reconfigure
in classConfigurableResource_ImplBase
- Throws:
ResourceConfigurationException
- if the configuration is not valid- See Also:
ConfigurableResource.reconfigure()
-
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()
-
computeFlow
public FlowContainer computeFlow(CAS aCAS) throws AnalysisEngineProcessException
Invokes the FlowController's computeFlow method, returning a Flow object that routes the given CAS through this aggregate. This method makes sure to provide the FlowController with its required CAS interface (e.g. JCas).- Parameters:
aCAS
- the CAS to pass to the FlowController- Returns:
- a Flow object that routes this CAS
- Throws:
AnalysisEngineProcessException
- if the FlowController failed
-
getRequiredCasInterface
public java.lang.Class<? extends AbstractCas> getRequiredCasInterface()
- Returns:
- the required CAS interface of the FlowController
-
getProcessingResourceMetaData
public ProcessingResourceMetaData getProcessingResourceMetaData()
-
getMBean
public AnalysisEngineManagementImpl getMBean()
- Returns:
- the MBean to use to report performance statistics.
-
addAnalysisEngines
public void addAnalysisEngines(java.util.Collection<java.lang.String> aKeys)
Notifies this FlowController that new Analysis Engines- Parameters:
aKeys
- the keys for the delegates- See Also:
FlowController.addAnalysisEngines(Collection)
-
removeAnalysisEngines
public void removeAnalysisEngines(java.util.Collection<java.lang.String> aKeys) throws AnalysisEngineProcessException
Notifies this FlowController that some Analysis Engines are no longer available to route CASes to.- Parameters:
aKeys
- the keys of the delegates to be removed- Throws:
AnalysisEngineProcessException
- -- See Also:
FlowController.removeAnalysisEngines(Collection)
-
instantiateFlowController
private FlowController instantiateFlowController(ResourceCreationSpecifier aDescriptor) throws ResourceInitializationException
Instantiates the FlowController class specified in the descriptor.- Throws:
ResourceInitializationException
-
isInitialized
boolean isInitialized()
-
collectionProcessComplete
public void collectionProcessComplete() throws AnalysisEngineProcessException
- Throws:
AnalysisEngineProcessException
-
-