edu.yale.emailet
Class EmailetClassLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--java.security.SecureClassLoader
              |
              +--edu.yale.emailet.EmailetClassLoader

public class EmailetClassLoader
extends java.security.SecureClassLoader

This is a customized class loader for emailets.

Author:
Hong Jiang All the permissions are turned off. The emailet should accomplish tasks by calling functions provided by a "context class". A alternative is to control permission by java security policies.
See Also:
ClassLoader, SecureClassLoader

Constructor Summary
EmailetClassLoader()
          Equivalent to EmailetClassLoader(null)
 
Method Summary
protected  java.lang.Class findClass(java.lang.String name)
          The function will be called by loadClass to find and define non-system classes.
protected  InlineClass getInlineClass(java.lang.String name)
          Given the name of a class, get its byte code, or null.
 ObjectLoader getObjectLoader()
           
 void registerClass(InlineClass ic)
          register an class to the emailet classloader.
 void registerClass(java.lang.String name, byte[] bytes)
          Establish the association of a class name and its byte code.
 
Methods inherited from class java.security.SecureClassLoader
defineClass, getPermissions
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, 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

EmailetClassLoader

public EmailetClassLoader()
Equivalent to EmailetClassLoader(null)

Method Detail

getObjectLoader

public ObjectLoader getObjectLoader()
Returns:
The object loader used to read serialized objects.

findClass

protected java.lang.Class findClass(java.lang.String name)
                             throws java.lang.ClassNotFoundException
The function will be called by loadClass to find and define non-system classes. It first look at the classes explicitly registered by registerClass, then it will look at the repository. Class files in the repository can have the extension "class" or "ilc"

Overrides:
findClass in class java.lang.ClassLoader
Parameters:
name - Name of the class to load.
java.lang.ClassNotFoundException

registerClass

public void registerClass(java.lang.String name,
                          byte[] bytes)
                   throws java.lang.SecurityException
Establish the association of a class name and its byte code. findClass will find and load non-system classes from the set of registered classes.

java.lang.SecurityException

registerClass

public void registerClass(InlineClass ic)
                   throws java.lang.SecurityException
register an class to the emailet classloader.

Parameters:
ic - The class to be registered
Throws:
java.lang.SecurityException

getInlineClass

protected InlineClass getInlineClass(java.lang.String name)
Given the name of a class, get its byte code, or null.