org.apache.avalon.fortress.impl.factory
Class BCELWrapperGenerator.BCELClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.apache.avalon.fortress.impl.factory.BCELWrapperGenerator.BCELClassLoader
Enclosing class:
BCELWrapperGenerator

private final class BCELWrapperGenerator.BCELClassLoader
extends java.lang.ClassLoader

Author:
Avalon Development Team

Field Summary
private  byte[] m_byteCode
          The byte code representing the wrapper class created by the enclosing BCELWrapperGenerated.
private  java.security.ProtectionDomain m_protectionDomain
          The ProtectionDomain to use for the newly generated class.
 
Constructor Summary
BCELWrapperGenerator.BCELClassLoader()
          Constructs a BCELClassLoader with no parent.
BCELWrapperGenerator.BCELClassLoader(java.lang.ClassLoader parent)
          Constructs a BCELClassLoader with the specified class loader as its parent.
 
Method Summary
protected  java.lang.Class findClass(java.lang.String name)
           
private  byte[] getByteCode()
          Returns the byte code to use when loading a generated class.
private  void setup(byte[] byteCode, java.security.ProtectionDomain protectionDomain)
          Passes in data needed to create and initialze the new class when findClass is called by the BCELWrapperGenerator.
private  void tearDown()
          Clears the data used to generate a class to free up memory.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, 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
 

Field Detail

m_byteCode

private byte[] m_byteCode
The byte code representing the wrapper class created by the enclosing BCELWrapperGenerated. This field will be managed by the BCELWrapperGenerator.


m_protectionDomain

private java.security.ProtectionDomain m_protectionDomain
The ProtectionDomain to use for the newly generated class. When a SecurityManager is set, this will determine what privileges this class will have.

Constructor Detail

BCELWrapperGenerator.BCELClassLoader

public BCELWrapperGenerator.BCELClassLoader(java.lang.ClassLoader parent)
Constructs a BCELClassLoader with the specified class loader as its parent.

Parameters:
parent - The parent ClassLoader

BCELWrapperGenerator.BCELClassLoader

public BCELWrapperGenerator.BCELClassLoader()
Constructs a BCELClassLoader with no parent.

Method Detail

findClass

protected java.lang.Class findClass(java.lang.String name)
                             throws java.lang.ClassNotFoundException
Overrides:
findClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException
See Also:
ClassLoader.findClass(String)

setup

private void setup(byte[] byteCode,
                   java.security.ProtectionDomain protectionDomain)
            throws java.lang.IllegalArgumentException
Passes in data needed to create and initialze the new class when findClass is called by the BCELWrapperGenerator. This method will be called by the BCELWrapperGenerator prior to asking this class loader for the generated wrapper class.

Parameters:
byteCode - The byte code to use when loading the generated class
protectionDomain - The ProtectionDomain to use when loading the generated class.
Throws:
java.lang.IllegalArgumentException - If byteCode is null or empty

tearDown

private void tearDown()
Clears the data used to generate a class to free up memory. This method will be called by the BCELWrapperGenerator immediately after this class loader has returned the generated wrapper class.


getByteCode

private byte[] getByteCode()
Returns the byte code to use when loading a generated class.

Returns:
The byte code for defining the generated class