org.rhq.core.pc.plugin
Class PluginClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.rhq.core.pc.plugin.PluginClassLoader

public class PluginClassLoader
extends URLClassLoader

Classloader for the plugin jar itself and any embedded lib/* jars.


Constructor Summary
protected PluginClassLoader(URL[] urls, ClassLoader parent)
           
 
Method Summary
static PluginClassLoader create(String pluginJarName, URL[] pluginUrls, boolean unpackNestedJars, ClassLoader parent, File tmpDirectory)
          Creates a classloader for the given named plugin whose plugin jar is found at the URL found in the first index of the given URL array.
static PluginClassLoader create(String pluginJarName, URL pluginUrl, boolean unpackNestedJars, ClassLoader parent, File tmpDirectory)
          Creates a classloader for the given named plugin whose plugin jar is found at the given URL.
 void destroy()
           
protected  Class<?> loadClass(String name, boolean resolve)
           
 String toString()
           
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
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, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PluginClassLoader

protected PluginClassLoader(URL[] urls,
                            ClassLoader parent)
Method Detail

loadClass

protected Class<?> loadClass(String name,
                             boolean resolve)
                      throws ClassNotFoundException
Overrides:
loadClass in class ClassLoader
Throws:
ClassNotFoundException

destroy

public void destroy()

create

public static PluginClassLoader create(String pluginJarName,
                                       URL pluginUrl,
                                       boolean unpackNestedJars,
                                       ClassLoader parent,
                                       File tmpDirectory)
                                throws PluginContainerException
Creates a classloader for the given named plugin whose plugin jar is found at the given URL.

Parameters:
pluginJarName - the logical name of the plugin
pluginUrl - the location where the plugin jar can be found
unpackNestedJars - if true, any lib/*.jar files found in the plugin jar are unpacked and put in the classloader
parent - the parent classloader for the new classloader being created
tmpDirectory - the directory where the unpacked nested jars are placed
Returns:
the new plugin classloader
Throws:
PluginContainerException

create

public static PluginClassLoader create(String pluginJarName,
                                       URL[] pluginUrls,
                                       boolean unpackNestedJars,
                                       ClassLoader parent,
                                       File tmpDirectory)
                                throws PluginContainerException
Creates a classloader for the given named plugin whose plugin jar is found at the URL found in the first index of the given URL array. The rest of the URLs in the array are to be added to the classloader as additional jars.

Parameters:
pluginJarName - the logical name of the plugin
pluginUrls - the first element is the location where the plugin jar can be found, the remaining are additional URLs to jars that will be added to the new classloader
unpackNestedJars - if true, any lib/*.jar files found in the plugin jar are unpacked and put in the classloader. The additional jars are NEVER unpacked.
parent - the parent classloader for the new classloader being created
tmpDirectory - the directory where the unpacked nested jars are placed
Returns:
the new plugin classloader
Throws:
PluginContainerException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.