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.instrument
Class Instrumentor

    java.lang.Object
      org.jboss.aop.instrument.Instrumentor

Direct Known Subclasses:
  ClassicInstrumentor, GeneratedAdvisorInstrumentor

public abstract class Instrumentor
extends Object

Transforms byte code, making a class advisable. Implements command line class instrumentor as well. Reads classes from class path and creates advised versions in specified directory. Usage:

     Instrumentor [dest. directory] [class[ class...]]

You can control which instrumentor to use by passing in the jboss.aop.instrumentor system property.

Version:
  $Revision: 1.51 $
Author:
  Bill Burke, Austin Chau, Bob Lee, Kabir Khan

Field Summary
`static String` | `AOP_PACKAGE` Package of AOP classes.
`static String` | `ASPECT_MANAGER_CLASS_NAME` Name of helper class.
`protected boolean` | `basicsSet`
`protected AOPClassPool` | `classPool`
`protected javassist.CodeConverter` | `converter`
`static String` | `HELPER_FIELD_NAME` Helper class's field name.
`protected JoinpointClassifier` | `joinpointClassifier`
`protected AspectManager` | `manager`
`protected static Collection` | `processedClasses`

Constructor Summary
`protected` | `Instrumentor(AOPClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)` Constructs new instrumentor.
`protected` | `Instrumentor(AspectManager manager, JoinpointClassifier joinpointClassifier)`

Method Summary
`protected javassist.CtField` | `addProtectedField(javassist.CtClass clazz, String name, String typeName, javassist.CtField.Initializer initializer)` Adds a protected field to a class.
`protected javassist.CtField` | `addStaticField(javassist.CtClass clazz, String name, String typeName, javassist.CtField.Initializer initializer)` Adds a static field to a class.
`boolean` | `applyCallerPointcuts(javassist.CtClass clazz, ClassAdvisor advisor)`
`void` | `convertProcessedClasses(HotSwapper hotSwapper, javassist.CtClass clazz, Collection fieldReads, Collection fieldWrites, boolean constructor)` Converts all processed classes to make wrapping of the appropriate joinpoints.
`protected boolean` | `convertReferences(javassist.CtClass clazz)` Find all classes that this class references.
`protected abstract javassist.CtMethod` | `createMixinInvokeMethod(javassist.CtClass clazz, javassist.CtClass mixinClass, String initializer, javassist.CtMethod method, long hash)` Creates generic invoke method to be wrapped by real signatures.
`protected abstract void` | `doSetupBasics(javassist.CtClass clazz)`
`javassist.CtClass` | `forName(String name)` Gets a class by its name.
`static List` | `getAdvisableFields(javassist.CtClass clazz)` Gets sorted collection of advisable methods.
`javassist.ClassPool` | `getClassPool()`
`List` | `getConstructors(javassist.CtClass clazz)`
`void` | `interceptorChainsUpdated(Collection joinpointUpdates, HotSwapper hotSwapper)` Notifies the `Instrumentor` that some joinpoint status were updated.
`protected abstract void` | `intitialiseTransformers()`
`static boolean` | `isAdvisable(javassist.CtField field)` Is the method advisable?
`static boolean` | `isAdvisable(javassist.CtMethod method)` Is the method advisable?
`boolean` | `isAdvised(javassist.CtClass clazz)`
`protected boolean` | `isBaseClass(javassist.CtClass clazz)`
`static boolean` | `isTransformable(javassist.CtClass clazz)`
`protected static String` | `mixinFieldName(javassist.CtClass mixinClass)`
`void` | `setupBasics(javassist.CtClass clazz)`
`protected boolean` | `shouldNotTransform(javassist.CtClass clazz)`
`boolean` | `transform(javassist.CtClass clazz, ClassAdvisor advisor)` Makes class advisable.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### AOP_PACKAGE

    public static final String AOP_PACKAGE

  Package of AOP classes.

### ASPECT_MANAGER_CLASS_NAME

    public static final String ASPECT_MANAGER_CLASS_NAME

  Name of helper class.

### HELPER_FIELD_NAME

    public static final String HELPER_FIELD_NAME

  Helper class's field name.

  See Also:
    Constant Field Values

### classPool

    protected AOPClassPool classPool

### basicsSet

    protected boolean basicsSet

### converter

    protected javassist.CodeConverter converter

### manager

    protected AspectManager manager

### joinpointClassifier

    protected JoinpointClassifier joinpointClassifier

### processedClasses

    protected static Collection processedClasses

Constructor Detail

### Instrumentor

    protected Instrumentor(AOPClassPool pool,
                           AspectManager manager,
                           JoinpointClassifier joinpointClassifier,
                           DynamicTransformationObserver observer)

  Constructs new instrumentor.

Parameters:
  `observer` - need be notified of every joinpoint wrapping caused only by pointcuts dynamicaly added.

### Instrumentor

    protected Instrumentor(AspectManager manager,
                           JoinpointClassifier joinpointClassifier)

Method Detail

### intitialiseTransformers

    protected abstract void intitialiseTransformers()

### getClassPool

    public javassist.ClassPool getClassPool()

### isAdvisable

    public static boolean isAdvisable(javassist.CtMethod method)

  Is the method advisable?

### isAdvisable

    public static boolean isAdvisable(javassist.CtField field)

  Is the method advisable?

### isAdvised

    public boolean isAdvised(javassist.CtClass clazz)
                      throws javassist.NotFoundException

  Throws:
    `javassist.NotFoundException`

### isTransformable

    public static boolean isTransformable(javassist.CtClass clazz)
                                   throws javassist.NotFoundException

  Throws:
    `javassist.NotFoundException`

### isBaseClass

    protected boolean isBaseClass(javassist.CtClass clazz)
                           throws javassist.NotFoundException

  Throws:
    `javassist.NotFoundException`

### mixinFieldName

    protected static String mixinFieldName(javassist.CtClass mixinClass)

### applyCallerPointcuts

    public boolean applyCallerPointcuts(javassist.CtClass clazz,
                                        ClassAdvisor advisor)
                                 throws javassist.CannotCompileException

  Throws:
    `javassist.CannotCompileException`

### convertReferences

    protected boolean convertReferences(javassist.CtClass clazz)
                                 throws Exception

  Find all classes that this class references. If any of those classes are advised and have field and/or constructor interception, do instrumentation on this class so that those fields and constructors are instrumented

  Throws:
    `Exception`

### shouldNotTransform

    protected boolean shouldNotTransform(javassist.CtClass clazz)
                                  throws javassist.NotFoundException

  Throws:
    `javassist.NotFoundException`

### transform

    public boolean transform(javassist.CtClass clazz,
                             ClassAdvisor advisor)

  Makes class advisable.

### getConstructors

    public List getConstructors(javassist.CtClass clazz)

### getAdvisableFields

    public static List getAdvisableFields(javassist.CtClass clazz)
                                   throws javassist.NotFoundException

  Gets sorted collection of advisable methods.

  Throws:
    `javassist.NotFoundException`

### forName

    public javassist.CtClass forName(String name)
                              throws javassist.NotFoundException

  Gets a class by its name.

  Throws:
    `javassist.NotFoundException`

### addStaticField

    protected javassist.CtField addStaticField(javassist.CtClass clazz,
                                               String name,
                                               String typeName,
                                               javassist.CtField.Initializer initializer)
                                        throws javassist.CannotCompileException,
                                               javassist.NotFoundException

  Adds a static field to a class.

  Throws:
    `javassist.CannotCompileException`
    `javassist.NotFoundException`

### addProtectedField

    protected javassist.CtField addProtectedField(javassist.CtClass clazz,
                                                  String name,
                                                  String typeName,
                                                  javassist.CtField.Initializer initializer)
                                           throws javassist.CannotCompileException,
                                                  javassist.NotFoundException

  Adds a protected field to a class.

  Throws:
    `javassist.CannotCompileException`
    `javassist.NotFoundException`

### setupBasics

    public void setupBasics(javassist.CtClass clazz)
                     throws javassist.CannotCompileException,
                            javassist.NotFoundException

  Throws:
    `javassist.CannotCompileException`
    `javassist.NotFoundException`

### interceptorChainsUpdated

    public void interceptorChainsUpdated(Collection joinpointUpdates,
                                         HotSwapper hotSwapper)

  Notifies the `Instrumentor` that some joinpoint status were updated. This method hot swaps the code of afected classes.

  Parameters:
    `joinpointUpdates` - a collection of `org.jboss.aop.instrument.JoinpointStatusUpdate`.
    `hotSwapper` - object capable of hot swapping classes.

### convertProcessedClasses

    public void convertProcessedClasses(HotSwapper hotSwapper,
                                        javassist.CtClass clazz,
                                        Collection fieldReads,
                                        Collection fieldWrites,
                                        boolean constructor)

  Converts all processed classes to make wrapping of the appropriate joinpoints. This method must be called if some dynamic transformation ocurred (i. e. a class has just been loaded and one or more of its joinpoints were wrapped due only to bindings added dynamicaly; in this case, the previously loaded classes may not call the wrappers of this joinpoints, and need to be instrumented).

  Parameters:
    `clazz` - the clazz whose transformation involved dynamic wrapping.
    `fieldReads` - collection of fields whose read joinpoit was dynamicaly wrapped.
    `fieldWrites` - collection of fields whose read joinpoit was dynamicaly wrapped.
    `constructor` - `true` if the `clazz` constructors were dynamicaly wrapped.

### doSetupBasics

    protected abstract void doSetupBasics(javassist.CtClass clazz)
                                   throws javassist.CannotCompileException,
                                          javassist.NotFoundException

  Throws:
    `javassist.CannotCompileException`
    `javassist.NotFoundException`

### createMixinInvokeMethod

    protected abstract javassist.CtMethod createMixinInvokeMethod(javassist.CtClass clazz,
                                                                  javassist.CtClass mixinClass,
                                                                  String initializer,
                                                                  javassist.CtMethod method,
                                                                  long hash)
                                                           throws javassist.CannotCompileException,
                                                                  javassist.NotFoundException,
                                                                  Exception

  Creates generic invoke method to be wrapped by real signatures.

  Throws:
    `javassist.CannotCompileException`
    `javassist.NotFoundException`
    `Exception`

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.