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 theCasDataProcessorinterface 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 CpeCasProcessorcasProcessorTypeprivate static intDEFAULT_RETRY_COUNTprivate ProcessingResourceMetaDatametadataprivate java.lang.Stringnameprivate ProcessingResourceMetaDataresourceMetadataprivate intretryCountprivate VinciTAPtextAnalysisProxyprivate longtotalTime
-
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 voidbatchProcessComplete(ProcessTrace aTrace)Notifies Network AE that end-of-batch marker has been reached.voidcollectionProcessComplete(ProcessTrace aTrace)This method gets called when the CPM completes processing the collection.private booleandoSendNotification()Determines if CasProcessor wants to be notified when end-of-batch and end-of-processing events happen.ProcessingResourceMetaDatagetProcessingResourceMetaData()Returns Remote AE metadata.VinciTAPgetProxy()Returns proxy to the remote AE servicebooleanisReadOnly()Gets whether this is a read-only CAS Processor, which does not modify the CAS.booleanisStateless()Gets whether this is a stateless CAS Processor.CasDataprocess(CasData aCas)Main method used during analysis.CasData[]process(CasData[] aCasList)Main method used during analysis.voidsetProxy(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:
processin 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:
processin 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:CasProcessorGets whether this is a stateless CAS Processor. Stateless CAS Processors do not maintain any data between calls to their process methods.- Specified by:
isStatelessin interfaceCasProcessor- Returns:
- true if this CAS processor is stateless, false if it is stateful.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:CasProcessorGets whether this is a read-only CAS Processor, which does not modify the CAS.- Specified by:
isReadOnlyin 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:
getProcessingResourceMetaDatain 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:
batchProcessCompletein 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:
collectionProcessCompletein 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
-
-