org.apache.uima.analysis_engine.annotator

## Interface BaseAnnotator

- All Known Subinterfaces:
    GenericAnnotator, JTextAnnotator, TextAnnotator
  All Known Implementing Classes:
    Annotator_ImplBase, GenericAnnotator_ImplBase, JTextAnnotator_ImplBase

      public interface BaseAnnotator

  Base interface for annotators in UIMA SDK v1.x. As of v2.0, annotators should extend `CasAnnotator_ImplBase` or `JCasAnnotator_ImplBase`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()` Frees all resources held by this annotator.
    `void` | `initialize(AnnotatorContext aContext)` Performs any startup tasks required by this annotator.
    `void` | `reconfigure()` Alerts this annotator that the values of its configuration parameters or external resources have changed.
    `void` | `typeSystemInit(TypeSystem aTypeSystem)` Informs this annotator that the CAS TypeSystem has changed.

- - ### Method Detail

    - #### initialize

          void initialize(AnnotatorContext aContext)
                   throws AnnotatorInitializationException,
                          AnnotatorConfigurationException

      Performs any startup tasks required by this annotator. The Analysis Engine calls this method only once, just after an Annotator has been instantiated.

      The Analysis Engine supplies this annotator with a reference to the `AnnotatorContext` that it will use. This annotator should store a reference to its this object for later use.

      Parameters:
        `aContext` - Provides access to external resources that may be used by this annotator. This includes configuration parameters, logging and instrumentation services, and access to external analysis resources.
      Throws:
        `AnnotatorInitializationException` - if the annotator cannot initialize itself.
        `AnnotatorConfigurationException` - if the configuration specified for this annotator is invalid.

    - #### typeSystemInit

          void typeSystemInit(TypeSystem aTypeSystem)
                       throws AnnotatorInitializationException,
                              AnnotatorConfigurationException

      Informs this annotator that the CAS TypeSystem has changed. The Analysis Engine calls this method immediately following the call to `initialize(AnnotatorContext)`, and will call it again whenever the CAS TypeSystem changes.

      In this method, the Annotator should use the `TypeSystem` to resolve the names of Type and Features to the actual `Type` and `Feature` objects, which can then be used during processing.

      Parameters:
        `aTypeSystem` - the new type system
      Throws:
        `AnnotatorInitializationException` - if the annotator cannot initialize itself.
        `AnnotatorConfigurationException` - if the configuration specified for this annotator is invalid.

    - #### reconfigure

          void reconfigure()
                    throws AnnotatorConfigurationException,
                           AnnotatorInitializationException

      Alerts this annotator that the values of its configuration parameters or external resources have changed. This annotator should take appropriate action to reconfigure itself.

      It is suggested that annotators implement this efficiently, but it is not required. Annotators may implement a "dumb" reconfigure by calling `destroy` followed by `initialize` and `typeSystemInit`.

      Throws:
        `AnnotatorConfigurationException` - if the configuration specified for this annotator is invalid.
        `AnnotatorInitializationException` - if the annotator fails to reinitialize itself based on the new configuration.

    - #### destroy

          void destroy()

      Frees all resources held by this annotator. The Analysis Engine calls this method only once, when it is finished using this annotator.

Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.