|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.uima.collection.impl.cpm.BaseCPMImpl
public class BaseCPMImpl
Main thread that launches CPE and manages it. An application interacts with the running CPE via this object. Through an API, an application may start, pause, resume, and stop a CPE.
Field Summary | |
---|---|
CPMThreadGroup |
cpmThreadGroup
|
Fields inherited from interface org.apache.uima.collection.base_cpm.BaseCPM |
---|
DOCUMENT_TEXT_FEATURE, DOCUMENT_TEXT_TYPE |
Constructor Summary | |
---|---|
BaseCPMImpl(java.lang.Boolean mode,
java.lang.String aDescriptor,
ResourceManager aResourceManager)
Parses CPE descriptor |
|
BaseCPMImpl(CpeDescription aDescriptor)
Instantiates and initializes CPE Factory with a given CPE Descriptor and defaults. |
|
BaseCPMImpl(CpeDescription aDescriptor,
ResourceManager aResourceManager,
boolean aDefaultProcessTrace,
java.util.Properties aProps)
Instantiates and initializes CPE Factory responsible for creating individual components that are part of the processing pipeline. |
Method Summary | |
---|---|
void |
addCasProcessor(CasProcessor aCasProcessor)
Adds a CasProcessor to this CPM's list of consumers. |
void |
addCasProcessor(CasProcessor aCasProcessor,
int aIndex)
Adds a CasProcessor to this CPM's list of consumers. |
void |
addStatusCallbackListener(BaseStatusCallbackListener aListener)
Registers a listsner to receive status callbacks. |
void |
asynchStop()
|
void |
buildEventTree(ProcessTraceEvent aEvent,
int aTotalTime)
Helper method to help build the CPM report |
void |
disableCasProcessor(java.lang.String aCasProcessorName)
Disables a CasProcessor in this CPM's list of CasProcessors. |
void |
displayStats(ProcessTrace aProcessTrace,
int aNumDocsProcessed)
Helper method to display stats and totals |
void |
enableCasProcessor(java.lang.String aCasProcessorName)
|
void |
finalizeIt()
Called to cleanup CPE on shutdown |
CasProcessor[] |
getCasProcessors()
Gets the CasProcessors s assigned to this CPM, in the order in which they will
be caleld by the CPM. |
BaseCollectionReader |
getCollectionReader()
Returns a Collection Reader for this CPE. |
CpeConfiguration |
getCPEConfig()
Returns CPEConfig object holding current CPE configuration |
java.lang.String |
getDescriptor(java.util.List aList)
Returns a CPE descriptor as a String |
ProcessTrace |
getPerformanceReport()
Returns PerformanceReport for the CPM. |
Progress[] |
getProgress()
Returns current CPE progress. |
SynchPoint |
getSynchPoint()
Returns a SynchPoint object initialized by the Collection Reader if the Collection
Reader implements RecoverableCollectionReader . |
void |
init(boolean aDummyCasProcessor,
java.util.Properties aProps)
Instantiates and initializes a CPE. |
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 perfoming parallelization). |
void |
kill()
Kills the CPM hard. |
void |
pause()
Pauses processing. |
void |
process()
Initiates processing of a collection. |
void |
process(BaseCollectionReader aCollectionReader)
Deprecated. |
void |
process(BaseCollectionReader aCollectionReader,
int aBatchSize)
Deprecated. |
void |
removeCasProcessor(CasProcessor aCasProcessor)
Removes a CasProcessor 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 |
run()
|
void |
setCollectionReader(BaseCollectionReader aCollectionReader)
Sets the Collection Reader for this CPE. |
void |
setJediiReport(boolean aUseJediiReport)
Sets Jedii-style reporting resources and sets the global flag to indicate what report-style to use at the end of processing. |
void |
setPauseOnException(boolean aPause)
Sets whether this CPM will automatically pause processing if an exception occurs. |
void |
setPerformanceTuningSettings(java.util.Properties aPerformanceTuningSettings)
Plugs in custom perfomance tunning parameters |
void |
setProcessControllerAdapter(ProcessControllerAdapter aPca)
Plugs in a given ProcessControllerAdapter . |
void |
setSerialProcessingRequired(boolean aRequired)
Sets whether this CPM is required to process the collection's elements serially (as opposed to perfoming parallelization). |
void |
stop()
Stops processing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public CPMThreadGroup cpmThreadGroup
Constructor Detail |
---|
public BaseCPMImpl(CpeDescription aDescriptor) throws java.lang.Exception
aDescriptor
- -
parsed CPE descriptor
java.lang.Exception
public BaseCPMImpl(CpeDescription aDescriptor, ResourceManager aResourceManager, boolean aDefaultProcessTrace, java.util.Properties aProps) throws java.lang.Exception
aDescriptor
- -
parsed CPE descriptoraResourceManager
- -
ResourceManager instance to be used by the CPEaDefaultProcessTrace
- -
ProcessTrace instance to capture events and stats
java.lang.Exception
public BaseCPMImpl(java.lang.Boolean mode, java.lang.String aDescriptor, ResourceManager aResourceManager) throws java.lang.Exception
mode
- -
indicates if the CPM should use a static descriptor or one providedaDescriptor
- -
provided descriptor pathaResourceManager
- ResourceManager to be used by CPM
java.lang.Exception
Method Detail |
---|
public void setPerformanceTuningSettings(java.util.Properties aPerformanceTuningSettings)
aPerformanceTuningSettings
- public void setProcessControllerAdapter(ProcessControllerAdapter aPca)
ProcessControllerAdapter
. The CPM uses this adapter to request Cas
Processor restarts and shutdown.
aPca
- -
instance of the ProcessControllerAdapterpublic void setJediiReport(boolean aUseJediiReport)
aUseJediiReport
- public void init(boolean aDummyCasProcessor, java.util.Properties aProps) throws java.lang.Exception
aDummyCasProcessor
- -
java.lang.Exception
public CpeConfiguration getCPEConfig() throws java.lang.Exception
CPEConfig
object holding current CPE configuration
java.lang.Exception
public CasProcessor[] getCasProcessors()
BaseCPM
CasProcessors
s assigned to this CPM, in the order in which they will
be caleld by the CPM.
getCasProcessors
in interface BaseCPM
CasProcessor
spublic void addCasProcessor(CasProcessor aCasProcessor) throws ResourceConfigurationException
BaseCPM
CasProcessor
to this CPM's list of consumers. The new CasProcessor will
be added to the end of the list of CAS Processors.
addCasProcessor
in interface BaseCPM
aCasProcessor
- a CasProcessor
to add
ResourceConfigurationException
public void addCasProcessor(CasProcessor aCasProcessor, int aIndex) throws ResourceConfigurationException
BaseCPM
CasProcessor
to this CPM's list of consumers. The new CasProcessor will
be added at the specified index.
addCasProcessor
in interface BaseCPM
aCasProcessor
- the CasProcessor to addaIndex
- the index at which to add the CasProcessor
ResourceConfigurationException
public void removeCasProcessor(CasProcessor aCasProcessor)
BaseCPM
CasProcessor
to this CPM's list of consumers.
removeCasProcessor
in interface BaseCPM
aCasProcessor
- the CasProcessor
to removepublic void disableCasProcessor(java.lang.String aCasProcessorName)
BaseCPM
CasProcessor
in this CPM's list of CasProcessors.
disableCasProcessor
in interface BaseCPM
aCasProcessorName
- the name of the CasProcessor
to disablepublic void enableCasProcessor(java.lang.String aCasProcessorName)
public boolean isSerialProcessingRequired()
BaseCPM
false
does not guarantee that
parallelization is performed; this is left up to the CPM implementation.
isSerialProcessingRequired
in interface BaseCPM
public void setSerialProcessingRequired(boolean aRequired)
BaseCPM
false
.
Note that a value of false
does not guarantee that parallelization is performed;
this is left up to the CPM implementation.
setSerialProcessingRequired
in interface BaseCPM
aRequired
- true if and only if serial processing is requiredpublic boolean isPauseOnException()
BaseCPM
BaseCPM.resume(boolean)
method.
isPauseOnException
in interface BaseCPM
public void setPauseOnException(boolean aPause)
BaseCPM
BaseCPM.resume(boolean)
method.
setPauseOnException
in interface BaseCPM
aPause
- true if and only if this CPM should pause on exceptionpublic void addStatusCallbackListener(BaseStatusCallbackListener aListener)
BaseCPM
addStatusCallbackListener
in interface BaseCPM
aListener
- the listener to addpublic void removeStatusCallbackListener(BaseStatusCallbackListener aListener)
BaseCPM
removeStatusCallbackListener
in interface BaseCPM
aListener
- the listener to removepublic void run()
run
in interface java.lang.Runnable
public void finalizeIt()
@Deprecated public void process(BaseCollectionReader aCollectionReader) throws ResourceInitializationException
ResourceInitializationException
org.apache.uima.collection.base_cpm.BaseCPM#process(org.apache.uima.collection.base_cpm.BaseCollectionReader)
public void process() throws ResourceInitializationException
BaseCPM
BaseCPM.addStatusCallbackListener(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 the
BaseCPM.isProcessing()
method.
process
in interface BaseCPM
ResourceInitializationException
- if an error occurs during initialization@Deprecated public void process(BaseCollectionReader aCollectionReader, int aBatchSize) throws ResourceInitializationException
ResourceInitializationException
org.apache.uima.collection.base_cpm.BaseCPM#process(org.apache.uima.collection.base_cpm.BaseCollectionReader,
int)
public void setCollectionReader(BaseCollectionReader aCollectionReader)
setCollectionReader
in interface BaseCPM
aCollectionReader
- the collection readerpublic BaseCollectionReader getCollectionReader()
getCollectionReader
in interface BaseCPM
public boolean isProcessing()
BaseCPM
BaseCPM.stop()
ped. If processing is paused,
this method will still return true.
- Specified by:
isProcessing
in interface BaseCPM
- Returns:
- true if and only if this CPM is currently processing.
public void pause()
BaseCPM
BaseCPM.resume(boolean)
method.
pause
in interface BaseCPM
public boolean isPaused()
BaseCPM
isPaused
in interface BaseCPM
public void resume(boolean aRetryFailed)
BaseCPM
resume
in interface BaseCPM
aRetryFailed
- if processing was paused because an exception occurred (see
BaseCPM.setPauseOnException(boolean)
), setting a value of true
for
this parameter will cause the failed entity to be retried. A value of
false
(the default) will cause processing to continue with the next
entity after the failure.public void resume()
BaseCPM
resume
in interface BaseCPM
public void kill()
public void stop()
BaseCPM
stop
in interface BaseCPM
public void asynchStop()
public void displayStats(ProcessTrace aProcessTrace, int aNumDocsProcessed)
aProcessTrace
- -
trace containing statsaNumDocsProcessed
- -
number of entities processed so farpublic void buildEventTree(ProcessTraceEvent aEvent, int aTotalTime)
aEvent
- aTotalTime
- public ProcessTrace getPerformanceReport()
getPerformanceReport
in interface BaseCPM
public Progress[] getProgress()
getProgress
in interface BaseCPM
Progress
objects, each of which represents the progress in a
different set of units (for example number of entities or bytes)public java.lang.String getDescriptor(java.util.List aList) throws ResourceConfigurationException
aList
- -
list of components
ResourceConfigurationException
public SynchPoint getSynchPoint()
SynchPoint
object initialized by the Collection Reader if the Collection
Reader implements RecoverableCollectionReader
. The synchpoint object contains the
current snapshot that includes the last document processed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |