org.apache.uima

## Interface ResourceFactory

- All Known Subinterfaces:
    CompositeResourceFactory
  All Known Implementing Classes:
    AnalysisEngineFactory_impl, CasConsumerFactory_impl, CasInitializerFactory_impl, CollectionReaderFactory_impl, CompositeResourceFactory_impl, CustomResourceFactory_impl, SimpleResourceFactory

      public interface ResourceFactory

  A `ResourceFactory` is used to acquire instances of `Resource`s.

  The method `produceResource(Class,ResourceSpecifier,Map)` is used to produce an instance of a `Resource`. The input to this method is a `ResourceSpecifier`, which contains all of the information that this factory can use to acquire a reference to the resource.

  Most applications will not need to interact with this interface. Applications will generally create resources using the static methods on the `UIMAFramework` class.

  Note that multiple threads may attempt to manufacture resources simultaneously, so implementations of this interface MUST be threadsafe.

  Developers needing to provide their own `ResourceFactory` may wish to consider using the provided `SimpleResourceFactory` implementation.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Resource` | `produceResource(Class<? extends Resource> aResourceClass, ResourceSpecifier aSpecifier, Map<String,Object> aAdditionalParams)` Produces an appropriate `Resource` instance from a `ResourceSpecifier`.

- - ### Method Detail

    - #### produceResource

          Resource produceResource(Class<? extends Resource> aResourceClass,
                                   ResourceSpecifier aSpecifier,
                                   Map<String,Object> aAdditionalParams)
                            throws ResourceInitializationException

      Produces an appropriate `Resource` instance from a `ResourceSpecifier`. This version of `produceResource` takes a Map containing additional parameters to be passed to the `Resource.initialize(ResourceSpecifier,Map)` method.
      Parameters:
        `aResourceClass` - the class of resource to be produced (NOTE: this is intended to be a standard UIMA interface name such as "TextAnalysisEngine" or "ASB")
        `aSpecifier` - an object that specifies how to acquire an instance of a `Resource`.
        `aAdditionalParams` - a Map containing additional parameters to pass to the `Resource.initialize(ResourceSpecifier,Map)` method. May be `null` if there are no parameters.
      Returns:
        a `Resource` instance. Returns `null` if this factory does not know how to create a Resource from the `ResourceSpecifier` provided.
      Throws:
        `ResourceInitializationException` - if a failure occurred during production of the resource

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