Interface BaseCPM
-
- All Known Implementing Classes:
BaseCPMImpl
,CPMImpl
public interface BaseCPM
The Base CPM interface is a lower-level interface to the Collection Processing Manager. It is recommended that developers use theCollectionProcessingEngine
andCpeDescription
interfaces instead.The CPM is configured with a list of
CasProcessor
s by calling itsaddCasProcessor(CasProcessor)
method. A singleBaseCollectionReader
must be provided, via thesetCollectionReader(BaseCollectionReader)
method. Collection processing is then initiated by calling theprocess()
method.Listeners can register with the CPM by calling the
addStatusCallbackListener(BaseStatusCallbackListener)
method. These listeners receive status callbacks during the processing. At any time, performance and progress reports are available from thegetPerformanceReport()
andgetProgress()
methods.A CPM implementation may choose to implement parallelization of the processing, but this is not a requirement of the architecture.
Note that a CPM only supports processing one collection at a time. Attempting to reconfigure a CPM or start a new processing job while a previous processing job is occurring will result in a
UIMA_IllegalStateException
. Processing multiple collections simultaneously is done by instantiating and configuring multiple instances of the CPM.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DOCUMENT_TEXT_FEATURE
Only used for alternate CasData forms of the CAS (not used in this UIMA SDK release).static String
DOCUMENT_TEXT_TYPE
Only used for alternate CasData forms of the CAS (not used in this UIMA SDK release).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addCasProcessor(CasProcessor aCasProcessor)
Adds aCasProcessor
to this CPM's list of consumers.void
addCasProcessor(CasProcessor aCasProcessor, int aIndex)
Adds aCasProcessor
to this CPM's list of consumers.void
addStatusCallbackListener(BaseStatusCallbackListener aListener)
Registers a listsner to receive status callbacks.void
disableCasProcessor(String aCasProcessorName)
Disables aCasProcessor
in this CPM's list of CasProcessors.CasProcessor[]
getCasProcessors()
Gets theCasProcessors
s assigned to this CPM, in the order in which they will be called by the CPM.BaseCollectionReader
getCollectionReader()
Gets the Collection Reader for this CPM.ProcessTrace
getPerformanceReport()
Gets a performance report for the processing that is currently occurring or has just completed.Progress[]
getProgress()
Gets a progress report for the processing that is currently occurring or has just completed.boolean
isPaused()
Determines whether this CPM's processing is currently paused.boolean
isPauseOnException()
Gets whether this CPM will automatically pause processing if an exception occurs.boolean
isProcessing()
Determines whether this CPM is currently processing.boolean
isSerialProcessingRequired()
Gets whether this CPM is required to process the collection's elements serially (as opposed to performing parallelization).void
pause()
Pauses processing.void
process()
Initiates processing of a collection.void
removeCasProcessor(CasProcessor aCasProcessor)
Removes aCasProcessor
to this CPM's list of consumers.void
removeStatusCallbackListener(BaseStatusCallbackListener aListener)
Unregisters a status callback listener.void
resume()
Resumes processing that has been paused.void
resume(boolean aRetryFailed)
Resumes processing that has been paused.void
setCollectionReader(BaseCollectionReader aCollectionReader)
Sets the Collection Reader for this CPM.void
setPauseOnException(boolean aPause)
Sets whether this CPM will automatically pause processing if an exception occurs.void
setSerialProcessingRequired(boolean aRequired)
Sets whether this CPM is required to process the collection's elements serially (as opposed to performing parallelization).void
stop()
Stops processing.
-
-
-
Field Detail
-
DOCUMENT_TEXT_TYPE
static final String DOCUMENT_TEXT_TYPE
Only used for alternate CasData forms of the CAS (not used in this UIMA SDK release). Name of CasData CAS type that holds document text. When creating CasData forms of the CAS, a feature structure of this type must be created by the collection reader.- See Also:
- Constant Field Values
-
DOCUMENT_TEXT_FEATURE
static final String DOCUMENT_TEXT_FEATURE
Only used for alternate CasData forms of the CAS (not used in this UIMA SDK release). Name of CAS feature (on DOCUMENT_TEXT_TYPE feature structure) that holds document text. When creating CasDta forms of the CAS, this feature must be set by the collection reader.- See Also:
- Constant Field Values
-
-
Method Detail
-
getCollectionReader
BaseCollectionReader getCollectionReader()
Gets the Collection Reader for this CPM.- Returns:
- the collection reader
-
setCollectionReader
void setCollectionReader(BaseCollectionReader aCollectionReader)
Sets the Collection Reader for this CPM.- Parameters:
aCollectionReader
- the collection reader
-
getCasProcessors
CasProcessor[] getCasProcessors()
Gets theCasProcessors
s assigned to this CPM, in the order in which they will be called by the CPM.- Returns:
- an array of
CasProcessor
s
-
addCasProcessor
void addCasProcessor(CasProcessor aCasProcessor) throws ResourceConfigurationException
Adds aCasProcessor
to this CPM's list of consumers. The new CasProcessor will be added to the end of the list of CAS Processors.- Parameters:
aCasProcessor
- aCasProcessor
to add- Throws:
ResourceConfigurationException
- if this CPM is currently processing
-
addCasProcessor
void addCasProcessor(CasProcessor aCasProcessor, int aIndex) throws ResourceConfigurationException
Adds aCasProcessor
to this CPM's list of consumers. The new CasProcessor will be added at the specified index.- Parameters:
aCasProcessor
- the CasProcessor to addaIndex
- the index at which to add the CasProcessor- Throws:
ResourceConfigurationException
- if this CPM is currently processing
-
removeCasProcessor
void removeCasProcessor(CasProcessor aCasProcessor)
Removes aCasProcessor
to this CPM's list of consumers.- Parameters:
aCasProcessor
- theCasProcessor
to remove
-
disableCasProcessor
void disableCasProcessor(String aCasProcessorName)
Disables aCasProcessor
in this CPM's list of CasProcessors.- Parameters:
aCasProcessorName
- the name of theCasProcessor
to disable
-
isSerialProcessingRequired
boolean isSerialProcessingRequired()
Gets whether this CPM is required to process the collection's elements serially (as opposed to performing parallelization). Note that a value offalse
does not guarantee that parallelization is performed; this is left up to the CPM implementation.- Returns:
- true if and only if serial processing is required
-
setSerialProcessingRequired
void setSerialProcessingRequired(boolean aRequired)
Sets whether this CPM is required to process the collection's elements serially (as opposed to performing parallelization). If this method is not called, the default isfalse
. Note that a value offalse
does not guarantee that parallelization is performed; this is left up to the CPM implementation.- Parameters:
aRequired
- true if and only if serial processing is required
-
isPauseOnException
boolean isPauseOnException()
Gets whether this CPM will automatically pause processing if an exception occurs. If processing is paused it can be resumed by calling theresume(boolean)
method.- Returns:
- true if and only if this CPM will pause on exception
-
setPauseOnException
void setPauseOnException(boolean aPause)
Sets whether this CPM will automatically pause processing if an exception occurs. If processing is paused it can be resumed by calling theresume(boolean)
method.- Parameters:
aPause
- true if and only if this CPM should pause on exception
-
addStatusCallbackListener
void addStatusCallbackListener(BaseStatusCallbackListener aListener)
Registers a listsner to receive status callbacks.- Parameters:
aListener
- the listener to add
-
removeStatusCallbackListener
void removeStatusCallbackListener(BaseStatusCallbackListener aListener)
Unregisters a status callback listener.- Parameters:
aListener
- the listener to remove
-
process
void process() throws ResourceInitializationException
Initiates processing of a collection. This method starts the processing in another thread and returns immediately. Status of the processing can be obtained by registering a listener with theaddStatusCallbackListener(BaseStatusCallbackListener)
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 theisProcessing()
method.- Throws:
ResourceInitializationException
- if an error occurs during initialization
-
isProcessing
boolean isProcessing()
Determines whether this CPM is currently processing. This means that a processing request has been submitted and has not yet completed or beenstop()
ped. If processing is paused, this method will still returntrue
.- Returns:
- true if and only if this CPM is currently processing.
-
pause
void pause()
Pauses processing. Processing can later be resumed by calling theresume(boolean)
method.
-
isPaused
boolean isPaused()
Determines whether this CPM's processing is currently paused.- Returns:
- true if and only if this CPM's processing is currently paused.
-
resume
void resume(boolean aRetryFailed)
Resumes processing that has been paused.- Parameters:
aRetryFailed
- if processing was paused because an exception occurred (seesetPauseOnException(boolean)
), setting a value oftrue
for this parameter will cause the failed entity to be retried. A value offalse
(the default) will cause processing to continue with the next entity after the failure.
-
resume
void resume()
Resumes processing that has been paused.
-
stop
void stop()
Stops processing.
-
getPerformanceReport
ProcessTrace getPerformanceReport()
Gets a performance report for the processing that is currently occurring or has just completed.- Returns:
- an object containing performance statistics
-
getProgress
Progress[] getProgress()
Gets a progress report for the processing that is currently occurring or has just completed.- Returns:
- an array of
Progress
objects, each of which represents the progress in a different set of units (for example number of entities or bytes)
-
-