com.atlassian.plugin.classloader
Class PluginsClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by com.atlassian.plugin.classloader.PluginsClassLoader

public class PluginsClassLoader
extends java.lang.ClassLoader

A ClassLoader that will loop over all enabled Plugins, attempting to load the given class (or other resource) from the ClassLoader of each plugin in turn.

See Also:
PluginClassLoader

Constructor Summary
PluginsClassLoader(java.lang.ClassLoader parent, PluginAccessor pluginAccessor)
           
PluginsClassLoader(PluginAccessor pluginAccessor)
           
 
Method Summary
protected  java.lang.Class<?> findClass(java.lang.String className)
           
protected  java.net.URL findResource(java.lang.String name)
           
protected  java.util.Enumeration<java.net.URL> findResources(java.lang.String name)
          The default implementation returns a "singleton" enumeration over the result of findResource(String).
 Plugin getPluginForClass(java.lang.String className)
          Returns the Plugin that will be used to load the given class name.
 void notifyPluginOrModuleEnabled()
           
 void notifyUninstallPlugin(Plugin plugin)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginsClassLoader

public PluginsClassLoader(PluginAccessor pluginAccessor)

PluginsClassLoader

public PluginsClassLoader(java.lang.ClassLoader parent,
                          PluginAccessor pluginAccessor)
Method Detail

findResource

protected java.net.URL findResource(java.lang.String name)

findClass

protected java.lang.Class<?> findClass(java.lang.String className)
                                throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

notifyUninstallPlugin

public void notifyUninstallPlugin(Plugin plugin)

getPluginForClass

public Plugin getPluginForClass(java.lang.String className)
Returns the Plugin that will be used to load the given class name. If no enabled plugin can load the given class, then null is returned.

Parameters:
className - the Class name
Returns:
the Plugin that will be used to load the given class name.
Since:
2.3

notifyPluginOrModuleEnabled

public void notifyPluginOrModuleEnabled()

findResources

protected java.util.Enumeration<java.net.URL> findResources(java.lang.String name)
                                                     throws java.io.IOException
The default implementation returns a "singleton" enumeration over the result of findResource(String).

Overrides:
findResources in class java.lang.ClassLoader
Parameters:
name - the name of the resource
Returns:
an enumeration over all matching resources
Throws:
java.io.IOException - This implementation will not throw this exception


Copyright © 2009 Atlassian. All Rights Reserved.