org.apache.uima.analysis_component

## Class AnalysisComponent_ImplBase

- java.lang.Object
- - org.apache.uima.analysis_component.AnalysisComponent_ImplBase

- All Implemented Interfaces:
    AnalysisComponent
  Direct Known Subclasses:
    Annotator_ImplBase, CasMultiplier_ImplBase, JCasMultiplier_ImplBase, UimacppAnalysisComponent

      public abstract class AnalysisComponent_ImplBase
      extends Object
      implements AnalysisComponent

  Implementation base class for AnalysisComponents. Normally developers do not extend this class directly. Instead extend one of the Annotator or CasMultiplier base classes.

  This class implements the `initialize(UimaContext)` method and stores the `UimaContext` in a private field where it can be accessed via the `getContext()` method.

  This class also provides a "dumb" implementation of the `reconfigure()` method, which simply calls `destroy()` followed by `initialize(UimaContext)`. Developers of AnalysisComponents with expensive initialization logic should override this method and provide a more intelligent implementation.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnalysisComponent_ImplBase()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `batchProcessComplete()` Completes the processing of a batch of CASes.
    `void` | `collectionProcessComplete()` Notifies this AnalysisComponent that processing of an entire collection has been completed.
    `void` | `destroy()` Frees all resources held by this AnalysisComponent.
    `protected UimaContext` | `getContext()` Gets the UimaContext for this AnalysisComponent.
    `protected ResultSpecification` | `getResultSpecification()` Gets the ResultSpecification for this AnalysisComponent.
    `void` | `initialize(UimaContext aContext)` Performs any startup tasks required by this component.
    `void` | `reconfigure()` Notifies this AnalysisComponent that its configuration parameters have changed.
    `void` | `setResultSpecification(ResultSpecification aResultSpec)` Sets the Result Specification for this Analysis Component.

    - ### 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.analysis_component.AnalysisComponent

      `getCasInstancesRequired, getRequiredCasInterface, hasNext, next, process`

- - ### Constructor Detail

    - #### AnalysisComponent_ImplBase

          public AnalysisComponent_ImplBase()

  - ### Method Detail

    - #### initialize

          public void initialize(UimaContext aContext)
                          throws ResourceInitializationException

      Description copied from interface: `AnalysisComponent`
      Performs any startup tasks required by this component. The framework calls this method only once, just after the AnalysisComponent has been instantiated.

      The framework supplies this AnalysisComponent with a reference to the `UimaContext` that it will use, for example to access configuration settings or resources. This AnalysisComponent should store a reference to its the `UimaContext` for later use.

      Specified by:
        `initialize` in interface `AnalysisComponent`
      Parameters:
        `aContext` - Provides access to services and resources managed by the framework. This includes configuration parameters, logging, and access to external resources.
      Throws:
        `ResourceInitializationException` - if this AnalysisComponent cannot initialize successfully.

    - #### reconfigure

          public void reconfigure()
                           throws ResourceConfigurationException,
                                  ResourceInitializationException

      Notifies this AnalysisComponent that its configuration parameters have changed. This implementation just calls `destroy()` followed by `initialize(UimaContext)`. Subclasses can override to provide more efficient reconfiguration logic if necessary.
      Specified by:
        `reconfigure` in interface `AnalysisComponent`
      Throws:
        `ResourceConfigurationException` - if the configuration specified for this component is invalid.
        `ResourceInitializationException` - if this component fails to reinitialize itself based on the new configuration.
      See Also:
        `AnalysisComponent.reconfigure()`

    - #### batchProcessComplete

          public void batchProcessComplete()
                                    throws AnalysisEngineProcessException

      Description copied from interface: `AnalysisComponent`
      Completes the processing of a batch of CASes. The size of a batch is determined based on configuration provided by the application that is using this component. The purpose of `batchProcessComplete` is to give this AnalysisComponent the change to flush information from memory to persistent storage. In the event of an error, this allows the processing to be restarted from the end of the last completed batch.

      If this component's descriptor declares that it is `recoverable`, then this component is required to be restartable from the end of the last completed batch.

      Specified by:
        `batchProcessComplete` in interface `AnalysisComponent`
      Throws:
        `AnalysisEngineProcessException` - if this component encounters a problem in flushing its state to persistent storage

    - #### collectionProcessComplete

          public void collectionProcessComplete()
                                         throws AnalysisEngineProcessException

      Description copied from interface: `AnalysisComponent`
      Notifies this AnalysisComponent that processing of an entire collection has been completed. In this method, this component should finish writing any output relating to the current collection.
      Specified by:
        `collectionProcessComplete` in interface `AnalysisComponent`
      Throws:
        `AnalysisEngineProcessException` - if this component encounters a problem in its end-of-collection processing

    - #### destroy

          public void destroy()

      Description copied from interface: `AnalysisComponent`
      Frees all resources held by this AnalysisComponent. The framework calls this method only once, when it is finished using this component.
      Specified by:
        `destroy` in interface `AnalysisComponent`

    - #### setResultSpecification

          public void setResultSpecification(ResultSpecification aResultSpec)

      Sets the Result Specification for this Analysis Component. This implementation just saves the Result Specification to a field, where it can later be accessed by calling `getResultSpecification()`. An AnalysisComponent implementation may override this method if it would like to do specific processing when its ResultSpecificatin is changed.
      Specified by:
        `setResultSpecification` in interface `AnalysisComponent`
      Parameters:
        `aResultSpec` - the ResultSpecification for this Analysis Component to use.
      See Also:
        `AnalysisComponent.setResultSpecification(ResultSpecification)`

    - #### getContext

          protected final UimaContext getContext()

      Gets the UimaContext for this AnalysisComponent. This provides access to configuration parameters and external resources.
      Returns:
        the UimaContext for this AnalysisComponent

    - #### getResultSpecification

          protected ResultSpecification getResultSpecification()

      Gets the ResultSpecification for this AnalysisComponent. The ResultSpecification is a set of types and features that this AnalysisComponent is asked to produce. An Analysis Component may (but is not required to) optimize its processing by omitting the generation of any types or features that are not part of the ResultSpecification.
      Returns:
        the ResultSpecification for this Analysis Component to use.

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