public class ResourceManager_impl extends Object implements ResourceManager
ResourceManager.| Modifier and Type | Class and Description | 
|---|---|
| protected static class  | ResourceManager_impl.ResourceRegistrationTies an External Resource instance to
   - its description 
     -- name
     -- textual description
     -- a ResourceSpecifier describing how to create it
     -- (optional) the String name of the Java class that implements the resource)
   - its defining UIMA Context
   
   These are used to validate multiple declarations, and to get
   a resource to tie it to a binding | 
| Modifier and Type | Field and Description | 
|---|---|
| protected static Class<Resource> | EMPTY_RESOURCE_CLASS | 
| protected static String | LOG_RESOURCE_BUNDLEresource bundle for log messages | 
| protected CasManager | mCasManagerCasManager - manages creation and pooling of CASes. | 
| protected Map<String,Class<?>> | mInternalParameterizedResourceImplClassMapInternal map from resource names (declared in resource declaration XML) to Class objects for
 parameterized Resource. | 
| protected Map<String,ResourceManager_impl.ResourceRegistration> | mInternalResourceRegistrationMapInternal map from resource names (declared in resource declaration XML) to ResourceRegistration
 objects. | 
| protected Map<String,Class<?>> | mParameterizedResourceImplClassMapMap from String keys to Class objects. | 
| protected Map<List<Object>,Object> | mParameterizedResourceInstanceMapMap from ParameterizedResourceKey to SharedResourceObject or DataResource instances. | 
| protected Map<String,Object> | mResourceMapMap from qualified key names (declared in resource dependency XML) to either DataResource
 objects or SharedResourceObjects that impl Resource. | 
| Constructor and Description | 
|---|
| ResourceManager_impl()Creates a new  ResourceManager_impl. | 
| ResourceManager_impl(ClassLoader aClassLoader)Creates a new  ResourceManager_implwith a custom ClassLoader to use for locating
 resources. | 
| ResourceManager_impl(Map<String,Object> resourceMap,
                    Map<String,ResourceManager_impl.ResourceRegistration> internalResourceRegistrationMap,
                    Map<String,Class<?>> parameterizedResourceImplClassMap,
                    Map<String,Class<?>> internalParameterizedResourceImplClassMap,
                    Map<List<Object>,Object> parameterizedResourceInstanceMap) | 
| Modifier and Type | Method and Description | 
|---|---|
| ResourceManager_impl | copy() | 
| void | destroy()Frees all resources held by this ResourceManager, and marks the ResourceManager as having been
 destroyed. | 
| CasManager | getCasManager()Gets the CasManager, which manages the creation and pooling of CASes. | 
| String | getDataPath()Gets the data path used to resolve relative paths. | 
| List<String> | getDataPathElements()Gets the data path elements used to resolve relative paths. | 
| ClassLoader | getExtensionClassLoader()Returns the UIMA extension class loader. | 
| List<Object> | getExternalResources() | 
| Map<String,XMLizable> | getImportCache()Gets a cache of imported descriptors, so that the parsed objects can be reused if the same URL
 is imported more than once. | 
| Map<String,Set<String>> | getImportUrlsCache()Deprecated. 
 No longer used. Scheduled for removal in UIMA 4.0. | 
| protected RelativePathResolver | getRelativePathResolver() | 
| Object | getResource(String aName)Gets the instance of the implementation object for a resource that has been registered under
 the specified name. | 
| Object | getResource(String aName,
           String[] aParams)Returns one of two kinds of objects (or null):
   - an instance of the implementation object for a resource, that has 
     been loaded with a DataResource resource produced by the resource given the aParms
     
   - (if there is no implementation defined for this resource) 
     returns an instance of the DataResource, itself, produced by the resource given the aParms
    
   An example of a parameterized Resource is a
     dictionary whose data depend on a specified language identifier. | 
| InputStream | getResourceAsStream(String aKey)Retrieves an InputStream for reading from the named resource. | 
| InputStream | getResourceAsStream(String aKey,
                   String[] aParams)Retrieves an InputStream for reading from the named resource. | 
| Class<?> | getResourceClass(String aName)Gets the Class of the Resource that will be returned by a call to  ResourceManager.getResource(String)orResourceManager.getResource(String,String[]). | 
| URL | getResourceURL(String aKey)Retrieves the URL to the named resource. | 
| URL | getResourceURL(String aKey,
              String[] aParams)Retrieves the URL to the named resource. | 
| void | initializeExternalResources(ResourceManagerConfiguration aConfiguration,
                           String aQualifiedContextName,
                           Map<String,Object> aAdditionalParams)Initializes all external resources declared in a ResourceCreationSpecifier. | 
| <N> Class<N> | loadUserClass(String name)Loads a user class using either the UIMA extension class loader (if specified) or the
 ThreadLocal Context Class Loader (if available) or the loader the UIMA framework is running in. | 
| static Class<?> | loadUserClass(String name,
             ResourceManager rm) | 
| static Class<?> | loadUserClassOrThrow(String name,
                    ResourceManager rm,
                    ResourceSpecifier aSpecifier) | 
| void | resolveAndValidateResourceDependencies(ExternalResourceDependency[] aDependencies,
                                      String aQualifiedContextName)Resolves a component's external resource dependencies (bindings) using this resource manager. | 
| URL | resolveRelativePath(String aRelativePath)Attempts to resolve a relative path to an absolute path using the same mechanism that the
 ResourceManager uses to find resources -- a lookup in the datapath followed by a lookup in the
 classpath. | 
| void | setCasManager(CasManager aCasManager)Sets the CasManager, which manages the creation and pooling of CASes. | 
| void | setDataPath(String aPath)Sets the data path used to resolve relative paths. | 
| void | setDataPathElements(File... aElements)Sets the data path elements used to resolve relative paths. | 
| void | setDataPathElements(String... aElements)Sets the data path elements used to resolve relative paths. | 
| void | setExtensionClassLoaderImpl(ClassLoader classLoader,
                           boolean resolveResource) | 
| void | setExtensionClassPath(ClassLoader parent,
                     String classpath,
                     boolean resolveResource)Sets the classpath for the UIMA extension ClassLoader and specifies if the extension
 ClassLoader should also be used to resolve resources. | 
| void | setExtensionClassPath(String classpath,
                     boolean resolveResource)/** | 
| void | setExtensionClassPath(org.apache.uima.internal.util.UIMAClassLoader uimaCL,
                     boolean resolveResource)Support reusing UIMA Class Loader instances to speed up things including the Component
 Description Editor when obtaining info from CustomResourceSpecifiers
 https://issues.apache.org/jira/browse/UIMA-1722 | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetExtensionClassLoaderprotected static final String LOG_RESOURCE_BUNDLE
protected final Map<String,Object> mResourceMap
protected final Map<String,ResourceManager_impl.ResourceRegistration> mInternalResourceRegistrationMap
protected final Map<String,Class<?>> mParameterizedResourceImplClassMap
protected final Map<String,Class<?>> mInternalParameterizedResourceImplClassMap
protected final Map<List<Object>,Object> mParameterizedResourceInstanceMap
protected volatile CasManager mCasManager
public ResourceManager_impl()
ResourceManager_impl.public ResourceManager_impl(ClassLoader aClassLoader)
ResourceManager_impl with a custom ClassLoader to use for locating
 resources.aClassLoader - -public ResourceManager_impl(Map<String,Object> resourceMap, Map<String,ResourceManager_impl.ResourceRegistration> internalResourceRegistrationMap, Map<String,Class<?>> parameterizedResourceImplClassMap, Map<String,Class<?>> internalParameterizedResourceImplClassMap, Map<List<Object>,Object> parameterizedResourceInstanceMap)
public ResourceManager_impl copy()
public void setExtensionClassPath(org.apache.uima.internal.util.UIMAClassLoader uimaCL,
                                  boolean resolveResource)
uimaCL - -resolveResource - -public void setExtensionClassPath(String classpath, boolean resolveResource) throws MalformedURLException
setExtensionClassPath in interface ResourceManagerclasspath - extension ClassLoader classpathresolveResource - if true ClassLoad resolves resourcesMalformedURLException - if a malformed URL has occurred in the classpath string.ResourceManager.setExtensionClassPath(java.lang.String, boolean)public void setExtensionClassPath(ClassLoader parent, String classpath, boolean resolveResource) throws MalformedURLException
ResourceManagersetExtensionClassPath in interface ResourceManagerparent - parent ClassLoader for the extension ClassLoaderclasspath - extension ClassLoader classpathresolveResource - if true ClassLoad resolves resourcesMalformedURLException - if a malformed URL has occurred in the classpath string.ResourceManager.setExtensionClassPath(ClassLoader,java.lang.String,
      boolean)public void setExtensionClassLoaderImpl(ClassLoader classLoader, boolean resolveResource)
public ClassLoader getExtensionClassLoader()
ResourceManagergetExtensionClassLoader in interface ResourceManagerResourceManager.getExtensionClassLoader()public String getDataPath()
ResourceManagerpath.separator character (; on windows, : on
 UNIX).getDataPath in interface ResourceManagerResourceManager.getDataPath()public List<String> getDataPathElements()
ResourceManagergetDataPathElements in interface ResourceManagerpublic void setDataPath(String aPath) throws MalformedURLException
ResourceManagerpath.separator character (; on windows, : on
 UNIX). Elements of this path may be absolute or relative file paths.setDataPath in interface ResourceManageraPath - the data pathMalformedURLException - if an element of the path is neither a valid URL or a valid file pathResourceManager.setDataPath(String)public void setDataPathElements(String... aElements) throws MalformedURLException
ResourceManagersetDataPathElements in interface ResourceManageraElements - the data pathMalformedURLException - if an element of the path is neither a valid URL or a valid file pathpublic void setDataPathElements(File... aElements) throws MalformedURLException
ResourceManagersetDataPathElements in interface ResourceManageraElements - the data pathMalformedURLException - if an element of the path is neither a valid URL or a valid file pathpublic URL resolveRelativePath(String aRelativePath) throws MalformedURLException
ResourceManagerresolveRelativePath in interface ResourceManageraRelativePath - a relative URL or file pathaRelativePath is found.MalformedURLException - if the path cannot be converted to a URLpublic Object getResource(String aName) throws ResourceAccessException
ResourceManagergetResource in interface ResourceManageraName - the name of the resource to retrieveaName, null if none exists.ResourceAccessException - if the requested resource could not be initialized. A common cause is that it
           requires parameters and the ResourceManager.getResource(String,String[]) method should have
           been called instead of this method.ResourceManager.getResource(String)public Object getResource(String aName, String[] aParams) throws ResourceAccessException
ResourceManagergetResource in interface ResourceManageraName - the name of the parameterized resource to retrieveaParams - the parameters determining which particular instance is returned and specifying a
          particular DataResource instance to use in initializing the implementation of the
          resource (if there is an implementation).
 
          If there is no implementation, the DataResource instance produced from the named
          Resource given these parameters is returned instead.null.ResourceAccessException - if there is a resource registered under aName but it could not be
           instantiated for the specified parameters.ResourceManager.getResource(java.lang.String, java.lang.String[])public Class<?> getResourceClass(String aName)
ResourceManagerResourceManager.getResource(String)
 or ResourceManager.getResource(String,String[]).
 
 For those resource specifications which include an implementation class, this call returns that
 class.getResourceClass in interface ResourceManageraName - the name of a resourceaName, null if there is no
         resource registered under that name.ResourceManager.getResourceClass(java.lang.String)public InputStream getResourceAsStream(String aKey, String[] aParams) throws ResourceAccessException
ResourceManagergetResourceAsStream in interface ResourceManageraKey - the key by which the resource is identified. If this key was declared in the
          <externalResourceDependencies> section of the annotator's descriptor, then the
          resource manager is used to locate the resource. If not, the key is assumed to be the
          resource name and is looked up in the data path or in the class
          path using ClassLoader.getResource(String).aParams - parameters used to further identify the resourceInputStream for reading from the named resource, null if
         the named resource could not be found. It is the caller's responsibility to close this
         stream once it is no longer needed.ResourceAccessException - if a failure occurs in accessing the resourcepublic InputStream getResourceAsStream(String aKey) throws ResourceAccessException
ResourceManagergetResourceAsStream in interface ResourceManageraKey - the key by which the resource is identified. If this key was declared in the
          <externalResourceDependencies> section of the annotator's descriptor, then the
          resource manager is used to locate the resource. If not, the key is assumed to be the
          resource name and is looked up in the data path or in the class
          path using ClassLoader.getResource(String).InputStream for reading from the named resource, null if
         the named resource could not be found. It is the caller's responsibility to close this
         stream once it is no longer needed.ResourceAccessException - if a failure occurs in accessing the resourcepublic URL getResourceURL(String aKey, String[] aParams) throws ResourceAccessException
ResourceManagergetResourceURL in interface ResourceManageraKey - the key by which the resource is identified. If this key was declared in the
          <externalResourceDependencies> section of the annotator's descriptor, then the
          resource manager is used to locate the resource. If not, the key is assumed to be the
          resource name and is looked up in the data path or in the class
          path using ClassLoader.getResource(String).aParams - parameters used to further identify the resourceURL at which the named resource is located, null if the
         named resource could not be found.ResourceAccessException - if a failure occurs in accessing the resourcepublic URL getResourceURL(String aKey) throws ResourceAccessException
ResourceManagergetResourceURL in interface ResourceManageraKey - the key by which the resource is identified. If this key was declared in the
          <externalResourceDependencies> section of the descriptor, then the resource
          manager is used to locate the resource. If not, the key is assumed to be the resource
          name and is looked up in the data path or in the class path
          using ClassLoader.getResource(String).URL at which the named resource is located, null if the
         named resource could not be found.ResourceAccessException - if a failure occurs in accessing the resourcepublic void initializeExternalResources(ResourceManagerConfiguration aConfiguration, String aQualifiedContextName, Map<String,Object> aAdditionalParams) throws ResourceInitializationException
ResourceManagerinitializeExternalResources in interface ResourceManageraConfiguration - the ResourceManagerConfiguration containing resource declarations and bindingsaQualifiedContextName - qualified name of UimaContext for the component (e.g. analysis engine) that is
          declaring these external resourcesaAdditionalParams - additional parameters to be passed to resource initialize methodsResourceInitializationException - if an initialization failure occurspublic void resolveAndValidateResourceDependencies(ExternalResourceDependency[] aDependencies, String aQualifiedContextName) throws ResourceInitializationException
ResourceManagerresolveAndValidateResourceDependencies in interface ResourceManageraDependencies - declarations of a component's dependencies on external resourcesaQualifiedContextName - qualified name of UimaContext for the component (e.g. analysis engine) that is
          declaring these dependenciesResourceInitializationException - if a required dependency is not satisfiedpublic CasManager getCasManager()
ResourceManagergetCasManager in interface ResourceManagerpublic void setCasManager(CasManager aCasManager)
ResourceManager
 This method can only be called once, and must be called before creating any AnalysisEngines
 that use this ResourceManager. An Exception will be thrown if this method is called twice or is
 called after ResourceManager.getCasManager() has already been called (which happens during AE
 initialization).
setCasManager in interface ResourceManageraCasManager - CAS Manager instance to plug inprotected RelativePathResolver getRelativePathResolver()
public Map<String,XMLizable> getImportCache()
ResourceManagergetImportCache in interface ResourceManager@Deprecated public Map<String,Set<String>> getImportUrlsCache()
org.apache.uima.resource.metadata.impl.ImportResolver.public <N> Class<N> loadUserClass(String name) throws ClassNotFoundException
ResourceManagerloadUserClass in interface ResourceManagerN - generic class of classname - the class to loadClassNotFoundException - -public static Class<?> loadUserClass(String name, ResourceManager rm) throws ClassNotFoundException
ClassNotFoundExceptionpublic static Class<?> loadUserClassOrThrow(String name, ResourceManager rm, ResourceSpecifier aSpecifier) throws ResourceInitializationException
ResourceInitializationExceptionpublic void destroy()
ResourceManagerdestroy in interface ResourceManagerpublic List<Object> getExternalResources()
getExternalResources in interface ResourceManagerCopyright © 2006–2022 The Apache Software Foundation. All rights reserved.