Class ExternalResourceFactory

java.lang.Object
org.apache.uima.fit.factory.ExternalResourceFactory

public final class ExternalResourceFactory extends Object
Helper methods for external resources.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
    Used to separate resource name from key for nested resource.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    bindResource(org.apache.uima.resource.ExternalResourceDescription aRes, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aNestedRes)
    static void
    bindResource(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, String aRes)
    static void
    bindResource(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aRes)
    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<? 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, 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, 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, String aUrl)
    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
    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, 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
    bindResourceOnce(org.apache.uima.resource.ExternalResourceDescription aRes, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aNestedRes)
    Create a binding for the given external resource in the given resource.
    static void
    bindResourceOnce(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aRes)
    Create a binding for the given external resource in the given resource manager.
    static void
    bindResourceOnce(org.apache.uima.resource.ResourceCreationSpecifier aDesc, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aRes)
    Create a binding for the given external resource in the resource manager configuration of the given resource.
    static void
    bindResourceOnceWithoutNested(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, String aRes)
    Create a binding for the given external resource in the given resource manager configuration.
    static void
    bindResourceOnceWithoutNested(org.apache.uima.resource.ResourceCreationSpecifier aDesc, String aBindTo, String aRes)
    Create a binding for the given external resource in resource manager configuration of the given resource creation specified.
    static void
    bindResourceUsingUrl(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
    bindResourceUsingUrl(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
    bindResourceUsingUrl(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
    bindResourceUsingUrl(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, String aUrl)
    Scan the given resource specifier for external resource dependencies and whenever a dependency is encountered 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.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 void
    createDependencyAndBindUsingUrl(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 org.apache.uima.resource.ExternalResourceDescription
    Create an external resource description for a file addressable via an URL.
    static org.apache.uima.resource.ExternalResourceDescription
    createNamedResourceDescription(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
    createNamedResourceDescriptionUsingUrl(String aName, Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, String aUrl, Object... aParams)
    Create an external resource description for a SharedResourceObject.
    static <R extends org.apache.uima.resource.Resource>
    R
    createResource(Class<R> resourceClass, Object... params)
    Create an instance of a UIMA shared/external resource class.
    static <R extends org.apache.uima.resource.Resource>
    R
    createResource(Class<R> resourceClass, org.apache.uima.resource.ResourceManager resMgr, Object... params)
    Create an instance of a UIMA shared/external resource class.
    static org.apache.uima.resource.metadata.ExternalResourceBinding
    createResourceBinding(String aKey, String aResourceKey)
    Create an external resource binding.
    static org.apache.uima.resource.metadata.ExternalResourceBinding
    createResourceBinding(String aKey, org.apache.uima.resource.ExternalResourceDescription aResource)
    Create an external resource binding.
    static org.apache.uima.resource.ExternalResourceDependency[]
     
    static org.apache.uima.resource.ExternalResourceDependency
    Creates an ExternalResourceDependency for a field annotated with ExternalResource.
    static org.apache.uima.resource.ExternalResourceDependency
    createResourceDependency(String aKey, Class<?> aInterface, boolean aOptional, String aDescription)
    Creates an ExternalResourceDependency for a given key and interface.
    static org.apache.uima.resource.ExternalResourceDescription
    createResourceDescription(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
    createSharedResourceDescription(File aFile, Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, Object... aParams)
    Create an external resource description for a SharedResourceObject.
    static org.apache.uima.resource.ExternalResourceDescription
    createSharedResourceDescription(String aUrl, Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, Object... aParams)
    Create an external resource description for a SharedResourceObject.
    static org.apache.uima.resource.ExternalResourceDescription
    createSharedResourceDescription(URL aUrl, Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, Object... aParams)
    Create an external resource description for a SharedResourceObject.
    protected static Map<String,org.apache.uima.resource.ExternalResourceDescription>
    extractResourceParameters(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
    This method determines if the field is annotated with ExternalResource.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • isExternalResourceField

      public static boolean isExternalResourceField(Field field)
      This method determines if the field is annotated with ExternalResource.
      Parameters:
      field - the field to analyze
      Returns:
      whether the field is marked as an external resource
    • createResourceDescription

      public static org.apache.uima.resource.ExternalResourceDescription createResourceDescription(Class<? extends org.apache.uima.resource.Resource> aInterface, Object... aParams)
      Create an external resource description for a custom resource.
      Parameters:
      aInterface - the interface the resource should implement.
      aParams - parameters passed to the resource when it is created.
      Returns:
      the description.
      See Also:
      • CustomResourceSpecifier
    • createNamedResourceDescription

      public static org.apache.uima.resource.ExternalResourceDescription createNamedResourceDescription(String aName, Class<? extends org.apache.uima.resource.Resource> aInterface, Object... aParams)
      Create an external resource description for a custom resource.
      Parameters:
      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.
      Returns:
      the description.
      See Also:
      • CustomResourceSpecifier
    • createSharedResourceDescription

      public static org.apache.uima.resource.ExternalResourceDescription createSharedResourceDescription(String aUrl, Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, Object... aParams)
      Create an external resource description for a SharedResourceObject.
      Parameters:
      aUrl - the URL from which the resource is initialized.
      aInterface - the interface the resource should implement.
      aParams - parameters passed to the resource when it is created.
      Returns:
      the description.
      See Also:
      • ConfigurableDataResourceSpecifier
      • SharedResourceObject
    • createSharedResourceDescription

      public static org.apache.uima.resource.ExternalResourceDescription createSharedResourceDescription(URL aUrl, Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, Object... aParams)
      Create an external resource description for a SharedResourceObject.
      Parameters:
      aUrl - the URL from which the resource is initialized.
      aInterface - the interface the resource should implement.
      aParams - parameters passed to the resource when it is created.
      Returns:
      the description.
      See Also:
      • ConfigurableDataResourceSpecifier
      • SharedResourceObject
    • createSharedResourceDescription

      public static org.apache.uima.resource.ExternalResourceDescription createSharedResourceDescription(File aFile, Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, Object... aParams)
      Create an external resource description for a SharedResourceObject.
      Parameters:
      aFile - the file from which the resource is initialized.
      aInterface - the interface the resource should implement.
      aParams - parameters passed to the resource when it is created.
      Returns:
      the description.
      See Also:
      • ConfigurableDataResourceSpecifier
      • SharedResourceObject
    • createNamedResourceDescriptionUsingUrl

      public static org.apache.uima.resource.ExternalResourceDescription createNamedResourceDescriptionUsingUrl(String aName, Class<? extends org.apache.uima.resource.SharedResourceObject> aInterface, String aUrl, Object... aParams)
      Create an external resource description for a SharedResourceObject.
      Parameters:
      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.
      Returns:
      the description.
      See Also:
      • ConfigurableDataResourceSpecifier
      • SharedResourceObject
    • createNamedFileResourceDescription

      public static org.apache.uima.resource.ExternalResourceDescription createNamedFileResourceDescription(String aName, String aUrl)
      Create an external resource description for a file addressable via an URL.
      Parameters:
      aName - the name of the resource (the key).
      aUrl - a URL.
      Returns:
      the description.
      See Also:
      • FileResourceSpecifier
    • createResourceBinding

      public static org.apache.uima.resource.metadata.ExternalResourceBinding createResourceBinding(String aKey, org.apache.uima.resource.ExternalResourceDescription aResource)
      Create an external resource binding.
      Parameters:
      aKey - the key to bind to.
      aResource - the resource to bind.
      Returns:
      the description.
    • createResourceBinding

      public static org.apache.uima.resource.metadata.ExternalResourceBinding createResourceBinding(String aKey, String aResourceKey)
      Create an external resource binding. This is a more convenient method of creating an ExternalResourceBinding than calling ResourceSpecifierFactory.createExternalResourceBinding() and setting the resource name and key manually.
      Parameters:
      aKey - the key to bind to.
      aResourceKey - the resource key to bind.
      Returns:
      the description.
    • createResourceDependency

      public static org.apache.uima.resource.ExternalResourceDependency createResourceDependency(Field field)
      Creates an ExternalResourceDependency for a field annotated with ExternalResource.
      Parameters:
      field - the field to analyze
      Returns:
      a external resource dependency
    • createResourceDependency

      public static org.apache.uima.resource.ExternalResourceDependency createResourceDependency(String aKey, Class<?> aInterface, boolean aOptional, String aDescription)
      Creates an ExternalResourceDependency for a given key and interface. This is a more convenient method of creating an ExternalResourceDependency than calling ResourceSpecifierFactory.createExternalResourceDependency() and setting the fields manually.
      Parameters:
      aKey - the resource key
      aInterface - the resource interface
      aOptional - determines whether the dependency is optional
      aDescription - a description of the resource
      Returns:
      the external resource dependency
    • createResourceDependencies

      public static org.apache.uima.resource.ExternalResourceDependency[] createResourceDependencies(Class<?> cls) throws org.apache.uima.resource.ResourceInitializationException
      Parameters:
      cls - the class to analyze
      Returns:
      the external resource dependencies
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if the external resource dependencies could not be created
    • bindResource

      public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, URL aUrl) throws org.apache.uima.util.InvalidXMLException
      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.

      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.

      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aUrl - a URL.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      See Also:
      • FileResourceSpecifier
    • bindResource

      public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, File aFile) throws org.apache.uima.util.InvalidXMLException
      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.

      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.

      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aFile - a file.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      See Also:
      • FileResourceSpecifier
    • bindResource

      @Deprecated public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, String aUrl) throws org.apache.uima.util.InvalidXMLException
      Scan the given resource specifier for external resource dependencies and whenever a dependency is encountered that has the specified key, the resource will be bound.

      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.

      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aUrl - a URL.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      See Also:
      • FileResourceSpecifier
    • bindResourceUsingUrl

      public static void bindResourceUsingUrl(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, String aUrl) throws org.apache.uima.util.InvalidXMLException
      Scan the given resource specifier for external resource dependencies and whenever a dependency is encountered that has the specified key, the resource will be bound.

      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.

      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aUrl - a URL.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      See Also:
      • FileResourceSpecifier
    • bindResource

      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
      Scan the given resource specifier for external resource dependencies and whenever a dependency with a compatible type is found, the resource will be bound.
      Parameters:
      aDesc - a description.
      aRes - the resource to bind.
      aParams - parameters passed to the resource when it is created.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      ClassNotFoundException - if the resource implementation class or interface class could not be accessed
      See Also:
      • CustomResourceSpecifier
    • bindResource

      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
      Scan the given resource specifier for external resource dependencies and whenever a dependency with a compatible type is found, the resource will be bound.
      Parameters:
      aDesc - a description.
      aApi - the resource interface.
      aRes - the resource to bind.
      aParams - parameters passed to the resource when it is created.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      ClassNotFoundException - if the resource implementation class or interface class could not be accessed
      See Also:
      • CustomResourceSpecifier
    • bindResourceUsingUrl

      public static void bindResourceUsingUrl(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
      Scan the given resource specifier for external resource dependencies and whenever a dependency with a compatible type is found, the resource will be bound.
      Parameters:
      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.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      ClassNotFoundException - if the resource implementation class or interface class could not be accessed
      See Also:
      • SharedResourceObject
    • bindResourceUsingUrl

      public static void bindResourceUsingUrl(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
      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.
      Parameters:
      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.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      See Also:
      • SharedResourceObject
    • bindResourceUsingUrl

      public static void bindResourceUsingUrl(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
      Scan the given resource specifier for external resource dependencies and whenever a dependency with the given key is encountered the resource will be bound.
      Parameters:
      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.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      See Also:
      • SharedResourceObject
    • bindResource

      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
      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.
      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aRes - the resource to bind.
      aParams - parameters passed to the resource when it is created.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      See Also:
      • CustomResourceSpecifier
    • bindResource

      public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, org.apache.uima.resource.ExternalResourceDescription aResDesc) throws org.apache.uima.util.InvalidXMLException, ClassNotFoundException
      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.
      Parameters:
      aDesc - a description.
      aResDesc - the resource description.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
      ClassNotFoundException - if the resource implementation class or interface class could not be accessed
    • bindResource

      public static void bindResource(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, org.apache.uima.resource.ExternalResourceDescription aResDesc) throws org.apache.uima.util.InvalidXMLException
      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.
      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aResDesc - the resource description.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
    • createDependencyAndBind

      public 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
      Create a new dependency for the specified resource and bind it. This method is helpful for UIMA components that do not use the uimaFIT ExternalResource annotation, because no external resource dependencies can be automatically generated by uimaFIT for such components.
      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aImpl - the resource implementation.
      aParams - additional parameters supported by the resource.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
    • createDependencyAndBind

      public 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
      Create a new dependency for the specified resource and bind it. This method is helpful for UIMA components that do not use the uimaFIT ExternalResource annotation, because no external resource dependencies can be automatically generated by uimaFIT for such components.
      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aImpl - the resource implementation.
      aApi - the resource interface
      aParams - additional parameters supported by the resource.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
    • createDependency

      public static void createDependency(org.apache.uima.resource.ResourceSpecifier aDesc, String aKey, Class<?> aApi)
      Create a new dependency for the specified resource and bind it. This method is helpful for UIMA components that do not use the uimaFIT ExternalResource annotation, because no external resource dependencies can be automatically generated by uimaFIT for such components.
      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aApi - the resource API.
    • createDependencyAndBindUsingUrl

      public static void createDependencyAndBindUsingUrl(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
      Create a new dependency for the specified resource and bind it. This method is helpful for UIMA components that do not use the uimaFIT ExternalResource annotation, because no external resource dependencies can be automatically generated by uimaFIT for such components.
      Parameters:
      aDesc - a description.
      aKey - the key to bind to.
      aImpl - the resource implementation.
      aUrl - the resource URL.
      aParams - additional parameters supported by the resource.
      Throws:
      org.apache.uima.util.InvalidXMLException - if import resolution failed
    • bindResource

      @Deprecated public static void bindResource(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aRes)
      Create a binding for the given external resource in the given resource manager. This method also scans the given external resource for any nested external resources and creates bindings for them as well.
      Parameters:
      aResMgrCfg - the resource manager to create the binding in.
      aBindTo - what key to bind to.
      aRes - the resource that should be bound.
    • bindResourceOnce

      public static void bindResourceOnce(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aRes)
      Create a binding for the given external resource in the given resource manager. This method also scans the given external resource for any nested external resources and creates bindings for them as well.

      NOTE:If you use this method on resource manager configurations of aggregate analysis engine descriptions because it will not have any effects on the delegate analysis engines of the aggregate. If you want to recursively bind an external resource to the delegates in an aggregate engine, use e.g. bindResource(ResourceSpecifier, String, ExternalResourceDescription).

      Parameters:
      aResMgrCfg - the resource manager to create the binding in.
      aBindTo - what key to bind to.
      aRes - the resource that should be bound.
    • bindResource

      @Deprecated public static void bindResource(org.apache.uima.resource.ExternalResourceDescription aRes, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aNestedRes)
      Create a new external resource binding.
      Parameters:
      aRes - the resource to bind to
      aBindTo - what key to bind to.
      aNestedRes - the resource that should be bound.
    • bindResourceOnce

      public static void bindResourceOnce(org.apache.uima.resource.ExternalResourceDescription aRes, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aNestedRes)
      Create a binding for the given external resource in the given resource. This method also scans the given external resource for any nested external resources and creates bindings for them as well.

      NOTE: This method only works on ExtendedExternalResourceDescription_impl instances. Any ExternalResourceDescription instances created with uimaFIT use this implementation. For reasons of convenience, the method signature uses ExternalResourceDescription but will thrown an IllegalArgumentException if the wrong implementations are provided.

      Parameters:
      aRes - the resource to bind to
      aBindTo - what key to bind to.
      aNestedRes - the resource that should be bound.
      Throws:
      IllegalArgumentException - if the given resource description is not an instance of ExtendedExternalResourceDescription_impl.
    • bindResourceOnce

      public static void bindResourceOnce(org.apache.uima.resource.ResourceCreationSpecifier aDesc, String aBindTo, org.apache.uima.resource.ExternalResourceDescription aRes)
      Create a binding for the given external resource in the resource manager configuration of the given resource. If no resource manager configuration exists yet, it will be created. This method also scans the given external resource for any nested external resources and creates bindings for them as well.

      NOTE:IF you use this method with aggregate analysis engine descriptions because it will not have any effects on the delegate analysis engines of the aggregate. If you want to recursively bind an external resource to the delegates in an aggregate engine, use e.g. bindResource(ResourceSpecifier, String, ExternalResourceDescription).

      Parameters:
      aDesc - the specifier to create the binding in.
      aBindTo - what key to bind to.
      aRes - the resource that should be bound.
    • bindResource

      @Deprecated public static void bindResource(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, String aRes)
      Create a binding for the given external resource in the given resource manager configuration. This method does not scan the given external resource for any nested external resources and does not create bindings for them. Use bindResourceOnce(ResourceCreationSpecifier, String, ExternalResourceDescription) if you wish to bind nested resources as well.

      NOTE:If you use this method on resource manager configurations of aggregate analysis engine descriptions because it will not have any effects on the delegate analysis engines of the aggregate. If you want to recursively bind an external resource to the delegates in an aggregate engine, use e.g. bindResource(ResourceSpecifier, String, ExternalResourceDescription).

      Parameters:
      aResMgrCfg - the resource manager to create the binding in.
      aBindTo - what key to bind to.
      aRes - the resource that should be bound.
    • bindResourceOnceWithoutNested

      public static void bindResourceOnceWithoutNested(org.apache.uima.resource.metadata.ResourceManagerConfiguration aResMgrCfg, String aBindTo, String aRes)
      Create a binding for the given external resource in the given resource manager configuration. This method does not scan the given external resource for any nested external resources and does not create bindings for them. Use bindResourceOnce(ResourceCreationSpecifier, String, ExternalResourceDescription) if you wish to bind nested resources as well.

      NOTE:If you use this method on resource manager configurations of aggregate analysis engine descriptions because it will not have any effects on the delegate analysis engines of the aggregate. If you want to recursively bind an external resource to the delegates in an aggregate engine, use e.g. bindResource(ResourceSpecifier, String, ExternalResourceDescription).

      Parameters:
      aResMgrCfg - the resource manager to create the binding in.
      aBindTo - what key to bind to.
      aRes - the resource that should be bound.
    • bindResourceOnceWithoutNested

      public static void bindResourceOnceWithoutNested(org.apache.uima.resource.ResourceCreationSpecifier aDesc, String aBindTo, String aRes)
      Create a binding for the given external resource in resource manager configuration of the given resource creation specified. If no resource manager configuration exists yet, it is created. This method does not scan the given external resource for any nested external resources and does not create bindings for them. Use bindResourceOnce(ResourceCreationSpecifier, String, ExternalResourceDescription) if you wish to bind nested resources as well.

      NOTE:If you use this method on an aggregate analysis engine description, it will not have any effects on the delegate analysis engines of the aggregate. If you want to recursively bind an external resource to the delegates in an aggregate engine, use e.g. bindResource(ResourceSpecifier, String, ExternalResourceDescription).

      Parameters:
      aDesc - the specifier to create the binding in.
      aBindTo - what key to bind to.
      aRes - the resource that should be bound.
    • getImplementationName

      protected static String getImplementationName(org.apache.uima.resource.ExternalResourceDescription aDesc)
      Find the name of the class implementing this resource. The location where this name is stored varies, depending if the resource extends SharedResourceObject or implements Resource.
      Parameters:
      aDesc - the external resource description.
      Returns:
      the implementation name.
    • extractResourceParameters

      protected static Map<String,org.apache.uima.resource.ExternalResourceDescription> extractResourceParameters(Object[] configurationData)
      Extracts the external resource from the configuration parameters and nulls out these parameters. Mind that the array passed to this method is modified by the method.
      Parameters:
      configurationData - the configuration parameters.
      Returns:
      extRes the external resource parameters.
    • createResource

      public static <R extends org.apache.uima.resource.Resource> R createResource(Class<R> resourceClass, Object... params) throws org.apache.uima.resource.ResourceInitializationException
      Create an instance of a UIMA shared/external resource class.
      Type Parameters:
      R - the resource type.
      Parameters:
      resourceClass - the class implementing the resource.
      params - parameters passed to the resource when it is created. Each parameter consists of two arguments, the first being the name and the second being the parameter value
      Returns:
      the resource instance.
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if there was a problem instantiating the resource.
    • createResource

      public static <R extends org.apache.uima.resource.Resource> R createResource(Class<R> resourceClass, org.apache.uima.resource.ResourceManager resMgr, Object... params) throws org.apache.uima.resource.ResourceInitializationException
      Create an instance of a UIMA shared/external resource class.
      Type Parameters:
      R - the resource type.
      Parameters:
      resourceClass - the class implementing the resource.
      resMgr - a resource manager (optional).
      params - parameters passed to the resource when it is created. Each parameter consists of two arguments, the first being the name and the second being the parameter value
      Returns:
      the resource instance.
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if there was a problem instantiating the resource.