Class NonThreadedProcessingUnit
java.lang.Object
org.apache.uima.collection.impl.cpm.engine.NonThreadedProcessingUnit
The Class NonThreadedProcessingUnit.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Object[]The artifact.protected CAS[]The cas list.protected CPECasPoolThe cas pool.protected CASThe conversion cas.protected CAS[]The conversion cas array.protected CpeConfigurationThe cpe configuration.protected CPMEngineThe cpm.protected CasConverterThe m converter.protected booleanThe notify listeners.protected longThe num to process.protected BoundedWorkQueueThe output queue.protected LinkedListThe process containers.protected ProcessTraceThe processing unit process trace.protected booleanThe relase CAS.protected ArrayListThe status cb L.protected StringThe thread id.intThe thread state.protected UimaTimerThe timer.protected BoundedWorkQueueThe work queue. -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new non threaded processing unit.NonThreadedProcessingUnit(CPMEngine acpm, BoundedWorkQueue aInputQueue, BoundedWorkQueue aOutputQueue) Initialize the PU. -
Method Summary
Modifier and TypeMethodDescriptionvoidPlugs in Listener object used for notifications.protected booleananalyze(Object[] aCasObjectList, ProcessTrace pTrTemp) Analyze.voidcleanup()Null out fields of this object.voiddisableCasProcessor(int aCasProcessorIndex) Disable a CASProcessor in the processing pipeline.voiddisableCasProcessor(String aCasProcessorName) Alternative method to disable Cas Processor.protected voiddoNotifyListeners(Object aCas, boolean isCasObject, EntityProcessStatus aEntityProcStatus) Notifies all configured listeners.voidenableCasProcessor(String aCasProcessorName) Enables Cas Processor with a given name.protected longReturns the size of the CAS object.Returns list of listeners used by this PU for callbacks.protected booleanisProcessorReady(int aStatus) Check if the CASProcessor status is available for processing.protected voidnotifyListeners(Object aCas, boolean isCasObject, EntityProcessStatus aEntityProcStatus) Notifies Listeners of the fact that the pipeline has finished processing the current set Cas'es.voidRemoves given listener from the list of listeners.voidsetCasPool(CPECasPool aPool) Sets the cas pool.voidsetContainers(LinkedList processorList) Plugs in a list of Cas Processor containers.voidsetCPMEngine(CPMEngine acpm) Alternative method of providing the reference to the component managing the lifecycle of the CPE.voidsetInputQueue(BoundedWorkQueue aInputQueue) Alternative method of providing a queue from which this PU will read bundle of Cas.voidsetNotifyListeners(boolean aDoNotify) Set a flag indicating if notifications should be made via configured Listeners.voidsetOutputQueue(BoundedWorkQueue aOutputQueue) Alternative method of providing a queue where this PU will deposit results of analysis.voidsetProcessingUnitProcessTrace(ProcessTrace aProcessingUnitProcessTrace) Plugs in ProcessTrace object used to collect statistics.voidsetReleaseCASFlag(boolean aFlag) Sets the release CAS flag.voidsetUimaTimer(UimaTimer aTimer) Plugs in custom timer used by the PU for getting time.voidstopCasProcessors(boolean kill) Stops all Cas Processors that are part of this PU.
-
Field Details
-
threadState
public int threadStateThe thread state. -
casPool
The cas pool. -
relaseCAS
protected boolean relaseCASThe relase CAS. -
cpm
The cpm. -
workQueue
The work queue. -
outputQueue
The output queue. -
mConverter
The m converter. -
processingUnitProcessTrace
The processing unit process trace. -
processContainers
The process containers. -
numToProcess
protected long numToProcessThe num to process. -
casList
The cas list. -
statusCbL
The status cb L. -
notifyListeners
protected boolean notifyListenersThe notify listeners. -
conversionCas
The conversion cas. -
artifact
The artifact. -
conversionCasArray
The conversion cas array. -
timer
The timer. -
threadId
The thread id. -
cpeConfiguration
The cpe configuration.
-
-
Constructor Details
-
NonThreadedProcessingUnit
public NonThreadedProcessingUnit(CPMEngine acpm, BoundedWorkQueue aInputQueue, BoundedWorkQueue aOutputQueue) Initialize the PU.- Parameters:
acpm- - component managing life cycle of the CPEaInputQueue- - queue to read fromaOutputQueue- - queue to write to
-
NonThreadedProcessingUnit
Instantiates a new non threaded processing unit.- Parameters:
acpm- the acpm
-
-
Method Details
-
setInputQueue
Alternative method of providing a queue from which this PU will read bundle of Cas.- Parameters:
aInputQueue- - read queue
-
setOutputQueue
Alternative method of providing a queue where this PU will deposit results of analysis.- Parameters:
aOutputQueue- - queue to write to
-
setCPMEngine
Alternative method of providing the reference to the component managing the lifecycle of the CPE.- Parameters:
acpm- - reference to the contrlling engine
-
cleanup
public void cleanup()Null out fields of this object. Call this only when this object is no longer needed. -
setNotifyListeners
public void setNotifyListeners(boolean aDoNotify) Set a flag indicating if notifications should be made via configured Listeners.- Parameters:
aDoNotify- - true if notification is required, false otherwise
-
addStatusCallbackListener
Plugs in Listener object used for notifications.- Parameters:
aListener- -BaseStatusCallbackListenerinstance
-
getCallbackListeners
Returns list of listeners used by this PU for callbacks.- Returns:
- - lif of
BaseStatusCallbackListenerinstances
-
removeStatusCallbackListener
Removes given listener from the list of listeners.- Parameters:
aListener- - object to remove from the list
-
setProcessingUnitProcessTrace
Plugs in ProcessTrace object used to collect statistics.- Parameters:
aProcessingUnitProcessTrace- - object to compile stats
-
setUimaTimer
Plugs in custom timer used by the PU for getting time.- Parameters:
aTimer- - custom timer to use
-
setContainers
Plugs in a list of Cas Processor containers. During processing Cas Processors in this list are called sequentially. Each Cas Processor is contained in the container that is managing errors, counts and totals, and restarts.- Parameters:
processorList- CASProcessor to be added to the processing pipeline
-
disableCasProcessor
public void disableCasProcessor(int aCasProcessorIndex) Disable a CASProcessor in the processing pipeline. Locate it by provided index. The disabled Cas Processor remains in the Processing Pipeline, however it is not used furing processing.- Parameters:
aCasProcessorIndex- - location in the pipeline of the Cas Processor to delete
-
disableCasProcessor
Alternative method to disable Cas Processor. Uses a name to locate it.- Parameters:
aCasProcessorName- - a name of the Cas Processor to disable
-
enableCasProcessor
Enables Cas Processor with a given name. Enabled Cas Processor will immediately begin to receive bundles of Cas.- Parameters:
aCasProcessorName- - name of the Cas Processor to enable
-
analyze
Analyze.- Parameters:
aCasObjectList- the a cas object listpTrTemp- the tr temp- Returns:
- true, if successful
- Throws:
Exception- the exception
-
setReleaseCASFlag
public void setReleaseCASFlag(boolean aFlag) Sets the release CAS flag.- Parameters:
aFlag- the new release CAS flag
-
setCasPool
Sets the cas pool.- Parameters:
aPool- the new cas pool
-
isProcessorReady
protected boolean isProcessorReady(int aStatus) Check if the CASProcessor status is available for processing.- Parameters:
aStatus- the a status- Returns:
- true, if is processor ready
-
notifyListeners
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.- Parameters:
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 trace
-
doNotifyListeners
protected void doNotifyListeners(Object aCas, boolean isCasObject, EntityProcessStatus aEntityProcStatus) Notifies all configured listeners. Makes sure that appropriate type of Cas is sent to the listener. Convertions take place to ensure compatibility.- Parameters:
aCas- - Cas to pass to listenerisCasObject- - true is Cas is of type CASaEntityProcStatus- - status object containing exceptions and trace info
-
getBytes
Returns the size of the CAS object. Currently only CASData is supported.- Parameters:
aCas- - Cas to get the size for- Returns:
- the size of the CAS object. Currently only CASData is supported.
-
stopCasProcessors
public void stopCasProcessors(boolean kill) Stops all Cas Processors that are part of this PU.- Parameters:
kill- - true if CPE has been stopped before finishing processing during external stop
-