edu.umd.cs.findbugs
Class PluginLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by edu.umd.cs.findbugs.PluginLoader

public class PluginLoader
extends java.net.URLClassLoader

Loader for a FindBugs plugin. A plugin is a jar file containing two metadata files, "findbugs.xml" and "messages.xml". Those files specify

The PluginLoader creates a Plugin object to store the Detector factories and metadata.

Author:
David Hovemeyer
See Also:
Plugin, PluginException

Field Summary
private static int nextUnknownId
           
private  Plugin plugin
           
 
Constructor Summary
PluginLoader(java.net.URL url)
          Constructor.
PluginLoader(java.net.URL url, java.lang.ClassLoader parent)
          Constructor.
 
Method Summary
private  void addCollection(java.util.List<org.dom4j.Document> messageCollectionList, java.lang.String filename)
           
private static org.dom4j.Node findMessageNode(java.util.List<org.dom4j.Document> messageCollectionList, java.lang.String xpath, java.lang.String missingMsg)
           
private static java.lang.String getChildText(org.dom4j.Node node, java.lang.String childName)
           
 Plugin getPlugin()
          Get the Plugin.
private  void init()
           
private  java.lang.String lookupDetectorClass(Plugin plugin, java.lang.String name)
           
 
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
 

Field Detail

nextUnknownId

private static int nextUnknownId

plugin

private Plugin plugin
Constructor Detail

PluginLoader

public PluginLoader(java.net.URL url)
             throws PluginException
Constructor.

Parameters:
url - the URL of the plugin Jar file
Throws:
PluginException - if the plugin cannot be fully loaded

PluginLoader

public PluginLoader(java.net.URL url,
                    java.lang.ClassLoader parent)
             throws PluginException
Constructor.

Parameters:
url - the URL of the plugin Jar file
parent - the parent classloader
Throws:
PluginException
Method Detail

getPlugin

public Plugin getPlugin()
                 throws PluginException
Get the Plugin.

Throws:
PluginException - if the plugin cannot be fully loaded

init

private void init()
           throws PluginException
Throws:
PluginException

lookupDetectorClass

private java.lang.String lookupDetectorClass(Plugin plugin,
                                             java.lang.String name)
                                      throws PluginException
Throws:
PluginException

addCollection

private void addCollection(java.util.List<org.dom4j.Document> messageCollectionList,
                           java.lang.String filename)
                    throws org.dom4j.DocumentException
Throws:
org.dom4j.DocumentException

findMessageNode

private static org.dom4j.Node findMessageNode(java.util.List<org.dom4j.Document> messageCollectionList,
                                              java.lang.String xpath,
                                              java.lang.String missingMsg)
                                       throws PluginException
Throws:
PluginException

getChildText

private static java.lang.String getChildText(org.dom4j.Node node,
                                             java.lang.String childName)
                                      throws PluginException
Throws:
PluginException