Class CPMImpl
- java.lang.Object
-
- org.apache.uima.collection.impl.cpm.BaseCPMImpl
-
- org.apache.uima.collection.impl.cpm.CPMImpl
-
- All Implemented Interfaces:
Runnable
,BaseCPM
,CollectionProcessingManager
public class CPMImpl extends BaseCPMImpl implements CollectionProcessingManager
-
-
Field Summary
-
Fields inherited from class org.apache.uima.collection.impl.cpm.BaseCPMImpl
cpmThreadGroup
-
Fields inherited from interface org.apache.uima.collection.base_cpm.BaseCPM
DOCUMENT_TEXT_FEATURE, DOCUMENT_TEXT_TYPE
-
-
Constructor Summary
Constructors Constructor Description CPMImpl()
CPMImpl(ResourceManager aResourceManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCasConsumer(CasConsumer aCasConsumer)
Adds aCasConsumer
to this CPM.void
addStatusCallbackListener(StatusCallbackListener aListener)
Registers a listsner to receive status callbacks.AnalysisEngine
getAnalysisEngine()
Gets theAnalysisEngine
that is assigned to this CPM.CasConsumer[]
getCasConsumers()
Gets theCasConsumers
s assigned to this CPM.void
process(CollectionReader aCollectionReader)
Initiates processing of a collection.void
process(CollectionReader aCollectionReader, int aBatchSize)
Initiates processing of a collection.void
removeCasConsumer(CasConsumer aCasConsumer)
Removes aCasConsumer
from this CPM.void
removeStatusCallbackListener(StatusCallbackListener aListener)
Unregisters a status callback listener.void
setAnalysisEngine(AnalysisEngine aAnalysisEngine)
Sets theAnalysisEngine
that is assigned to this CPM.-
Methods inherited from class org.apache.uima.collection.impl.cpm.BaseCPMImpl
addCasProcessor, addCasProcessor, addStatusCallbackListener, asynchStop, buildEventTree, disableCasProcessor, displayStats, enableCasProcessor, finalizeIt, getCasProcessors, getCollectionReader, getCPEConfig, getDescriptor, getPerformanceReport, getProgress, getSynchPoint, init, isPaused, isPauseOnException, isProcessing, isSerialProcessingRequired, kill, pause, process, process, process, removeCasProcessor, removeStatusCallbackListener, resume, resume, run, setCollectionReader, setJediiReport, setPauseOnException, setPerformanceTuningSettings, setProcessControllerAdapter, setSerialProcessingRequired, stop
-
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.collection.CollectionProcessingManager
getPerformanceReport, getProgress, isPaused, isPauseOnException, isProcessing, isSerialProcessingRequired, pause, resume, resume, setPauseOnException, setSerialProcessingRequired, stop
-
-
-
-
Constructor Detail
-
CPMImpl
public CPMImpl(ResourceManager aResourceManager) throws Exception
- Throws:
Exception
-
-
Method Detail
-
getAnalysisEngine
public AnalysisEngine getAnalysisEngine()
Description copied from interface:CollectionProcessingManager
Gets theAnalysisEngine
that is assigned to this CPM.- Specified by:
getAnalysisEngine
in interfaceCollectionProcessingManager
- Returns:
- the
AnalysisEngine
that this CPM will use to analyze each CAS in the collection.
-
setAnalysisEngine
public void setAnalysisEngine(AnalysisEngine aAnalysisEngine) throws ResourceConfigurationException
Description copied from interface:CollectionProcessingManager
Sets theAnalysisEngine
that is assigned to this CPM.- Specified by:
setAnalysisEngine
in interfaceCollectionProcessingManager
- Parameters:
aAnalysisEngine
- theAnalysisEngine
that this CPM will use to analyze each CAS in the collection.- Throws:
ResourceConfigurationException
- if this CPM is currently processing
-
getCasConsumers
public CasConsumer[] getCasConsumers()
Description copied from interface:CollectionProcessingManager
Gets theCasConsumers
s assigned to this CPM.- Specified by:
getCasConsumers
in interfaceCollectionProcessingManager
- Returns:
- an array of
CasConsumer
s
-
addCasConsumer
public void addCasConsumer(CasConsumer aCasConsumer) throws ResourceConfigurationException
Description copied from interface:CollectionProcessingManager
Adds aCasConsumer
to this CPM.- Specified by:
addCasConsumer
in interfaceCollectionProcessingManager
- Parameters:
aCasConsumer
- aCasConsumer
to add- Throws:
ResourceConfigurationException
- if this CPM is currently processing
-
removeCasConsumer
public void removeCasConsumer(CasConsumer aCasConsumer)
Description copied from interface:CollectionProcessingManager
Removes aCasConsumer
from this CPM.- Specified by:
removeCasConsumer
in interfaceCollectionProcessingManager
- Parameters:
aCasConsumer
- theCasConsumer
to remove
-
addStatusCallbackListener
public void addStatusCallbackListener(StatusCallbackListener aListener)
Description copied from interface:CollectionProcessingManager
Registers a listsner to receive status callbacks.- Specified by:
addStatusCallbackListener
in interfaceCollectionProcessingManager
- Parameters:
aListener
- the listener to add
-
removeStatusCallbackListener
public void removeStatusCallbackListener(StatusCallbackListener aListener)
Description copied from interface:CollectionProcessingManager
Unregisters a status callback listener.- Specified by:
removeStatusCallbackListener
in interfaceCollectionProcessingManager
- Parameters:
aListener
- the listener to remove
-
process
public void process(CollectionReader aCollectionReader) throws ResourceInitializationException
Description copied from interface:CollectionProcessingManager
Initiates processing of a collection. CollectionReader initializes the CAS with Documents from the Colection. This method starts the processing in another thread and returns immediately. Status of the processing can be obtained by registering a listener with theCollectionProcessingManager.addStatusCallbackListener(StatusCallbackListener)
method.A CPM can only process one collection at a time. If this method is called while a previous processing request has not yet completed, a
UIMA_IllegalStateException
will result. To find out whether a CPM is free to begin another processing request, call theCollectionProcessingManager.isProcessing()
method.- Specified by:
process
in interfaceCollectionProcessingManager
- Parameters:
aCollectionReader
- theCollectionReader
from which to obtain the Entities to be processed- Throws:
ResourceInitializationException
- if an error occurs during initialization
-
process
public void process(CollectionReader aCollectionReader, int aBatchSize) throws ResourceInitializationException
Description copied from interface:CollectionProcessingManager
Initiates processing of a collection. This method works in the same way asCollectionProcessingManager.process(CollectionReader)
, but it breaks the processing up into batches of a size determined by theaBatchSize
parameter. EachCasConsumer
will be notified at the end of each batch.- Specified by:
process
in interfaceCollectionProcessingManager
- Parameters:
aCollectionReader
- theCollectionReader
from which to obtain the Entities to be processedaBatchSize
- the size of the batch.- Throws:
ResourceInitializationException
- if an error occurs during initialization
-
-