org.apache.uima.examples.cpe
Class AnnotationPrinter

java.lang.Object
  extended by org.apache.uima.resource.Resource_ImplBase
      extended by org.apache.uima.resource.ConfigurableResource_ImplBase
          extended by org.apache.uima.collection.CasConsumer_ImplBase
              extended by 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

  1. "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.


Field Summary
 
Fields inherited from interface org.apache.uima.resource.Resource
PARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_MANAGER, PARAM_CONFIG_PARAM_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT
 
Constructor Summary
AnnotationPrinter()
           
 
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 org.apache.uima.collection.CasConsumer_ImplBase
getProcessingResourceMetaData, initialize, isReadOnly, isStateless, processCas, typeSystemInit
 
Methods inherited from class org.apache.uima.resource.ConfigurableResource_ImplBase
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
 
Methods inherited from class org.apache.uima.resource.Resource_ImplBase
getCasManager, getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger, setMetaData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.uima.collection.base_cpm.CasObjectProcessor
processCas, typeSystemInit
 
Methods inherited from interface org.apache.uima.collection.base_cpm.CasProcessor
getProcessingResourceMetaData, isReadOnly, isStateless
 
Methods inherited from interface org.apache.uima.resource.ConfigurableResource
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
 
Methods inherited from interface org.apache.uima.resource.Resource
getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger
 

Constructor Detail

AnnotationPrinter

public AnnotationPrinter()
Method Detail

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 © 2012. All Rights Reserved.