Class PluginClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.jivesoftware.openfire.container.PluginClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable
ClassLoader for plugins. It searches the plugin directory for classes
and JAR files, then constructs a class loader for the resources found.
Resources are loaded as follows:
- Any JAR files in the
libwill be added to the classpath. - Any files in the classes directory will be added to the classpath.
- Author:
- Derek DeMoro
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDirectory(File directory) Adds a directory to the class loader.voidaddURLFile(URL file) Add the given URL to the classpath for this class loader, caching the JAR file connection so it can be unloaded latervoidUnload any JAR files that have been cached by this pluginMethods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstanceMethods inherited from class java.security.SecureClassLoader
defineClass, defineClassMethods 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, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
PluginClassLoader
public PluginClassLoader()
-
-
Method Details
-
addDirectory
Adds a directory to the class loader.- Parameters:
directory- the directory.
-
addURLFile
Add the given URL to the classpath for this class loader, caching the JAR file connection so it can be unloaded later- Parameters:
file- URL for the JAR file or directory to append to classpath
-
unloadJarFiles
public void unloadJarFiles()Unload any JAR files that have been cached by this plugin
-