Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.car
Class CarClassLoader

    java.lang.Object
      java.lang.ClassLoader
          java.security.SecureClassLoader
              org.jasig.portal.car.CarClassLoader

    public class CarClassLoader

extends java.security.SecureClassLoader

Loads classes and resources from installed CARs via the CarResources class. If classes are visible via the parent class loader then they will be used in place of those in the CARs. This is a singleton so that we have a single unified class namespace for all car resources preventing linkage errors and class cast exceptions.

Version:
  $Revision: 1.11 $
Author:
  Mark Boyd

Field Summary
`private static org.apache.commons.logging.Log` | `log`
`static java.lang.String` | `RCS_ID`

Constructor Summary
`CarClassLoader()` Create a CarClassLoader.
`CarClassLoader(java.lang.ClassLoader cl)` Create a CarClassloader with the indicated parent class loader.

Method Summary
`private void` | `createPackage(java.lang.String pkgName)` Creates the package name for the calling class, which is null by default based on the JavaDoc for ClassLoader.
`private java.lang.Class` | `defineTheClass(java.lang.String n, byte[] b, int offset, int len)` Create and return the Class object from the passed in class bytes.
`java.lang.Class` | `findClass(java.lang.String name)` Implement the overloading of findClass to return classes that are available from installed CAR files.
`java.net.URL` | `findResource(java.lang.String res)` Returns a URL pointing to a car resource if a suitable resource is found in the loaded set of CAR files or null if one is not found.
`private java.lang.String` | `getPackageName(java.lang.String name)` Returns a package name from a package/classname path.

Methods inherited from class java.security.SecureClassLoader
`defineClass, defineClass, getPermissions`

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, 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`

Field Detail

### RCS_ID

    public static final java.lang.String RCS_ID

See Also:
  Constant Field Values

### log

    private static final org.apache.commons.logging.Log log

Constructor Detail

### CarClassLoader

    CarClassLoader()

  Create a CarClassLoader. This method has package scope so that CarResources can instantiate it and hold the single instance to be aquired via its getClassLoader() method.

### CarClassLoader

    CarClassLoader(java.lang.ClassLoader cl)

  Create a CarClassloader with the indicated parent class loader. See comment for zero parameter constructor for description of package scoping.

Method Detail

### findClass

    public java.lang.Class findClass(java.lang.String name)
                              throws java.lang.ClassNotFoundException

  Implement the overloading of findClass to return classes that are available from installed CAR files. Class loading precedes with the parent classloader first which delegates to this class loader if the classes aren't found.

  Overrides:
    `findClass` in class `java.lang.ClassLoader`
  Throws:
    `java.lang.ClassNotFoundException`

### defineTheClass

    private java.lang.Class defineTheClass(java.lang.String n,
                                           byte[] b,
                                           int offset,
                                           int len)

  Create and return the Class object from the passed in class bytes. This code enables the inner class used in findClass() to call into the superclass's defineClass method. It has protected scope in the superclass and hence is not visible to an innner class but is visible to this class.

### createPackage

    private void createPackage(java.lang.String pkgName)

  Creates the package name for the calling class, which is null by default based on the JavaDoc for ClassLoader. The package must be created prior to defining the Class.

  Parameters:
    `pkgName` - the package to create.

### getPackageName

    private java.lang.String getPackageName(java.lang.String name)

  Returns a package name from a package/classname path. If the package is not available (default package), then null is returned.

  Parameters:
    `name` - the package/class name.
  Returns:
    the package name (dot notation) or null if not found

### findResource

    public java.net.URL findResource(java.lang.String res)

  Returns a URL pointing to a car resource if a suitable resource is found in the loaded set of CAR files or null if one is not found.

  Overrides:
    `findResource` in class `java.lang.ClassLoader`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD