public final class ExternalResourceFactory extends Object
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_RESOURCE_NAME |
static String |
PREFIX_SEPARATOR
Used to separate resource name from key for nested resource.
|
Modifier and Type | Method and Description |
---|---|
static void |
bindExternalResource(org.apache.uima.resource.ExternalResourceDescription aRes,
String aBindTo,
org.apache.uima.resource.ExternalResourceDescription aNestedRes)
Create a new external resource binding.
|
static void |
bindExternalResource(org.apache.uima.resource.ResourceCreationSpecifier aDesc,
String aBindTo,
org.apache.uima.resource.ExternalResourceDescription aRes)
Create a new external resource binding.
|
static void |
bindExternalResource(org.apache.uima.resource.ResourceCreationSpecifier aDesc,
String aBindTo,
String aRes)
Create a new external resource binding.
|
static void |
bindExternalResource(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg,
String aBindTo,
org.apache.uima.resource.ExternalResourceDescription aRes)
Create a new external resource binding.
|
static void |
bindExternalResource(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg,
String aBindTo,
String aRes)
Create a new external resource binding.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
Class<?> aApi,
Class<? extends org.apache.uima.resource.Resource> aRes,
String... aParams)
Scan the given resource specifier for external resource dependencies and whenever a dependency
with a compatible type is found, the resource will be bound.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
Class<?> aApi,
Class<? extends org.apache.uima.resource.SharedResourceObject> aRes,
String aUrl,
Object... aParams)
Scan the given resource specifier for external resource dependencies and whenever a dependency
is encountered that has a key equal to the API class name, the resource will be bound.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
Class<? extends org.apache.uima.resource.Resource> aRes,
String... aParams)
Scan the given resource specifier for external resource dependencies and whenever a dependency
with a compatible type is found, the resource will be bound.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
Class<? extends org.apache.uima.resource.SharedResourceObject> aRes,
String aUrl,
Object... aParams)
Scan the given resource specifier for external resource dependencies and whenever a dependency
with a compatible type is found, the resource will be bound.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
org.apache.uima.resource.ExternalResourceDescription aResDesc)
Scan the given resource specifier for external resource dependencies and whenever a dependency
with a compatible type is found, the given resource is bound to it.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
String aKey,
Class<? extends org.apache.uima.resource.Resource> aRes,
String... aParams)
Scan the given resource specifier for external resource dependencies and whenever a dependency
with the given key is encountered, the given resource is bound to it.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
String aKey,
Class<? extends org.apache.uima.resource.SharedResourceObject> aRes,
String aUrl,
Object... aParams)
Scan the given resource specifier for external resource dependencies and whenever a dependency
with the given key is encountered the resource will be bound.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
String aKey,
org.apache.uima.resource.ExternalResourceDescription aResDesc)
Scan the given resource specifier for external resource dependencies and whenever a dependency
with the given key is encountered, the given resource is bound to it.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
String aKey,
File aFile)
Scan the given resource specifier for external resource dependencies and whenever a dependency
is encounter that has the specified key, the resource will be bound.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
String aKey,
String aUrl)
Scan the given resource specifier for external resource dependencies and whenever a dependency
is encounter that has the specified key, the resource will be bound.
|
static void |
bindResource(org.apache.uima.resource.ResourceSpecifier aDesc,
String aKey,
URL aUrl)
Scan the given resource specifier for external resource dependencies and whenever a dependency
is encounter that has the specified key, the resource will be bound.
|
static void |
createDependency(org.apache.uima.resource.ResourceSpecifier aDesc,
String aKey,
Class<?> aApi)
Create a new dependency for the specified resource and bind it.
|
static void |
createDependencyAndBind(org.apache.uima.analysis_engine.AnalysisEngineDescription aDesc,
String aKey,
Class<? extends org.apache.uima.resource.SharedResourceObject> aImpl,
String aUrl,
Object... aParams)
Create a new dependency for the specified resource and bind it.
|
static void |
createDependencyAndBind(org.apache.uima.resource.ResourceSpecifier aDesc,
String aKey,
Class<? extends org.apache.uima.resource.Resource> aImpl,
Class<?> aApi,
String... aParams)
Create a new dependency for the specified resource and bind it.
|
static void |
createDependencyAndBind(org.apache.uima.resource.ResourceSpecifier aDesc,
String aKey,
Class<? extends org.apache.uima.resource.Resource> aImpl,
String... aParams)
Create a new dependency for the specified resource and bind it.
|
static org.apache.uima.resource.metadata.ExternalResourceBinding |
createExternalResourceBinding(String aKey,
org.apache.uima.resource.ExternalResourceDescription aResource)
Create an external resource binding.
|
static org.apache.uima.resource.metadata.ExternalResourceBinding |
createExternalResourceBinding(String aKey,
String aResourceKey)
Create an external resource binding.
|
static org.apache.uima.resource.ExternalResourceDependency[] |
createExternalResourceDependencies(Class<?> cls) |
static org.apache.uima.resource.ExternalResourceDependency |
createExternalResourceDependency(Field field)
Creates an ExternalResourceDependency for a field annotated with
ExternalResource . |
static org.apache.uima.resource.ExternalResourceDependency |
createExternalResourceDependency(String aKey,
Class<?> aInterface,
boolean aOptional,
String aDescription)
Creates an ExternalResourceDependency for a given key and interface
|
static org.apache.uima.resource.ExternalResourceDescription |
createExternalResourceDescription(Class<? extends org.apache.uima.resource.Resource> aInterface,
Object... aParams)
Create an external resource description for a custom resource.
|
static org.apache.uima.resource.ExternalResourceDescription |
createExternalResourceDescription(Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface,
File aFile,
Object... aParams)
Create an external resource description for a
SharedResourceObject . |
static org.apache.uima.resource.ExternalResourceDescription |
createExternalResourceDescription(Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface,
String aUrl,
Object... aParams)
Create an external resource description for a
SharedResourceObject . |
static org.apache.uima.resource.ExternalResourceDescription |
createExternalResourceDescription(Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface,
URL aUrl,
Object... aParams)
Create an external resource description for a
SharedResourceObject . |
static org.apache.uima.resource.ExternalResourceDescription |
createExternalResourceDescription(String aName,
Class<? extends org.apache.uima.resource.Resource> aInterface,
Object... aParams)
Create an external resource description for a custom resource.
|
static org.apache.uima.resource.ExternalResourceDescription |
createExternalResourceDescription(String aName,
Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface,
String aUrl,
Object... aParams)
Create an external resource description for a
SharedResourceObject . |
static org.apache.uima.resource.ExternalResourceDescription |
createExternalResourceDescription(String aName,
String aUrl)
Create an external resource description for a file addressable via an URL.
|
protected static Map<String,org.apache.uima.resource.ExternalResourceDescription> |
extractExternalResourceParameters(Object[] configurationData)
Extracts the external resource from the configuration parameters and nulls out these
parameters.
|
protected static String |
getImplementationName(org.apache.uima.resource.ExternalResourceDescription aDesc)
Find the name of the class implementing this resource.
|
static boolean |
isExternalResourceField(Field field)
This method determines if the field is annotated with
ExternalResource . |
public static final String PARAM_RESOURCE_NAME
public static final String PREFIX_SEPARATOR
public static boolean isExternalResourceField(Field field)
ExternalResource
.field
- the field to analyzepublic static org.apache.uima.resource.ExternalResourceDescription createExternalResourceDescription(Class<? extends org.apache.uima.resource.Resource> aInterface, Object... aParams)
aInterface
- the interface the resource should implement.aParams
- parameters passed to the resource when it is created.CustomResourceSpecifier
public static org.apache.uima.resource.ExternalResourceDescription createExternalResourceDescription(String aName, Class<? extends org.apache.uima.resource.Resource> aInterface, Object... aParams)
aName
- the name of the resource (the key).aInterface
- the interface the resource should implement.aParams
- parameters passed to the resource when it is created.CustomResourceSpecifier
public static org.apache.uima.resource.ExternalResourceDescription createExternalResourceDescription(Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, String aUrl, Object... aParams)
SharedResourceObject
.aInterface
- the interface the resource should implement.aUrl
- the URL from which the resource is initialized.aParams
- parameters passed to the resource when it is created.ConfigurableDataResourceSpecifier
,
SharedResourceObject
public static org.apache.uima.resource.ExternalResourceDescription createExternalResourceDescription(Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, URL aUrl, Object... aParams)
SharedResourceObject
.aInterface
- the interface the resource should implement.aUrl
- the URL from which the resource is initialized.aParams
- parameters passed to the resource when it is created.ConfigurableDataResourceSpecifier
,
SharedResourceObject
public static org.apache.uima.resource.ExternalResourceDescription createExternalResourceDescription(Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, File aFile, Object... aParams)
SharedResourceObject
.aInterface
- the interface the resource should implement.aFile
- the file from which the resource is initialized.aParams
- parameters passed to the resource when it is created.ConfigurableDataResourceSpecifier
,
SharedResourceObject
public static org.apache.uima.resource.ExternalResourceDescription createExternalResourceDescription(String aName, Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, String aUrl, Object... aParams)
SharedResourceObject
.aName
- the name of the resource (the key).aInterface
- the interface the resource should implement.aUrl
- the URL from which the resource is initialized.aParams
- parameters passed to the resource when it is created.ConfigurableDataResourceSpecifier
,
SharedResourceObject
public static org.apache.uima.resource.ExternalResourceDescription createExternalResourceDescription(String aName, String aUrl)
aName
- the name of the resource (the key).aUrl
- a URL.FileResourceSpecifier
public static org.apache.uima.resource.metadata.ExternalResourceBinding createExternalResourceBinding(String aKey, org.apache.uima.resource.ExternalResourceDescription aResource)
aKey
- the key to bind to.aResource
- the resource to bind.public static org.apache.uima.resource.metadata.ExternalResourceBinding createExternalResourceBinding(String aKey, String aResourceKey)
aKey
- the key to bind to.aResourceKey
- the resource key to bind.public static org.apache.uima.resource.ExternalResourceDependency createExternalResourceDependency(Field field)
ExternalResource
.field
- the field to analyzepublic static org.apache.uima.resource.ExternalResourceDependency createExternalResourceDependency(String aKey, Class<?> aInterface, boolean aOptional, String aDescription)
aKey
- the resource keyaInterface
- the resource interfaceaOptional
- determines whether the dependency is optionalaDescription
- a description of the resourcepublic static org.apache.uima.resource.ExternalResourceDependency[] createExternalResourceDependencies(Class<?> cls) throws org.apache.uima.resource.ResourceInitializationException
cls
- the class to analyzeorg.apache.uima.resource.ResourceInitializationException
- if the external resource dependencies could not be createdpublic static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, URL aUrl) throws org.apache.uima.util.InvalidXMLException
Caveat: If you use this method, you may expect that DataResource.getUrl()
or
DataResource.getUri()
will return the same URL that you have specified here. This may
NOT be the case. UIMA will internally try to resolve the URL via a
ResourceManager
. If it cannot resolve a remove URL, this mechanism will think it may be
a local file and will return some local path - or it may redirect it to some location as though
fit by the ResourceManager
.
aDesc
- a description.aKey
- the key to bind to.aUrl
- a URL.org.apache.uima.util.InvalidXMLException
- if import resolution failedFileResourceSpecifier
public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, File aFile) throws org.apache.uima.util.InvalidXMLException
Caveat: If you use this method, you may expect that DataResource.getUrl()
or
DataResource.getUri()
will return the URL of the file that you have specified here.
This may NOT be the case. UIMA will internally try to resolve the URL via a
ResourceManager
. If it cannot resolve a remove URL, this mechanism will think it may be
a local file and will return some local path - or it may redirect it to some location as though
fit by the ResourceManager
.
aDesc
- a description.aKey
- the key to bind to.aFile
- a file.org.apache.uima.util.InvalidXMLException
- if import resolution failedFileResourceSpecifier
public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, String aUrl) throws org.apache.uima.util.InvalidXMLException
Caveat: If you use this method, you may expect that DataResource.getUrl()
or
DataResource.getUri()
will return the same URL that you have specified here. This is
may NOT be the case. UIMA will internally try to resolve the URL via a
ResourceManager
. If it cannot resolve a remove URL, this mechanism will think it may be
a local file and will return some local path - or it may redirect it to some location as though
fit by the ResourceManager
.
aDesc
- a description.aKey
- the key to bind to.aUrl
- a URL.org.apache.uima.util.InvalidXMLException
- if import resolution failedFileResourceSpecifier
public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, Class<? extends org.apache.uima.resource.Resource> aRes, String... aParams) throws org.apache.uima.util.InvalidXMLException, ClassNotFoundException
aDesc
- a description.aRes
- the resource to bind.aParams
- parameters passed to the resource when it is created.org.apache.uima.util.InvalidXMLException
- if import resolution failedClassNotFoundException
- if the resource implementation class or interface class could not be accessedCustomResourceSpecifier
public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, Class<?> aApi, Class<? extends org.apache.uima.resource.Resource> aRes, String... aParams) throws org.apache.uima.util.InvalidXMLException, ClassNotFoundException
aDesc
- a description.aApi
- the resource interface.aRes
- the resource to bind.aParams
- parameters passed to the resource when it is created.org.apache.uima.util.InvalidXMLException
- if import resolution failedClassNotFoundException
- if the resource implementation class or interface class could not be accessedCustomResourceSpecifier
public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, Class<? extends org.apache.uima.resource.SharedResourceObject> aRes, String aUrl, Object... aParams) throws org.apache.uima.util.InvalidXMLException, ClassNotFoundException
aDesc
- a description.aRes
- the resource to bind.aUrl
- the URL from which the resource is initialized.aParams
- parameters passed to the resource when it is created.org.apache.uima.util.InvalidXMLException
- if import resolution failedClassNotFoundException
- if the resource implementation class or interface class could not be accessedSharedResourceObject
public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, Class<?> aApi, Class<? extends org.apache.uima.resource.SharedResourceObject> aRes, String aUrl, Object... aParams) throws org.apache.uima.util.InvalidXMLException
aDesc
- a description.aApi
- the resource interface.aRes
- the resource to bind.aUrl
- the URL from which the resource is initialized.aParams
- parameters passed to the resource when it is created.org.apache.uima.util.InvalidXMLException
- if import resolution failedSharedResourceObject
public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, Class<? extends org.apache.uima.resource.SharedResourceObject> aRes, String aUrl, Object... aParams) throws org.apache.uima.util.InvalidXMLException
aDesc
- a description.aKey
- the key to bind to.aRes
- the resource to bind.aUrl
- the URL from which the resource is initialized.aParams
- parameters passed to the resource when it is created.org.apache.uima.util.InvalidXMLException
- if import resolution failedSharedResourceObject
public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, Class<? extends org.apache.uima.resource.Resource> aRes, String... aParams) throws org.apache.uima.util.InvalidXMLException
aDesc
- a description.aKey
- the key to bind to.aRes
- the resource to bind.aParams
- parameters passed to the resource when it is created.org.apache.uima.util.InvalidXMLException
- if import resolution failedCustomResourceSpecifier
public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, org.apache.uima.resource.ExternalResourceDescription aResDesc) throws org.apache.uima.util.InvalidXMLException, ClassNotFoundException
aDesc
- a description.aResDesc
- the resource description.org.apache.uima.util.InvalidXMLException
- if import resolution failedClassNotFoundException
- if the resource implementation class or interface class could not be accessedpublic static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, org.apache.uima.resource.ExternalResourceDescription aResDesc) throws org.apache.uima.util.InvalidXMLException
aDesc
- a description.aKey
- the key to bind to.aResDesc
- the resource description.org.apache.uima.util.InvalidXMLException
- if import resolution failedpublic static void createDependencyAndBind(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, Class<? extends org.apache.uima.resource.Resource> aImpl, String... aParams) throws org.apache.uima.util.InvalidXMLException
ExternalResource
annotation, because no external
resource dependencies can be automatically generated by uimaFIT for such components.aDesc
- a description.aKey
- the key to bind to.aImpl
- the resource implementation.aParams
- additional parameters supported by the resource.org.apache.uima.util.InvalidXMLException
- if import resolution failedpublic static void createDependencyAndBind(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, Class<? extends org.apache.uima.resource.Resource> aImpl, Class<?> aApi, String... aParams) throws org.apache.uima.util.InvalidXMLException
ExternalResource
annotation, because no external
resource dependencies can be automatically generated by uimaFIT for such components.aDesc
- a description.aKey
- the key to bind to.aImpl
- the resource implementation.aApi
- the resource interfaceaParams
- additional parameters supported by the resource.org.apache.uima.util.InvalidXMLException
- if import resolution failedpublic static void createDependency(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, Class<?> aApi)
ExternalResource
annotation, because no external
resource dependencies can be automatically generated by uimaFIT for such components.aDesc
- a description.aKey
- the key to bind to.aApi
- the resource API.public static void createDependencyAndBind(org.apache.uima.analysis_engine.AnalysisEngineDescription aDesc, String aKey, Class<? extends org.apache.uima.resource.SharedResourceObject> aImpl, String aUrl, Object... aParams) throws org.apache.uima.util.InvalidXMLException
ExternalResource
annotation, because no external
resource dependencies can be automatically generated by uimaFIT for such components.aDesc
- a description.aKey
- the key to bind to.aImpl
- the resource implementation.aUrl
- the resource URL.aParams
- additional parameters supported by the resource.org.apache.uima.util.InvalidXMLException
- if import resolution failedpublic static void bindExternalResource(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aRes)
aResMgrCfg
- the resource manager to create the binding in.aBindTo
- what key to bind to.aRes
- the resource that should be bound.public static void bindExternalResource(org.apache.uima.resource.ExternalResourceDescription aRes, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aNestedRes)
aRes
- the resource to bind toaBindTo
- what key to bind to.aNestedRes
- the resource that should be bound.public static void bindExternalResource(org.apache.uima.resource.ResourceCreationSpecifier aDesc, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aRes)
aDesc
- the specifier to create the binding in.aBindTo
- what key to bind to.aRes
- the resource that should be bound.public static void bindExternalResource(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, String aRes)
aResMgrCfg
- the resource manager to create the binding in.aBindTo
- what key to bind to.aRes
- the resource that should be bound.public static void bindExternalResource(org.apache.uima.resource.ResourceCreationSpecifier aDesc, String aBindTo, String aRes)
aDesc
- the specifier to create the binding in.aBindTo
- what key to bind to.aRes
- the resource that should be bound.protected static String getImplementationName(org.apache.uima.resource.ExternalResourceDescription aDesc)
SharedResourceObject
or implements
Resource
.aDesc
- the external resource description.protected static Map<String,org.apache.uima.resource.ExternalResourceDescription> extractExternalResourceParameters(Object[] configurationData)
configurationData
- the configuration parameters.Copyright © 2012–2014 The Apache Software Foundation. All rights reserved.