public abstract class BaseListener
extends org.apache.uima.aae.client.UimaAsBaseCallbackListener
Modifier and Type | Field and Description |
---|---|
protected String[] |
annotationTypeFilter
the annotation types to filter on.
|
protected CSI |
docInfo
CSI annotation for the document being processed in an
entityProcessComplete event.
|
protected boolean |
exitOnError
Flag to indicate whether or not entityProcessComplete processing should
terminate when exceptions are received from the service.
|
protected String[] |
inputType
The list of input types to save to the database.
|
protected String |
lastException
Exceptions Received from service via entityProcessComplete event.
|
protected org.apache.log4j.Logger |
LOG
Logging object of output.
|
protected boolean |
logErrors
If true, the base listener will log errors via log4j.
|
protected File |
mOutputDir
Output Directory for this gov.va.vinci.leo.listener output if required.
|
protected int |
numReceived
Number of CAS objects returned from the pipeline.
|
protected int |
numSent
Number of CAS objects sent to the service for processing.
|
protected String |
previousReferenceId
Use to work around a bug in 2.4.2 where UIMA calls the onBeforeMessageSend one extra time
on the last document.
|
protected String |
referenceID
ID of the document received in an entityProcessComplete event.
|
Constructor and Description |
---|
BaseListener()
Default Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkForError(org.apache.uima.cas.CAS aCas,
org.apache.uima.collection.EntityProcessStatus aStatus)
Check for an error in the return status of the processed CAS.
|
void |
collectionProcessComplete(org.apache.uima.collection.EntityProcessStatus aStatus) |
void |
entityProcessComplete(org.apache.uima.cas.CAS aCas,
org.apache.uima.collection.EntityProcessStatus aStatus) |
boolean |
entityProcessError()
Return true if an exception was received from the service when the
entityProcessComplete event was thrown.
|
String[] |
getAnnotationTypeFilter()
gets the list of annotation types to be filtered on.
|
String[] |
getInputType()
Get the array of input type names this listener will use.
|
protected List<String> |
getInputTypesList(org.apache.uima.cas.CAS cas) |
int |
getNumReceived()
Return the number of CAS objects that were returned by the service.
|
int |
getNumSent()
The number of CAS objects sent to the service.
|
File |
getOutputDir()
Return the output directory File object for this listener.
|
protected String |
getReferenceLocation(org.apache.uima.jcas.JCas jcas)
Return the document ID based on the CSI or SourceDocumentInformation
objects.
|
protected boolean |
hasAnnotationsToProcess(org.apache.uima.cas.CAS aCas)
See if the cas has any annotations of the input type (if input types are specified).
|
boolean |
hasFilteredAnnotation(org.apache.uima.cas.CAS aCas)
See if the CAS has ANY annotations of the types specified in annotationTypeFilter.
|
void |
initializationComplete(org.apache.uima.collection.EntityProcessStatus aStatus)
Called once client initialization is complete.
|
boolean |
isExitOnError()
If true then the listener will exit the entityProcessComplete event when an error occurs.
|
boolean |
isLogErrors()
If true, when the service returns an error status, it is logged via log4j.
|
void |
onBeforeMessageSend(org.apache.uima.aae.client.UimaASProcessStatus status)
Called before sending a CAS to the pipeline, If we were timing each CAS individually this is where
we would want to capture individual start times.
|
<T extends BaseListener> |
setAnnotationTypeFilter(String... annotationTypeFilter)
Sets a list of annotation types.
|
<T extends BaseListener> |
setExitOnError(boolean exitOnError)
Set the flag that if true will cause the entityProcessComplete method to return when an error occurs.
|
<T extends BaseListener> |
setInputType(String... inputType)
Set the array of input type names.
|
void |
setLogErrors(boolean logErrors)
Set whether or not to log errors to log4j.
|
<T extends BaseListener> |
setOutputDir(File mOutputDir)
Set the output directory for this listener.
|
protected String[] inputType
protected File mOutputDir
protected int numReceived
protected int numSent
protected boolean exitOnError
protected String lastException
protected String referenceID
protected CSI docInfo
protected org.apache.log4j.Logger LOG
protected boolean logErrors
protected String[] annotationTypeFilter
protected String previousReferenceId
public void initializationComplete(org.apache.uima.collection.EntityProcessStatus aStatus)
initializationComplete
in interface org.apache.uima.aae.client.UimaASStatusCallbackListener
initializationComplete
in class org.apache.uima.aae.client.UimaAsBaseCallbackListener
aStatus
- the status of the processing.UimaAsBaseCallbackListener.initializationComplete(org.apache.uima.collection.EntityProcessStatus)
public void onBeforeMessageSend(org.apache.uima.aae.client.UimaASProcessStatus status)
onBeforeMessageSend
in class org.apache.uima.aae.client.UimaAsBaseCallbackListener
status
- the status of the processing.UimaAsBaseCallbackListener.onBeforeMessageSend(org.apache.uima.aae.client.UimaASProcessStatus)
public void entityProcessComplete(org.apache.uima.cas.CAS aCas, org.apache.uima.collection.EntityProcessStatus aStatus)
entityProcessComplete
in interface org.apache.uima.aae.client.UimaASStatusCallbackListener
entityProcessComplete
in class org.apache.uima.aae.client.UimaAsBaseCallbackListener
aCas
- the CAS containing the processed entity and the analysis resultsaStatus
- the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.UimaAsBaseCallbackListener.entityProcessComplete(org.apache.uima.cas.CAS, org.apache.uima.collection.EntityProcessStatus)
public void collectionProcessComplete(org.apache.uima.collection.EntityProcessStatus aStatus)
collectionProcessComplete
in interface org.apache.uima.aae.client.UimaASStatusCallbackListener
collectionProcessComplete
in class org.apache.uima.aae.client.UimaAsBaseCallbackListener
aStatus
- the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.UimaAsBaseCallbackListener.collectionProcessComplete(org.apache.uima.collection.EntityProcessStatus)
public File getOutputDir()
public <T extends BaseListener> T setOutputDir(File mOutputDir)
mOutputDir
- output directorypublic int getNumSent()
public int getNumReceived()
public boolean isExitOnError()
public <T extends BaseListener> T setExitOnError(boolean exitOnError)
exitOnError
- value to set.public String[] getInputType()
public <T extends BaseListener> T setInputType(String... inputType)
inputType
- input type name(s)public boolean entityProcessError()
protected String getReferenceLocation(org.apache.uima.jcas.JCas jcas)
jcas
- JCas object where the annotations are storedpublic boolean hasFilteredAnnotation(org.apache.uima.cas.CAS aCas)
aCas
- the CAS to checkprotected boolean checkForError(org.apache.uima.cas.CAS aCas, org.apache.uima.collection.EntityProcessStatus aStatus)
aCas
- CAS that was processedaStatus
- Status object that contains the exception if one is thrownpublic String[] getAnnotationTypeFilter()
public <T extends BaseListener> T setAnnotationTypeFilter(String... annotationTypeFilter)
annotationTypeFilter
- a list of annotation types. Type is the string name, ie: gov.va.vinci.uima.type.Tokenpublic boolean isLogErrors()
public void setLogErrors(boolean logErrors)
protected boolean hasAnnotationsToProcess(org.apache.uima.cas.CAS aCas)
aCas
- the CAS to checkCopyright © 2018 Department of Veterans Affairs. All Rights Reserved.