Class CPMImpl
- java.lang.Object
-
- org.apache.uima.collection.impl.cpm.BaseCPMImpl
-
- org.apache.uima.collection.impl.cpm.CPMImpl
-
- All Implemented Interfaces:
java.lang.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 voidaddCasConsumer(CasConsumer aCasConsumer)Adds aCasConsumerto this CPM.voidaddStatusCallbackListener(StatusCallbackListener aListener)Registers a listsner to receive status callbacks.AnalysisEnginegetAnalysisEngine()Gets theAnalysisEnginethat is assigned to this CPM.CasConsumer[]getCasConsumers()Gets theCasConsumerss assigned to this CPM.voidprocess(CollectionReader aCollectionReader)Initiates processing of a collection.voidprocess(CollectionReader aCollectionReader, int aBatchSize)Initiates processing of a collection.voidremoveCasConsumer(CasConsumer aCasConsumer)Removes aCasConsumerfrom this CPM.voidremoveStatusCallbackListener(StatusCallbackListener aListener)Unregisters a status callback listener.voidsetAnalysisEngine(AnalysisEngine aAnalysisEngine)Sets theAnalysisEnginethat 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() throws java.lang.Exception- Throws:
java.lang.Exception
-
CPMImpl
public CPMImpl(ResourceManager aResourceManager) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
getAnalysisEngine
public AnalysisEngine getAnalysisEngine()
Description copied from interface:CollectionProcessingManagerGets theAnalysisEnginethat is assigned to this CPM.- Specified by:
getAnalysisEnginein interfaceCollectionProcessingManager- Returns:
- the
AnalysisEnginethat this CPM will use to analyze each CAS in the collection.
-
setAnalysisEngine
public void setAnalysisEngine(AnalysisEngine aAnalysisEngine) throws ResourceConfigurationException
Description copied from interface:CollectionProcessingManagerSets theAnalysisEnginethat is assigned to this CPM.- Specified by:
setAnalysisEnginein interfaceCollectionProcessingManager- Parameters:
aAnalysisEngine- theAnalysisEnginethat 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:CollectionProcessingManagerGets theCasConsumerss assigned to this CPM.- Specified by:
getCasConsumersin interfaceCollectionProcessingManager- Returns:
- an array of
CasConsumers
-
addCasConsumer
public void addCasConsumer(CasConsumer aCasConsumer) throws ResourceConfigurationException
Description copied from interface:CollectionProcessingManagerAdds aCasConsumerto this CPM.- Specified by:
addCasConsumerin interfaceCollectionProcessingManager- Parameters:
aCasConsumer- aCasConsumerto add- Throws:
ResourceConfigurationException- if this CPM is currently processing
-
removeCasConsumer
public void removeCasConsumer(CasConsumer aCasConsumer)
Description copied from interface:CollectionProcessingManagerRemoves aCasConsumerfrom this CPM.- Specified by:
removeCasConsumerin interfaceCollectionProcessingManager- Parameters:
aCasConsumer- theCasConsumerto remove
-
addStatusCallbackListener
public void addStatusCallbackListener(StatusCallbackListener aListener)
Description copied from interface:CollectionProcessingManagerRegisters a listsner to receive status callbacks.- Specified by:
addStatusCallbackListenerin interfaceCollectionProcessingManager- Parameters:
aListener- the listener to add
-
removeStatusCallbackListener
public void removeStatusCallbackListener(StatusCallbackListener aListener)
Description copied from interface:CollectionProcessingManagerUnregisters a status callback listener.- Specified by:
removeStatusCallbackListenerin interfaceCollectionProcessingManager- Parameters:
aListener- the listener to remove
-
process
public void process(CollectionReader aCollectionReader) throws ResourceInitializationException
Description copied from interface:CollectionProcessingManagerInitiates 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_IllegalStateExceptionwill result. To find out whether a CPM is free to begin another processing request, call theCollectionProcessingManager.isProcessing()method.- Specified by:
processin interfaceCollectionProcessingManager- Parameters:
aCollectionReader- theCollectionReaderfrom 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:CollectionProcessingManagerInitiates 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 theaBatchSizeparameter. EachCasConsumerwill be notified at the end of each batch.- Specified by:
processin interfaceCollectionProcessingManager- Parameters:
aCollectionReader- theCollectionReaderfrom which to obtain the Entities to be processedaBatchSize- the size of the batch.- Throws:
ResourceInitializationException- if an error occurs during initialization
-
-