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
AResourceFactory
is used to acquire instances ofResource
s.The method
produceResource(Class,ResourceSpecifier,Map)
is used to produce an instance of aResource
. The input to this method is aResourceSpecifier
, 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 providedSimpleResourceFactory
implementation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Resource
produceResource(java.lang.Class<? extends Resource> aResourceClass, ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams)
Produces an appropriateResource
instance from aResourceSpecifier
.
-
-
-
Method Detail
-
produceResource
Resource produceResource(java.lang.Class<? extends Resource> aResourceClass, ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams) throws ResourceInitializationException
Produces an appropriateResource
instance from aResourceSpecifier
. This version ofproduceResource
takes 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 benull
if there are no parameters.- Returns:
- a
Resource
instance. Returnsnull
if this factory does not know how to create a Resource from theResourceSpecifier
provided. - Throws:
ResourceInitializationException
- if a failure occurred during production of the resource
-
-