public class NonThreadedProcessingUnit extends Object
Modifier and Type | Field and Description |
---|---|
protected Object[] |
artifact |
protected CAS[] |
casList |
protected CPECasPool |
casPool |
protected CAS |
conversionCas |
protected CAS[] |
conversionCasArray |
protected CpeConfiguration |
cpeConfiguration |
protected CPMEngine |
cpm |
protected CasConverter |
mConverter |
protected boolean |
notifyListeners |
protected long |
numToProcess |
protected BoundedWorkQueue |
outputQueue |
protected LinkedList |
processContainers |
protected ProcessTrace |
processingUnitProcessTrace |
protected boolean |
relaseCAS |
protected ArrayList |
statusCbL |
protected String |
threadId |
int |
threadState |
protected UimaTimer |
timer |
protected BoundedWorkQueue |
workQueue |
Constructor and Description |
---|
NonThreadedProcessingUnit(CPMEngine acpm) |
NonThreadedProcessingUnit(CPMEngine acpm,
BoundedWorkQueue aInputQueue,
BoundedWorkQueue aOutputQueue)
Initialize the PU
|
Modifier and Type | Method and Description |
---|---|
void |
addStatusCallbackListener(BaseStatusCallbackListener aListener)
Plugs in Listener object used for notifications.
|
protected boolean |
analyze(Object[] aCasObjectList,
ProcessTrace pTrTemp) |
void |
cleanup()
Null out fields of this object.
|
void |
disableCasProcessor(int aCasProcessorIndex)
Disable a CASProcessor in the processing pipeline.
|
void |
disableCasProcessor(String aCasProcessorName)
Alternative method to disable Cas Processor.
|
protected void |
doNotifyListeners(Object aCas,
boolean isCasObject,
EntityProcessStatus aEntityProcStatus)
Notifies all configured listeners.
|
void |
enableCasProcessor(String aCasProcessorName)
Enables Cas Processor with a given name.
|
protected long |
getBytes(Object aCas)
Returns the size of the CAS object.
|
ArrayList |
getCallbackListeners()
Returns list of listeners used by this PU for callbacks.
|
protected boolean |
isProcessorReady(int aStatus)
Check if the CASProcessor status is available for processing
|
protected void |
notifyListeners(Object aCas,
boolean isCasObject,
EntityProcessStatus aEntityProcStatus)
Notifies Listeners of the fact that the pipeline has finished processing the current set Cas'es
|
void |
removeStatusCallbackListener(BaseStatusCallbackListener aListener)
Removes given listener from the list of listeners
|
void |
setCasPool(CPECasPool aPool) |
void |
setContainers(LinkedList processorList)
Plugs in a list of Cas Processor containers.
|
void |
setCPMEngine(CPMEngine acpm)
Alternative method of providing the reference to the component managing the lifecycle of the
CPE
|
void |
setInputQueue(BoundedWorkQueue aInputQueue)
Alternative method of providing a queue from which this PU will read bundle of Cas
|
void |
setNotifyListeners(boolean aDoNotify)
Set a flag indicating if notifications should be made via configured Listeners
|
void |
setOutputQueue(BoundedWorkQueue aOutputQueue)
Alternative method of providing a queue where this PU will deposit results of analysis
|
void |
setProcessingUnitProcessTrace(ProcessTrace aProcessingUnitProcessTrace)
Plugs in ProcessTrace object used to collect statistics
|
void |
setReleaseCASFlag(boolean aFlag) |
void |
setUimaTimer(UimaTimer aTimer)
Plugs in custom timer used by the PU for getting time
|
void |
stopCasProcessors(boolean kill)
Stops all Cas Processors that are part of this PU.
|
public int threadState
protected CPECasPool casPool
protected boolean relaseCAS
protected CPMEngine cpm
protected BoundedWorkQueue workQueue
protected BoundedWorkQueue outputQueue
protected CasConverter mConverter
protected ProcessTrace processingUnitProcessTrace
protected LinkedList processContainers
protected long numToProcess
protected CAS[] casList
protected ArrayList statusCbL
protected boolean notifyListeners
protected CAS conversionCas
protected Object[] artifact
protected CAS[] conversionCasArray
protected UimaTimer timer
protected String threadId
protected CpeConfiguration cpeConfiguration
public NonThreadedProcessingUnit(CPMEngine acpm, BoundedWorkQueue aInputQueue, BoundedWorkQueue aOutputQueue)
acpm
- -
component managing life cycle of the CPEaInputQueue
- -
queue to read fromaOutputQueue
- -
queue to write topublic NonThreadedProcessingUnit(CPMEngine acpm)
public void setInputQueue(BoundedWorkQueue aInputQueue)
aInputQueue
- -
read queuepublic void setOutputQueue(BoundedWorkQueue aOutputQueue)
aOutputQueue
- -
queue to write topublic void setCPMEngine(CPMEngine acpm)
acpm
- -
reference to the contrlling enginepublic void cleanup()
public void setNotifyListeners(boolean aDoNotify)
aDoNotify
- -
true if notification is required, false otherwisepublic void addStatusCallbackListener(BaseStatusCallbackListener aListener)
aListener
- -
BaseStatusCallbackListener
instancepublic ArrayList getCallbackListeners()
BaseStatusCallbackListener
instancespublic void removeStatusCallbackListener(BaseStatusCallbackListener aListener)
aListener
- -
object to remove from the listpublic void setProcessingUnitProcessTrace(ProcessTrace aProcessingUnitProcessTrace)
aProcessingUnitProcessTrace
- -
object to compile statspublic void setUimaTimer(UimaTimer aTimer)
aTimer
- -
custom timer to usepublic void setContainers(LinkedList processorList)
processorList
- CASProcessor to be added to the processing pipelinepublic void disableCasProcessor(int aCasProcessorIndex)
aCasProcessorIndex
- -
location in the pipeline of the Cas Processor to deletepublic void disableCasProcessor(String aCasProcessorName)
aCasProcessorName
- -
a name of the Cas Processor to disablepublic void enableCasProcessor(String aCasProcessorName)
aCasProcessorName
- -
name of the Cas Processor to enableprotected boolean analyze(Object[] aCasObjectList, ProcessTrace pTrTemp) throws Exception
Exception
public void setReleaseCASFlag(boolean aFlag)
aFlag
- public void setCasPool(CPECasPool aPool)
aPool
- protected boolean isProcessorReady(int aStatus)
protected void notifyListeners(Object aCas, boolean isCasObject, EntityProcessStatus aEntityProcStatus)
aCas
- -
object containing an array of OR a single instance of CasisCasObject
- -
true if instance of Cas is of type Cas, false otherwiseaEntityProcStatus
- -
status object that may contain exceptions and traceprotected void doNotifyListeners(Object aCas, boolean isCasObject, EntityProcessStatus aEntityProcStatus)
aCas
- -
Cas to pass to listenerisCasObject
- -
true is Cas is of type CASaEntityProcStatus
- -
status object containing exceptions and trace infoprotected long getBytes(Object aCas)
aCas
- -
Cas to get the size forpublic void stopCasProcessors(boolean kill)
kill
- -
true if CPE has been stopped before finishing processing during external stopCopyright © 2018. All rights reserved.