public class ResourceManager_impl extends java.lang.Object implements ResourceManager
ResourceManager.| Modifier and Type | Class and Description |
|---|---|
protected static class |
ResourceManager_impl.ResourceRegistration |
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
LOG_RESOURCE_BUNDLE
resource bundle for log messages
|
protected CasManager |
mCasManager
CasManager - manages creation and pooling of CASes.
|
protected java.util.Map<java.lang.String,java.lang.Class<?>> |
mInternalParameterizedResourceImplClassMap
Internal map from resource names (declared in resource declaration XML) to Class objects.
|
protected java.util.Map<java.lang.String,ResourceManager_impl.ResourceRegistration> |
mInternalResourceRegistrationMap
Internal map from resource names (declared in resource declaration XML) to ResourceRegistration
objects.
|
protected java.util.Map<java.lang.String,java.lang.Class<?>> |
mParameterizedResourceImplClassMap
Map from String keys to Class objects.
|
protected java.util.Map<java.util.List<java.lang.Object>,java.lang.Object> |
mParameterizedResourceInstanceMap
Map from ArrayList(0:String,1:DataResource) keys to Resource objects.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
mResourceMap
Map from qualified key names (declared in resource dependency XML) to Resource objects.
|
| Constructor and Description |
|---|
ResourceManager_impl()
Creates a new
ResourceManager_impl. |
ResourceManager_impl(java.lang.ClassLoader aClassLoader)
Creates a new
ResourceManager_impl with a custom ClassLoader to use for locating
resources. |
| Modifier and Type | Method and Description |
|---|---|
CasManager |
getCasManager()
Gets the CasManager, which manages the creation and pooling of CASes.
|
java.lang.String |
getDataPath()
Gets the data path used to resolve relative paths.
|
java.lang.ClassLoader |
getExtensionClassLoader()
Returns the UIMA extension class loader.
|
java.util.Map<java.lang.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.
|
protected RelativePathResolver |
getRelativePathResolver() |
java.lang.Object |
getResource(java.lang.String aName)
Gets the Resource that has been registered under the specified name.
|
java.lang.Object |
getResource(java.lang.String aName,
java.lang.String[] aParams)
Gets an instance of a parameterized Resource.
|
java.io.InputStream |
getResourceAsStream(java.lang.String aKey)
Retrieves an InputStream for reading from the named resource.
|
java.io.InputStream |
getResourceAsStream(java.lang.String aKey,
java.lang.String[] aParams)
Retrieves an InputStream for reading from the named resource.
|
java.lang.Class<? extends Resource> |
getResourceClass(java.lang.String aName)
Gets the Class of the Resource that will be returned by a call to
ResourceManager.getResource(String)
or ResourceManager.getResource(String,String[]). |
java.net.URL |
getResourceURL(java.lang.String aKey)
Retrieves the URL to the named resource.
|
java.net.URL |
getResourceURL(java.lang.String aKey,
java.lang.String[] aParams)
Retrieves the URL to the named resource.
|
void |
initializeExternalResources(ResourceManagerConfiguration aConfiguration,
java.lang.String aQualifiedContextName,
java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams)
Initializes all external resources declared in a ResourceCreationSpecifier.
|
void |
resolveAndValidateResourceDependencies(ExternalResourceDependency[] aDependencies,
java.lang.String aQualifiedContextName)
Resolves a component's external resource dependencies using this resource manager.
|
java.net.URL |
resolveRelativePath(java.lang.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(java.lang.String aPath)
Sets the data path used to resolve relative paths.
|
void |
setExtensionClassPath(java.lang.ClassLoader parent,
java.lang.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(java.lang.String classpath,
boolean resolveResource)
/**
|
void |
setExtensionClassPath(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
|
protected static final java.lang.String LOG_RESOURCE_BUNDLE
protected java.util.Map<java.lang.String,java.lang.Object> mResourceMap
protected java.util.Map<java.lang.String,ResourceManager_impl.ResourceRegistration> mInternalResourceRegistrationMap
protected java.util.Map<java.lang.String,java.lang.Class<?>> mParameterizedResourceImplClassMap
protected java.util.Map<java.lang.String,java.lang.Class<?>> mInternalParameterizedResourceImplClassMap
protected java.util.Map<java.util.List<java.lang.Object>,java.lang.Object> mParameterizedResourceInstanceMap
protected CasManager mCasManager
public ResourceManager_impl()
ResourceManager_impl.public ResourceManager_impl(java.lang.ClassLoader aClassLoader)
ResourceManager_impl with a custom ClassLoader to use for locating
resources.public void setExtensionClassPath(UIMAClassLoader uimaCL, boolean resolveResource)
uimaCL - resolveResource - public void setExtensionClassPath(java.lang.String classpath,
boolean resolveResource)
throws java.net.MalformedURLException
setExtensionClassPath in interface ResourceManagerclasspath - extension ClassLoader classpathresolveResource - if true ClassLoad resolves resourcesjava.net.MalformedURLException - if a malformed URL has occurred in the classpath string.ResourceManager.setExtensionClassPath(java.lang.String, boolean)public void setExtensionClassPath(java.lang.ClassLoader parent,
java.lang.String classpath,
boolean resolveResource)
throws java.net.MalformedURLException
ResourceManagersetExtensionClassPath in interface ResourceManagerparent - parent ClassLoader for the extension ClassLoaderclasspath - extension ClassLoader classpathresolveResource - if true ClassLoad resolves resourcesjava.net.MalformedURLException - if a malformed URL has occurred in the classpath string.ResourceManager.setExtensionClassPath(ClassLoader,java.lang.String,
boolean)public java.lang.ClassLoader getExtensionClassLoader()
ResourceManagergetExtensionClassLoader in interface ResourceManagerResourceManager.getExtensionClassLoader()public java.lang.String getDataPath()
ResourceManagerpath.separator character (; on windows, : on
UNIX).getDataPath in interface ResourceManagerResourceManager.getDataPath()public void setDataPath(java.lang.String aPath)
throws java.net.MalformedURLException
ResourceManagerpath.separator character (; on windows, : on
UNIX). The elements of this path may be URLs or File paths.setDataPath in interface ResourceManageraPath - the data pathjava.net.MalformedURLException - if an element of the path is neither a valid URL or a valid file pathResourceManager.setDataPath(String)public java.net.URL resolveRelativePath(java.lang.String aRelativePath)
throws java.net.MalformedURLException
ResourceManagerresolveRelativePath in interface ResourceManageraRelativePath - a relative URL or file pathaRelativePath is found.java.net.MalformedURLExceptionpublic java.lang.Object getResource(java.lang.String aName)
throws ResourceAccessException
ResourceManagergetResource in interface ResourceManageraName - the name of the resource to retrieveaName, null if none
exists.ResourceAccessExceptionResourceManager.getResource(String)public java.lang.Object getResource(java.lang.String aName,
java.lang.String[] aParams)
throws ResourceAccessException
ResourceManagergetResource in interface ResourceManageraName - the name of the resource to retrieveaParams - the parameters determining which particular instance is returnednull if there is no resource registered under
the name aName.ResourceAccessExceptionResourceManager.getResource(java.lang.String, java.lang.String[])public java.lang.Class<? extends Resource> getResourceClass(java.lang.String aName)
ResourceManagerResourceManager.getResource(String)
or ResourceManager.getResource(String,String[]).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 java.io.InputStream getResourceAsStream(java.lang.String aKey,
java.lang.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 java.io.InputStream getResourceAsStream(java.lang.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 java.net.URL getResourceURL(java.lang.String aKey,
java.lang.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 java.net.URL getResourceURL(java.lang.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, java.lang.String aQualifiedContextName, java.util.Map<java.lang.String,java.lang.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, java.lang.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 java.util.Map<java.lang.String,XMLizable> getImportCache()
ResourceManagergetImportCache in interface ResourceManagerCopyright © 2013. All Rights Reserved.