public interface ResourceFactory
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.
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 . |
Resource produceResource(Class<? extends Resource> aResourceClass, ResourceSpecifier aSpecifier, Map<String,Object> aAdditionalParams) throws ResourceInitializationException
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.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.Resource
instance. Returns null
if this factory does
not know how to create a Resource from the ResourceSpecifier
provided.ResourceInitializationException
- if a failure occurred during production of the resourceCopyright © 2006–2017 The Apache Software Foundation. All rights reserved.