ucar.unidata.util
Class PluginClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by ucar.unidata.util.PluginClassLoader

public class PluginClassLoader
extends ClassLoader

Class PluginClassLoader. Loads plugin classes

Version:
$Revision: 1.54 $
Author:
IDV Development Team

Field Summary
static String PLUGIN_PROTOCOL
          for url plugins
 
Constructor Summary
PluginClassLoader(String jarFilePath, ClassLoader parent)
          ctor
 
Method Summary
protected  void checkClass(Class c)
           
 void closeJar()
          Close the jar file
protected  String defineResource(JarEntry jarEntry)
          Associate the resource name with the jar entry
 Class getClassFromPlugin(String name)
          Check if this class is one we loaded from a plugin
 List getEntryNames()
          Get the list of (String) names of the non-class files in the jar
 URL getResource(String resource)
          Open the resource as a URL
 InputStream getResourceAsStream(String resource)
          Open the resource as a istream if we have it
protected  void handleError(String msg, Throwable exc)
           
 Class loadClass(String name)
          Overwrite base class method to load in a class by name
 String toString()
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, 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
 

Field Detail

PLUGIN_PROTOCOL

public static final String PLUGIN_PROTOCOL
for url plugins

See Also:
Constant Field Values
Constructor Detail

PluginClassLoader

public PluginClassLoader(String jarFilePath,
                         ClassLoader parent)
                  throws IOException
ctor

Parameters:
jarFilePath - Where the jar file is
parent - parent
Throws:
IOException - On badness
Method Detail

toString

public String toString()
Overrides:
toString in class Object

handleError

protected void handleError(String msg,
                           Throwable exc)

closeJar

public void closeJar()
Close the jar file


getEntryNames

public List getEntryNames()
Get the list of (String) names of the non-class files in the jar

Returns:
List of jar entries

checkClass

protected void checkClass(Class c)
                   throws Exception
Throws:
Exception

loadClass

public Class loadClass(String name)
                throws ClassNotFoundException
Overwrite base class method to load in a class by name

Overrides:
loadClass in class ClassLoader
Parameters:
name - class name
Returns:
The class
Throws:
ClassNotFoundException - On badness

getClassFromPlugin

public Class getClassFromPlugin(String name)
Check if this class is one we loaded from a plugin

Returns:
the class or null

defineResource

protected String defineResource(JarEntry jarEntry)
Associate the resource name with the jar entry

Parameters:
jarEntry - THe entry

getResource

public URL getResource(String resource)
Open the resource as a URL

Overrides:
getResource in class ClassLoader
Parameters:
resource - The resource
Returns:
The URL

getResourceAsStream

public InputStream getResourceAsStream(String resource)
Open the resource as a istream if we have it

Overrides:
getResourceAsStream in class ClassLoader
Parameters:
resource - The resource
Returns:
The istream