Package com.atlassian.plugin.classloader
Class PluginClassLoader
java.lang.Object
java.lang.ClassLoader
com.atlassian.plugin.classloader.PluginClassLoader
A class loader used to load classes and resources from a given plugin.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPluginClassLoader(File pluginFile) PluginClassLoader(File pluginFile, ClassLoader parent) PluginClassLoader(File pluginFile, ClassLoader parent, File tempDirectory) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getLocalResource(String name) Gets the resource from this classloader onlygetResource(String name) Load the named resource from this plugin.protected Class<?>This implementation of loadClass uses a child first delegation model rather than the standard parent first.Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
PluginClassLoader
- Parameters:
pluginFile- file reference to the jar for this plugin
-
PluginClassLoader
- Parameters:
pluginFile- file reference to the jar for this pluginparent- the parent class loader
-
PluginClassLoader
- Parameters:
pluginFile- file reference to the jar for this pluginparent- the parent class loadertempDirectory- the temporary directory to store inner jars- Since:
- 2.0.2
-
-
Method Details
-
loadClass
This implementation of loadClass uses a child first delegation model rather than the standard parent first. If the requested class cannot be found in this class loader, the parent class loader will be consulted via the standardClassLoader.loadClass(String, boolean)mechanism.- Overrides:
loadClassin classClassLoader- Parameters:
name- Class to loadresolve- true to resolve all class dependencies when loaded- Returns:
- Class for the provided name
- Throws:
ClassNotFoundException- if the class cannot be found in this class loader or its parent
-
getResource
Load the named resource from this plugin. This implementation checks the plugin's contents first then delegates to the system loaders.- Overrides:
getResourcein classClassLoader- Parameters:
name- the name of the resource.- Returns:
- the URL to the resource,
nullif the resource was not found.
-
getLocalResource
Gets the resource from this classloader only- Parameters:
name- the name of the resource- Returns:
- the URL to the resource,
nullif the resource was not found
-
close
public void close() -
getPluginInnerJars
-