Package 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 Resources.
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
Modifier and TypeMethodDescriptionproduceResource(Class<? extends Resource> aResourceClass, ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) Produces an appropriateResourceinstance from aResourceSpecifier.
-
Method Details
-
produceResource
Resource produceResource(Class<? extends Resource> aResourceClass, ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) throws ResourceInitializationExceptionProduces an appropriateResourceinstance from aResourceSpecifier. This version ofproduceResourcetakes a Map containing additional parameters to be passed to theResource.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 aResource.aAdditionalParams- a Map containing additional parameters to pass to theResource.initialize(ResourceSpecifier,Map)method. May benullif there are no parameters.- Returns:
- a
Resourceinstance. Returnsnullif this factory does not know how to create a Resource from theResourceSpecifierprovided. - Throws:
ResourceInitializationException- if a failure occurred during production of the resource
-