Class ChildFirstIndexedClassloader
java.lang.Object
java.lang.ClassLoader
de.oktoflow.platform.tools.lib.loader.ChildFirstIndexedClassloader
A priority (child first) class loader that takes its indexing from an index file.
- Author:
- ChatGPT, Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChildFirstIndexedClassloader(LoaderIndex index, ClassLoader parent) Creates an indexed classloader.ChildFirstIndexedClassloader(File index, ClassLoader parent) Creates an indexed classloader.ChildFirstIndexedClassloader(Map<String, String> locationIndex, Map<String, String> classIndex, Map<String, String> resourceIndex, ClassLoader parent) Creates an indexed classloader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close all cached jars when unloading plugin.protected Class<?> findResource(String name) getResourceAsStream(String name) private JarFileOpens a Jar from apath.private static byte[]As long as readAllBytes is not available on InputStream.Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
locationIndex
-
classIndex
-
resourceIndex
-
jarCache
-
-
Constructor Details
-
ChildFirstIndexedClassloader
public ChildFirstIndexedClassloader(Map<String, String> locationIndex, Map<String, String> classIndex, Map<String, String> resourceIndex, ClassLoader parent) Creates an indexed classloader.- Parameters:
classIndex- the class index (class-to-jar mapping)resourceIndex- the resource index (class-to-jar mapping)parent- the parent class loader
-
ChildFirstIndexedClassloader
Creates an indexed classloader.- Parameters:
index- the
-
ChildFirstIndexedClassloader
Creates an indexed classloader.- Parameters:
index- the- Throws:
IOException
-
-
Method Details
-
findClass
- Overrides:
findClassin classClassLoader- Throws:
ClassNotFoundException
-
readAllBytes
As long as readAllBytes is not available on InputStream. Do not use IOUtils here as plugin may not be loaded.- Parameters:
in- the input stream- Returns:
- the read bytes
- Throws:
IOException- if reading fails
-
findResource
- Overrides:
findResourcein classClassLoader
-
getResourceAsStream
- Overrides:
getResourceAsStreamin classClassLoader
-
openJar
Opens a Jar from apath.- Parameters:
path- the path- Returns:
- the
JarFile - Throws:
IllegalArgumentException- if the file cannot be opened
-
close
Close all cached jars when unloading plugin.- Throws:
IOException
-