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.jboss.aop.standalone
Class SystemClassLoader

    java.lang.Object
      java.lang.ClassLoader
          org.jboss.aop.standalone.SystemClassLoader

public class SystemClassLoader
extends ClassLoader

A classloader that can be installed as the system classloader to enable aop translation based on files in META-INF/jboss-aop.xml in the classpath.

You will need the following jars in your classpath (log4j.jar is optional):

- jboss-aop.jar
- javassist.jar
- jboss-common.jar

Start the virtual machine with something like the following command:

     java -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader my.Main

Implementation Detail: All access to non-jre classes must be done through reflection the classes must be loaded using the loadLocally method.

Version:
  $Revision: 1.17 $
Author:
  Adrian Brock, Juha Lindfors

Constructor Summary
`SystemClassLoader(ClassLoader parent)` Construct a new system classloader.

Method Summary
`Class` | `defineClassFromBytes(String name, byte[] b, boolean resolve)` Define a class from the bytes
`protected void` | `definePackage(String className)` Define the package for the class if not already done
`protected void` | `initialize()` Initialize the aspect manager and load the static aspects
`protected void` | `install()` Install the classloader, get reflection objects and load classes using ourself.
`Class` | `loadClass(String name, boolean resolve)` Load a class, overridden to transform aop enhanced classes and load non jre classes through this classloader.
`protected Class` | `loadClassByDelegation(String name)` Load jre classes from the parent classloader
`protected byte[]` | `loadClassBytes(String name)` Load the bytecode for a class
`protected Class` | `loadClassLocally(String name)` Load a class using this classloader only

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, 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

### SystemClassLoader

    public SystemClassLoader(ClassLoader parent)

  Construct a new system classloader.

  We cannot do much here, we need to avoid recursion

Parameters:
  `parent` - the default system classloader

Method Detail

### loadClass

    public Class loadClass(String name,
                           boolean resolve)
                    throws ClassNotFoundException

  Load a class, overridden to transform aop enhanced classes and load non jre classes through this classloader.

  Parameters:
    `name` - the class name
    `resolve` - whether to resolve the class
  Returns:
    the class
  Throws:
    `ClassNotFoundException` - when there is no class

### loadClassBytes

    protected byte[] loadClassBytes(String name)
                             throws ClassNotFoundException,
                                    IOException

  Load the bytecode for a class

  Throws:
    `ClassNotFoundException`
    `IOException`

### defineClassFromBytes

    public Class defineClassFromBytes(String name,
                                      byte[] b,
                                      boolean resolve)

  Define a class from the bytes

  Parameters:
    `b` - the bytecode
    `resolve` - whether to resolve the class

### definePackage

    protected void definePackage(String className)

  Define the package for the class if not already done

### loadClassLocally

    protected Class loadClassLocally(String name)
                              throws ClassNotFoundException

  Load a class using this classloader only

  Parameters:
    `name` - the class name
  Returns:
    the class
  Throws:
    `ClassNotFoundException` - when there is no class

### loadClassByDelegation

    protected Class loadClassByDelegation(String name)
                                   throws ClassNotFoundException

  Load jre classes from the parent classloader

  Parameters:
    `name` - the class name
  Returns:
    the class
  Throws:
    `ClassNotFoundException` - when there is no class

### install

    protected void install()

  Install the classloader, get reflection objects and load classes using ourself.

### initialize

    protected void initialize()

  Initialize the aspect manager and load the static aspects

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

Copyright © 2004 JBoss Inc. All Rights Reserved.