Class NetworkCasProcessorImpl
- java.lang.Object
-
- org.apache.uima.collection.impl.cpm.container.NetworkCasProcessorImpl
-
- All Implemented Interfaces:
CasDataProcessor
,CasProcessor
public class NetworkCasProcessorImpl extends java.lang.Object implements CasDataProcessor
Implementation of theCasDataProcessor
interface used for both Local and Remote CasDataProcessors. The CPE delegates analysis of entities to this instance. Each instance of this class has a proxy to extenal service.
-
-
Field Summary
Fields Modifier and Type Field Description private CpeCasProcessor
casProcessorType
private static int
DEFAULT_RETRY_COUNT
private ProcessingResourceMetaData
metadata
private java.lang.String
name
private ProcessingResourceMetaData
resourceMetadata
private int
retryCount
private VinciTAP
textAnalysisProxy
private long
totalTime
-
Constructor Summary
Constructors Constructor Description NetworkCasProcessorImpl(CpeCasProcessor aCasProcessorType)
Initializes this instance with configuration defined in the CPE descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
batchProcessComplete(ProcessTrace aTrace)
Notifies Network AE that end-of-batch marker has been reached.void
collectionProcessComplete(ProcessTrace aTrace)
This method gets called when the CPM completes processing the collection.private boolean
doSendNotification()
Determines if CasProcessor wants to be notified when end-of-batch and end-of-processing events happen.ProcessingResourceMetaData
getProcessingResourceMetaData()
Returns Remote AE metadata.VinciTAP
getProxy()
Returns proxy to the remote AE serviceboolean
isReadOnly()
Gets whether this is a read-only CAS Processor, which does not modify the CAS.boolean
isStateless()
Gets whether this is a stateless CAS Processor.CasData
process(CasData aCas)
Main method used during analysis.CasData[]
process(CasData[] aCasList)
Main method used during analysis.void
setProxy(VinciTAP aTap)
Associates a proxy to remote annotator service.
-
-
-
Field Detail
-
DEFAULT_RETRY_COUNT
private static final int DEFAULT_RETRY_COUNT
- See Also:
- Constant Field Values
-
name
private java.lang.String name
-
textAnalysisProxy
private VinciTAP textAnalysisProxy
-
casProcessorType
private CpeCasProcessor casProcessorType
-
metadata
private ProcessingResourceMetaData metadata
-
retryCount
private int retryCount
-
totalTime
private long totalTime
-
resourceMetadata
private ProcessingResourceMetaData resourceMetadata
-
-
Constructor Detail
-
NetworkCasProcessorImpl
public NetworkCasProcessorImpl(CpeCasProcessor aCasProcessorType)
Initializes this instance with configuration defined in the CPE descriptor.- Parameters:
aCasProcessorType
- -
-
-
Method Detail
-
setProxy
public void setProxy(VinciTAP aTap)
Associates a proxy to remote annotator service.- Parameters:
aTap
- - proxy to remote service
-
getProxy
public VinciTAP getProxy()
Returns proxy to the remote AE service- Returns:
- - proxy to remote service
-
process
public CasData process(CasData aCas) throws ResourceProcessException
Main method used during analysis. The ProcessingUnit calls this method to initiate analysis of the content in the CasData instance. This handles one Cas at a time processing mode.- Specified by:
process
in interfaceCasDataProcessor
- Parameters:
aCas
- - instance of CasData to analyze- Returns:
- instance containing result of the analysis
- Throws:
ResourceProcessException
- if processing fails
-
process
public CasData[] process(CasData[] aCasList) throws ResourceProcessException
Main method used during analysis. The ProcessingUnit calls this method to initiate analysis of the content in the CasData instance. This handles processing of multiple Cas'es at a time.- Specified by:
process
in interfaceCasDataProcessor
- Parameters:
aCasList
- - array of CasData instances to analyze- Returns:
- CasData - array of CasData instances containing results of the analysis
- Throws:
ResourceProcessException
- if processing fails
-
isStateless
public boolean isStateless()
Description copied from interface:CasProcessor
Gets whether this is a stateless CAS Processor. Stateless CAS Processors do not maintain any data between calls to their process methods.- Specified by:
isStateless
in interfaceCasProcessor
- Returns:
- true if this CAS processor is stateless, false if it is stateful.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:CasProcessor
Gets whether this is a read-only CAS Processor, which does not modify the CAS.- Specified by:
isReadOnly
in interfaceCasProcessor
- Returns:
- true if this CAS processor does not modify the CAS, false if it does.
-
getProcessingResourceMetaData
public ProcessingResourceMetaData getProcessingResourceMetaData()
Returns Remote AE metadata. This method returns the metadata associated with the annotator.- Specified by:
getProcessingResourceMetaData
in interfaceCasProcessor
- Returns:
- an object containing all metadata for this CasProcessor
-
batchProcessComplete
public void batchProcessComplete(ProcessTrace aTrace) throws ResourceProcessException, java.io.IOException
Notifies Network AE that end-of-batch marker has been reached. The notification can be disabled in the Cpe descriptor by setting batch=0 in the <checkpoint> element.- Specified by:
batchProcessComplete
in interfaceCasProcessor
- Parameters:
aTrace
- an object that records information, such as timing, about this method's execution.- Throws:
ResourceProcessException
- if an exception occurs during processingjava.io.IOException
- if an I/O failure occurs- See Also:
CasProcessor.batchProcessComplete(org.apache.uima.util.ProcessTrace)
-
collectionProcessComplete
public void collectionProcessComplete(ProcessTrace aTrace) throws ResourceProcessException, java.io.IOException
This method gets called when the CPM completes processing the collection. Depending on the type of deployment this routine may issue a shutdown command to the service.- Specified by:
collectionProcessComplete
in interfaceCasProcessor
- Parameters:
aTrace
- an object that records information, such as timing, about this method's execution.- Throws:
ResourceProcessException
- if an exception occurs during processingjava.io.IOException
- if an I/O failure occurs- See Also:
CasProcessor.collectionProcessComplete(org.apache.uima.util.ProcessTrace)
-
doSendNotification
private boolean doSendNotification()
Determines if CasProcessor wants to be notified when end-of-batch and end-of-processing events happen.- Returns:
- - true when notification is required, false otherwise
-
-