|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.uima.util.SimpleResourceFactory
public class SimpleResourceFactory
A simple implementation of a ResourceFactory. This implementation
maintains a Map between the ResourceSpecifier sub-interface name (e.g.
AnalysisEngineDescription) and the class name of the resource to be constructed
from specifiers of that type.
UIMA developers who introduce new types of Resources or ResourceSpecifiers may
create an instance of this class and use the addMapping(Class,Class) method to register
a mapping between the ResourceSpecifier interface and the Class of the Resource that is to be
constructed from it. The SimpleResourceFactory should then be registered with the
framework by calling
UIMAFramework.getResourceFactory().registerFactory(Class,ResourceFactory);
| Field Summary | |
|---|---|
protected Map<Class<? extends ResourceSpecifier>,List<Class<? extends Resource>>> |
mClassMap
Map from ResourceSpecifier Class to List of Resource Classes. |
| Constructor Summary | |
|---|---|
SimpleResourceFactory()
|
|
| Method Summary | |
|---|---|
void |
addMapping(Class<? extends ResourceSpecifier> aSpecifierInterface,
Class<? extends Resource> aResourceClass)
Configures this SimpleResourceFactory by adding a new mapping between a
ResourceSpecifier class and a Resource class. |
void |
addMapping(String aSpecifierInterfaceName,
String aResourceClassName)
Configures this SimpleResourceFactory by adding a new mapping between a
ResourceSpecifier class and a Resource class. |
Resource |
produceResource(Class<? extends Resource> aResourceClass,
ResourceSpecifier aSpecifier,
Map<String,Object> aAdditionalParams)
Produces an appropriate Resource instance from a ResourceSpecifier. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Map<Class<? extends ResourceSpecifier>,List<Class<? extends Resource>>> mClassMap
| Constructor Detail |
|---|
public SimpleResourceFactory()
| Method Detail |
|---|
public Resource produceResource(Class<? extends Resource> aResourceClass,
ResourceSpecifier aSpecifier,
Map<String,Object> aAdditionalParams)
throws ResourceInitializationException
Resource instance from a ResourceSpecifier.
produceResource in interface ResourceFactoryaResourceClass - the interface of the resource to be produced. This is intended to be a standard UIMA
interface 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 resourceResourceFactory.produceResource(Class, ResourceSpecifier,Map)
public void addMapping(Class<? extends ResourceSpecifier> aSpecifierInterface,
Class<? extends Resource> aResourceClass)
SimpleResourceFactory by adding a new mapping between a
ResourceSpecifier class and a Resource class.
aSpecifierInterface - the subinterface of ResourceSpecifier.aResourceClass - a subclass of Resource that is to be instantiated from resource
specifiers of the given class.
public void addMapping(String aSpecifierInterfaceName,
String aResourceClassName)
throws ClassNotFoundException
SimpleResourceFactory by adding a new mapping between a
ResourceSpecifier class and a Resource class.
aSpecifierInterfaceName - name of the subinterface of ResourceSpecifier.aResourceClassName - the name of a subclass of Resource that is to be instantiated from
resource specifiers of the given class.
ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||