org.dvb.lang
Class DVBClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byjava.security.SecureClassLoader
          extended byorg.dvb.lang.DVBClassLoader

public abstract class DVBClassLoader
extends java.security.SecureClassLoader

This class loader is used to load classes and resources from a search path of URLs referring to locations where Java class files may be stored.

The classes that are loaded are by default only allowed to load code through the parent classloader, or from the URLs specified when the DVBClassLoader was created.


Constructor Summary
DVBClassLoader(java.net.URL[] urls)
          Constructs a new DVBClassLoader for the given URLs.
DVBClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent)
          Constructs a new DVBClassLoader for the given URLs.
 
Method Summary
protected  java.lang.Class findClass(java.lang.String name)
          Finds and loads the class with the specified name from the URL search path.
static DVBClassLoader newInstance(java.net.URL[] urls)
          Creates a new instance of DVBClassLoader for the specified URLs.
static DVBClassLoader newInstance(java.net.URL[] urls, java.lang.ClassLoader parent)
          Creates a new instance of DVBClassLoader for the specified URLs.
 
Methods inherited from class java.security.SecureClassLoader
defineClass, getPermissions
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, 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

DVBClassLoader

public DVBClassLoader(java.net.URL[] urls)
Constructs a new DVBClassLoader for the given URLs. The URLs will be searched in the order specified for classes and resources.

If there is a security manager, this method first calls the security manager's checkCreateClassLoader method to ensure creation of a class loader is allowed.

Parameters:
urls - the URLs from which to load classes and resources
Throws:
java.lang.SecurityException - if a security manager exists and its checkCreateClassLoader method does not allow creation of a class loader.
See Also:
SecurityManager.checkCreateClassLoader()

DVBClassLoader

public DVBClassLoader(java.net.URL[] urls,
                      java.lang.ClassLoader parent)
Constructs a new DVBClassLoader for the given URLs. The URLs will be searched in the order specified for classes and resources.

If there is a security manager, this method first calls the security manager's checkCreateClassLoader method to ensure creation of a class loader is allowed.

Parameters:
urls - the URLs from which to load classes and resources
parent - the parent classloader for delegation
Throws:
java.lang.SecurityException - if a security manager exists and its checkCreateClassLoader method does not allow creation of a class loader.
See Also:
SecurityManager.checkCreateClassLoader()
Method Detail

findClass

protected java.lang.Class findClass(java.lang.String name)
                             throws java.lang.ClassNotFoundException
Finds and loads the class with the specified name from the URL search path. Any URLs are searched until the class is found.

Parameters:
name - the name of the class.
Returns:
the resulting class.
Throws:
java.lang.ClassNotFoundException - if the named class could not be found.

newInstance

public static DVBClassLoader newInstance(java.net.URL[] urls)
Creates a new instance of DVBClassLoader for the specified URLs. If a security manager is installed, the loadClass method of the DVBClassLoader returned by this method will invoke the SecurityManager.checkPackageAccess method before loading the class.

Parameters:
urls - the URLs to search for classes and resources.
Returns:
the resulting class loader

newInstance

public static DVBClassLoader newInstance(java.net.URL[] urls,
                                         java.lang.ClassLoader parent)
Creates a new instance of DVBClassLoader for the specified URLs. If a security manager is installed, the loadClass method of the DVBClassLoader returned by this method will invoke the SecurityManager.checkPackageAccess method before loading the class.

Parameters:
urls - the URLs to search for classes and resources.
parent - the parent class loader for delegation.
Returns:
the resulting class loader