org.dvb.lang
Class DVBClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by org.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
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.lang.ClassLoader
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
 
Methods inherited from class java.lang.Object
equals, 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

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