org.apache.uima.examples.cpe
Class AnnotationPrinter
java.lang.Object
org.apache.uima.resource.Resource_ImplBase
org.apache.uima.resource.ConfigurableResource_ImplBase
org.apache.uima.collection.CasConsumer_ImplBase
org.apache.uima.examples.cpe.AnnotationPrinter
- All Implemented Interfaces:
- CasObjectProcessor, CasProcessor, CasConsumer, ConfigurableResource, Resource
public class AnnotationPrinter
- extends CasConsumer_ImplBase
- implements CasObjectProcessor
An example of CAS Consumer.
AnnotationPrinter prints to an output file all annotations in the CAS.
Parameters needed by the AnnotationPrinter are
- "outputFile" : file to which the output files should be written.
These parameters are set in the initialize method to the values specified in the descriptor file.
These may also be set by the application by using the setConfigParameterValue methods.
Method Summary |
void |
batchProcessComplete(ProcessTrace aTrace)
Called when a batch of processing is completed. |
void |
collectionProcessComplete(ProcessTrace aTrace)
Called when the entire collection is completed. |
void |
destroy()
Called if clean up is needed in case of exit under error conditions. |
void |
initialize()
Initializes this CAS Consumer with the parameters specified in the descriptor. |
void |
processCas(CAS aCAS)
Processes the CasContainer which was populated by the TextAnalysisEngines. |
void |
reconfigure()
Reconfigures the parameters of this Consumer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnnotationPrinter
public AnnotationPrinter()
initialize
public void initialize()
throws ResourceInitializationException
- Initializes this CAS Consumer with the parameters specified in the descriptor.
- Overrides:
initialize
in class CasConsumer_ImplBase
- Throws:
ResourceInitializationException
- if there is error in initializing the resources
processCas
public void processCas(CAS aCAS)
throws ResourceProcessException
- Processes the CasContainer which was populated by the TextAnalysisEngines.
In this case, the CAS index is iterated over selected annotations and printed out into an
output file
- Specified by:
processCas
in interface CasObjectProcessor
- Parameters:
aCAS
- CasContainer which has been populated by the TAEs
- Throws:
ResourceProcessException
- if there is an error in processing the Resource- See Also:
CasObjectProcessor.processCas(CAS)
batchProcessComplete
public void batchProcessComplete(ProcessTrace aTrace)
throws ResourceProcessException,
java.io.IOException
- Called when a batch of processing is completed.
- Specified by:
batchProcessComplete
in interface CasProcessor
- Overrides:
batchProcessComplete
in class CasConsumer_ImplBase
- Parameters:
aTrace
- ProcessTrace object that will log events in this method.
- Throws:
ResourceProcessException
- if there is an error in processing the Resource
java.io.IOException
- if there is an IO Error- See Also:
CasProcessor.batchProcessComplete(ProcessTrace)
collectionProcessComplete
public void collectionProcessComplete(ProcessTrace aTrace)
throws ResourceProcessException,
java.io.IOException
- Called when the entire collection is completed.
- Specified by:
collectionProcessComplete
in interface CasProcessor
- Overrides:
collectionProcessComplete
in class CasConsumer_ImplBase
- Parameters:
aTrace
- ProcessTrace object that will log events in this method.
- Throws:
ResourceProcessException
- if there is an error in processing the Resource
java.io.IOException
- if there is an IO Error- See Also:
CasProcessor.collectionProcessComplete(ProcessTrace)
reconfigure
public void reconfigure()
throws ResourceConfigurationException
- Reconfigures the parameters of this Consumer.
This is used in conjunction with the setConfigurationParameterValue to set the configuration
parameter values to values other than the ones specified in the descriptor.
- Specified by:
reconfigure
in interface ConfigurableResource
- Overrides:
reconfigure
in class CasConsumer_ImplBase
- Throws:
ResourceConfigurationException
- if the configuration parameter settings are invalid- See Also:
ConfigurableResource.reconfigure()
destroy
public void destroy()
- Called if clean up is needed in case of exit under error conditions.
- Specified by:
destroy
in interface Resource
- Overrides:
destroy
in class CasConsumer_ImplBase
- See Also:
Resource.destroy()
Copyright © 2010 The Apache Software Foundation. All Rights Reserved.