public interface CollectionProcessingEngine
CollectionProcessingEngine
(CPE) processes a collection of artifacts (for text
analysis applications, this will be a collection of documents) and produces collection-level
results.
A CPE consists of a CollectionReader
, zero or more
AnalysisEngine
s and zero or more
CasConsumer
s. The Collection Reader is responsible for
reading artifacts from a collection and setting up the CAS. The AnalysisEngines analyze each CAS
and the results are passed on to the CAS Consumers. CAS Consumers perform analysis over multiple
CASes and generally produce collection-level results in some application-specific data structure.
Processing is started by calling the process()
method. Processing can be controlled via
thepause()
, resume()
, and stop()
methods.
Listeners can register with the CPE by calling the
addStatusCallbackListener(StatusCallbackListener)
method. These listeners receive status
callbacks during the processing. At any time, performance and progress reports are available from
the getPerformanceReport()
and getProgress()
methods.
A CPE implementation may choose to implement parallelization of the processing, but this is not a requirement of the architecture.
Note that a CPE only supports processing one collection at a time. Attempting to start a new processing job while a previous processing job is running will result in an exception. Processing multiple collections simultaneously is done by instantiating and configuring multiple instances of the CPE.
A CollectionProcessingEngine
instance can be obtained by calling
UIMAFramework.produceCollectionProcessingEngine(CpeDescription)
.
Modifier and Type | Method and Description |
---|---|
void |
addStatusCallbackListener(StatusCallbackListener aListener)
Registers a listener to receive status callbacks.
|
CasProcessor[] |
getCasProcessors()
Gets the
CasProcessors s in this CPE, in the order in which they will be
executed. |
BaseCollectionReader |
getCollectionReader()
Gets the Collection Reader for this CPE.
|
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.
|
void |
initialize(CpeDescription aCpeDescription,
Map<String,Object> aAdditionalParams)
Initializes this CPE from a
cpeDescription Applications do not need to call this
method. |
boolean |
isPaused()
Determines whether this CPE's processing is currently paused.
|
boolean |
isProcessing()
Determines whether this CPE is currently processing.
|
void |
kill()
Kill CPM hard.
|
void |
pause()
Pauses processing.
|
void |
process()
Initiates processing of a collection.
|
void |
removeStatusCallbackListener(StatusCallbackListener aListener)
Unregisters a status callback listener.
|
void |
resume()
Resumes processing that has been paused.
|
void |
stop()
Stops processing.
|
void initialize(CpeDescription aCpeDescription, Map<String,Object> aAdditionalParams) throws ResourceInitializationException
cpeDescription
Applications do not need to call this
method. It is called automatically by the framework and cannot be called a second time.aCpeDescription
- CPE description, generally parsed from an XML fileaAdditionalParams
- a Map containing additional parameters. May be null
if there are no
parameters. Each class that implements this interface can decide what additional
parameters it supports.ResourceInitializationException
- if a failure occurs during initialization.UIMA_IllegalStateException
- if this method is called more than once on a single instance.void addStatusCallbackListener(StatusCallbackListener aListener)
aListener
- the listener to addvoid removeStatusCallbackListener(StatusCallbackListener aListener)
aListener
- the listener to removevoid process() throws ResourceInitializationException
addStatusCallbackListener(StatusCallbackListener)
method.
A CPE 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 CPE is free to begin another processing request, call the
isProcessing()
method.
ResourceInitializationException
- if an error occurs during initializationUIMA_IllegalStateException
- if this CPE is currently processingboolean isProcessing()
stop()
ped. If processing is paused,
this method will still return true
.void pause()
resume()
method.UIMA_IllegalStateException
- if no processing is currently occuringboolean isPaused()
void resume()
UIMA_IllegalStateException
- if processing is not currently pausedvoid stop()
UIMA_IllegalStateException
- if no processing is currently occuringProcessTrace getPerformanceReport()
Progress[] getProgress()
Progress
objects, each of which represents the progress in a
different set of units (for example number of entities or bytes)BaseCollectionReader getCollectionReader()
CasProcessor[] getCasProcessors()
CasProcessors
s in this CPE, in the order in which they will be
executed.CasProcessor
svoid kill()
Copyright © 2006–2017 The Apache Software Foundation. All rights reserved.