Package org.apache.uima.internal.util
Class UIMAClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.apache.uima.internal.util.UIMAClassLoader
- All Implemented Interfaces:
Closeable
,AutoCloseable
UIMAClassLoader is used as extension ClassLoader for UIMA to load additional components like
annotators and resources. The classpath of the classloader is specified as string.
The strategy for this ClassLoader tries to load the class itself before the classloading is
delegated to the application class loader.
This loader supports loading a special class "MethodHandlesLookup" from
org.apache.uima.cas.impl.MethodHandlesLookup This is loaded from a byte string in order to have
the defaulting mechanism for MethodHandlesLookup default to this class loaders context.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionUIMAClassLoader
(ClassLoader parent) Creates a new UIMAClassLoader with the given parent ClassLoader.UIMAClassLoader
(String classpath) Creates a new UIMAClassLoader based on a classpath stringUIMAClassLoader
(String classpath, ClassLoader parent) Creates a new UIMAClassLoader based on a classpath string.UIMAClassLoader
(URL[] classpath) Creates a new UIMAClassLoader based on a classpath URL'sUIMAClassLoader
(URL[] classpath, ClassLoader parent) Creates a new UIMAClassLoader based on a classpath URL's. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getResource
(String name) boolean
isClosed()
The UIMA Class Loader extends URLClassLoader.protected Class
<?> static URLClassLoader
newInstance
(URL[] urls) Do not use this factory method - throws unsupportedOperationExceptionstatic URLClassLoader
newInstance
(URL[] urls, ClassLoader parent) Do not use this factory method - throws unsupportedOperationExceptionstatic URL[]
transformClasspath
(String classpath) Transforms the string classpath to a URL array based classpath.Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
MHLC
This is a trick to allow loading the same class multiple times in different UIMAClassLoaders https://issues.apache.org/jira/browse/UIMA-5030- See Also:
-
-
Constructor Details
-
UIMAClassLoader
Creates a new UIMAClassLoader based on a classpath string- Parameters:
classpath
- a classpath string- Throws:
MalformedURLException
- if a malformed URL has occurred in the classpath string.
-
UIMAClassLoader
Creates a new UIMAClassLoader based on a classpath URL's- Parameters:
classpath
- an array of wellformed classpath URL's
-
UIMAClassLoader
Creates a new UIMAClassLoader with the given parent ClassLoader.- Parameters:
parent
- specify the parent of the classloader
-
UIMAClassLoader
Creates a new UIMAClassLoader based on a classpath URL's. Also a parent ClassLoader can be specified.- Parameters:
classpath
- an array of wellformed classpath URL'sparent
- specify the parent of the classloader
-
UIMAClassLoader
Creates a new UIMAClassLoader based on a classpath string. Also a parent ClassLoader can be specified.- Parameters:
classpath
- a classpath stringparent
- specify the parent of the classloader- Throws:
MalformedURLException
- if a malformed URL has occurred in the classpath string.
-
-
Method Details
-
transformClasspath
Transforms the string classpath to a URL array based classpath. The classpath string must be separated with the file system path separator.- Parameters:
classpath
- a classpath string- Returns:
- URL[] array of well-formed URL's
- Throws:
MalformedURLException
- if a malformed URL has occurred in the classpath string.
-
newInstance
Do not use this factory method - throws unsupportedOperationException- Parameters:
urls
- -- Returns:
- -
- Throws:
UnsupportedOperationException
- -
-
newInstance
Do not use this factory method - throws unsupportedOperationException- Parameters:
urls
- -parent
- -- Returns:
- -
- Throws:
UnsupportedOperationException
- -
-
loadClass
- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-
getResource
- Overrides:
getResource
in classClassLoader
-
isClosed
public boolean isClosed()The UIMA Class Loader extends URLClassLoader. This kind of classloader supports the close() method. When this class loader is closed, it remembers this.- Returns:
- true if this class loader has been closed.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classURLClassLoader
- Throws:
IOException
-