org.apache.uima.resource
Interface CasManager

All Superinterfaces:
CasOwner

public interface CasManager
extends CasOwner

Manages creation and pooling of CAS instances within an AnalysisEngine.


Method Summary
 void addMetaData(ProcessingResourceMetaData aMetadata)
          Called by components when they initialize.
 CAS createNewCas(Properties aPerformanceTuningSettings)
          Create a new CAS using the CasDefinition stored in this CAS Manager.
 void defineCasPool(String aRequestorContextName, int aSize, Properties aPerformanceTuningSettings)
          Defines the CAS pool required by a particular AnalysisEngine.
 CAS getCas(String aRequestorContextName)
          Gets an empty CAS.
 CasDefinition getCasDefinition()
          Gets the CasDefinition, as defined by merging all of the metadata supplied by calls addMetaData(ProcessingResourceMetaData).
 AbstractCas getCasInterface(CAS cas, Class requiredInterface)
          Gets a specified interface to a CAS.
 
Methods inherited from interface org.apache.uima.cas.CasOwner
releaseCas
 

Method Detail

addMetaData

void addMetaData(ProcessingResourceMetaData aMetadata)
Called by components when they initialize.

Parameters:
aMetadata - an object containing metadata for the component, including Type System, Type Priorities, and Index Definitions needed to create the CAS.

getCasDefinition

CasDefinition getCasDefinition()
                               throws ResourceInitializationException
Gets the CasDefinition, as defined by merging all of the metadata supplied by calls addMetaData(ProcessingResourceMetaData).

Returns:
the merged CasDefinition
Throws:
ResourceInitializationException - if metadata could not be merged

defineCasPool

void defineCasPool(String aRequestorContextName,
                   int aSize,
                   Properties aPerformanceTuningSettings)
                   throws ResourceInitializationException
Defines the CAS pool required by a particular AnalysisEngine. (The AnalysisEngine must contain a CAS Multiplier if it requires a CAS pool.)

Parameters:
aRequestorContextName - the context name of the AE that will request the CASes (AnalysisEngine.getUimaContextAdmin().getQualifiedContextName()).
aSize - the minimum CAS pool size required
aPerformanceTuningSettings - settings, including initial CAS heap size, for the AE
Throws:
ResourceInitializationException - if a CAS could not be created.

getCas

CAS getCas(String aRequestorContextName)
Gets an empty CAS. An AnalysisEngine may only call this method after it has first called defineCasPool(String, int, Properties) and established a CAS Pool of size > 0. The CAS Manager maintains a separate pool for each AnalysisEngine. This method may block if the CAS pool does not contain any free instances.

Parameters:
aRequestorContextName - the context name of the AE requesting the CAS (AnalysisEngine.getUimaContextAdmin().getQualifiedContextName()).
Returns:
an empty CAS

createNewCas

CAS createNewCas(Properties aPerformanceTuningSettings)
                 throws ResourceInitializationException
Create a new CAS using the CasDefinition stored in this CAS Manager. Note that this new CAS will not belong to any pool managed by this CAS Manager. If this method is called multiple times while the CasDefinition is constant, each new CAS will share an identical TypeSystem object.

Parameters:
aPerformanceTuningSettings - settings, including initial CAS heap size, for the AE
Returns:
a new CAS
Throws:
ResourceInitializationException - if the CAS could not be created

getCasInterface

AbstractCas getCasInterface(CAS cas,
                            Class requiredInterface)
Gets a specified interface to a CAS.

Parameters:
cas - The CAS
requiredInterface - interface to get. Currently must be either CAS or JCas.


Copyright © 2007 The Apache Software Foundation. All Rights Reserved.