org.jivesoftware.spark.plugin
Class PluginClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.jivesoftware.spark.plugin.PluginClassLoader

public class PluginClassLoader
extends java.net.URLClassLoader

A simple classloader to extend the classpath to include all jars in a lib directory.

The new classpath includes all *.jar files.

Author:
Derek DeMoro

Constructor Summary
PluginClassLoader(java.lang.ClassLoader parent, java.io.File libDir)
          Constructs the classloader.
 
Method Summary
 void addPlugin(java.io.File pluginDir)
          Adds all archives in a plugin to the classpath.
 
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, 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

PluginClassLoader

public PluginClassLoader(java.lang.ClassLoader parent,
                         java.io.File libDir)
                  throws java.net.MalformedURLException
Constructs the classloader.

Parameters:
parent - the parent class loader (or null for none).
libDir - the directory to load jar files from.
Throws:
java.net.MalformedURLException - if the libDir path is not valid.
Method Detail

addPlugin

public void addPlugin(java.io.File pluginDir)
               throws java.net.MalformedURLException
Adds all archives in a plugin to the classpath.

Parameters:
pluginDir - the directory of the plugin.
Throws:
java.net.MalformedURLException - the exception thrown if URL is not valid.