org.apache.uima.collection

## Class CollectionReader_ImplBase

- java.lang.Object
- - org.apache.uima.resource.Resource_ImplBase
  - - org.apache.uima.resource.ConfigurableResource_ImplBase
    - - org.apache.uima.collection.CollectionReader_ImplBase

- All Implemented Interfaces:
    BaseCollectionReader, CollectionReader, ConfigurableResource, Resource

      public abstract class CollectionReader_ImplBase
      extends ConfigurableResource_ImplBase
      implements CollectionReader

  Base class for Collection Readers, which developers should extend with their own Collection Reader implementation classes.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.uima.resource.Resource

      `PARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_MANAGER, PARAM_CONFIG_PARAM_SETTINGS, PARAM_EXTERNAL_OVERRIDE_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CollectionReader_ImplBase()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()` Default implementation of destroy, which calls `BaseCollectionReader.close()`.
    `CasInitializer` | `getCasInitializer()` Deprecated. As of v2.0 CAS Initializers are deprecated.
    `ProcessingResourceMetaData` | `getProcessingResourceMetaData()` Gets the metadata for this CollectionReader, which was extracted from the descriptor during initialization.
    `void` | `initialize()` This method is called during initialization, and does nothing by default.
    `boolean` | `initialize(ResourceSpecifier aSpecifier, Map<String,Object> aAdditionalParams)` Called by the framework to initialize this Collection Reader.
    `boolean` | `isConsuming()` Returns false.
    `void` | `reconfigure()` Notifies this Collection Reader that its configuration parameter settings have been changed.
    `void` | `setCasInitializer(CasInitializer aCasInitializer)` Deprecated. As of v2.0 CAS Initializers are deprecated.
    `void` | `typeSystemInit(TypeSystem aTypeSystem)` Default implementation of typeSystemInit, which calls the CAS Initializer's typeSystemInit method if a CAS Initializer is present.

    - ### 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, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, loadUserClass, loadUserClassOrThrow, setContextHolder, setContextHolderX, setLogger, setMetaData, withContextHolder`

    - ### 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.CollectionReader

      `getNext`

    - ### Methods inherited from interface org.apache.uima.collection.base_cpm.BaseCollectionReader

      `close, getProgress, hasNext`

    - ### 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

    - #### CollectionReader_ImplBase

          public CollectionReader_ImplBase()

  - ### Method Detail

    - #### initialize

          public boolean initialize(ResourceSpecifier aSpecifier,
                                    Map<String,Object> aAdditionalParams)
                             throws ResourceInitializationException

      Called by the framework to initialize this Collection Reader. Subclasses should generally NOT override this method; instead they should override the zero-argument `initialize()` method and access metadata via the `getProcessingResourceMetaData()` method. This method is non-final only for legacy reasons.
      Specified by:
        `initialize` in interface `Resource`
      Overrides:
        `initialize` in class `Resource_ImplBase`
      Parameters:
        `aSpecifier` - specifies how to create a resource or locate an existing resource service.
        `aAdditionalParams` - a Map containing additional parameters. May be `null` if there are no parameters. Each class that implements this interface can decide what additional parameters it supports.
      Returns:
        true if and only if initialization completed successfully. Returns false if the given `ResourceSpecifier` is not of an appropriate type for this Resource. If the `ResourceSpecifier` is of an appropriate type but is invalid or if some other failure occurs, an exception should be thrown.
      Throws:
        `ResourceInitializationException` - if a failure occurs during initialization.
      See Also:
        `Resource.initialize(org.apache.uima.resource.ResourceSpecifier, java.util.Map)`

    - #### initialize

          public void initialize()
                          throws ResourceInitializationException

      This method is called during initialization, and does nothing by default. Subclasses should override it to perform one-time startup logic.
      Throws:
        `ResourceInitializationException` - if a failure occurs during initialization.

    - #### destroy

          public void destroy()

      Default implementation of destroy, which calls `BaseCollectionReader.close()`. If close throws an IOException, it will be logged.
      Specified by:
        `destroy` in interface `Resource`
      Overrides:
        `destroy` in class `Resource_ImplBase`
      See Also:
        `Resource.destroy()`

    - #### typeSystemInit

          public void typeSystemInit(TypeSystem aTypeSystem)
                              throws ResourceInitializationException

      Default implementation of typeSystemInit, which calls the CAS Initializer's typeSystemInit method if a CAS Initializer is present.
      Specified by:
        `typeSystemInit` in interface `CollectionReader`
      Parameters:
        `aTypeSystem` - the CAS TypeSystem
      Throws:
        `ResourceInitializationException` - if the type system is not compatible with this Collection Reader
      See Also:
        `CollectionReader.typeSystemInit(org.apache.uima.cas.TypeSystem)`

    - #### getProcessingResourceMetaData

          public ProcessingResourceMetaData getProcessingResourceMetaData()

      Gets the metadata for this CollectionReader, which was extracted from the descriptor during initialization.
      Specified by:
        `getProcessingResourceMetaData` in interface `BaseCollectionReader`
      Returns:
        an object containing all metadata for this CasProcessor
      See Also:
        `BaseCollectionReader.getProcessingResourceMetaData()`

    - #### isConsuming

          public boolean isConsuming()

      Returns false.
      Specified by:
        `isConsuming` in interface `BaseCollectionReader`
      Returns:
        true if and only if this is a consuming `CollectionReader`
      See Also:
        `BaseCollectionReader.isConsuming()`

    - #### getCasInitializer

          @Deprecated
          public CasInitializer getCasInitializer()

      Deprecated. As of v2.0 CAS Initializers are deprecated.
      Gets the CAS initializer associated with this CollectionReader, if one was supplied via `setCasInitializer(CasInitializer)`.
      Specified by:
        `getCasInitializer` in interface `CollectionReader`
      Returns:
        the CAS Initializer for this Collection Reader
      See Also:
        `CollectionReader.getCasInitializer()`

    - #### setCasInitializer

          @Deprecated
          public void setCasInitializer(CasInitializer aCasInitializer)

      Deprecated. As of v2.0 CAS Initializers are deprecated.
      Stores the CAS initializer in a private field and provides access to it via `getCasInitializer()`.
      Specified by:
        `setCasInitializer` in interface `CollectionReader`
      Parameters:
        `aCasInitializer` - the CAS Initializer for this Collection Reader
      See Also:
        `CollectionReader.setCasInitializer(org.apache.uima.collection.CasInitializer)`

    - #### reconfigure

          public void reconfigure()
                           throws ResourceConfigurationException

      Notifies this Collection Reader that its configuration parameter settings have been changed. By default this method just calls `destroy()` followed by `initialize()`. Collection Readers that have expensive initialization that does not need to be redone whenever configuration parameters change may wish to override this method to provide a more efficient implementation.
      Specified by:
        `reconfigure` in interface `ConfigurableResource`
      Overrides:
        `reconfigure` in class `ConfigurableResource_ImplBase`
      Throws:
        `ResourceConfigurationException` - if the configuration is not valid
      See Also:
        `ConfigurableResource_ImplBase.reconfigure()`

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