ataspectj.instrumentation
Class RepositoryLoader

java.lang.Object
  extended by ataspectj.AtAspectjComponent
      extended by ataspectj.instrumentation.RepositoryLoader

public class RepositoryLoader
extends AtAspectjComponent

Used to retrieve reflective object about classes.

Author:
Marco Poggi

Field Summary
 
Fields inherited from class ataspectj.AtAspectjComponent
barrier, CODEPRINT, DEBUG, VERBOSE
 
Constructor Summary
RepositoryLoader()
           
 
Method Summary
static org.apache.bcel.generic.Type[] convertType(java.lang.Class[] toconvert)
          It Converts the array of java Classes into an array of bcel Types.
static java.lang.reflect.Constructor[] getAllConstructorToInstrument(java.lang.String binaryClassName)
          It retuns all the java constructor that contain a block annotation.
static java.lang.reflect.Method[] getAllMethodToInstrument(java.lang.String binaryClassName)
          It retuns all the java methods that contain a block annotation.
static org.apache.bcel.classfile.Method getBCELMethodFromConstructor(org.apache.bcel.classfile.Method[] all, java.lang.reflect.Constructor c)
          Search the specified java.lang.reflect.Contructor into the array of org.apache.bcel.classfile.Method pass as argument
static org.apache.bcel.classfile.Method getBCELMethodFromMethod(org.apache.bcel.classfile.Method[] all, java.lang.reflect.Method c)
          Search the specified java.lang.reflect.Method into the array of org.apache.bcel.classfile.Method pass as argument
static InstrumentationRepository[] getBlockToInstrumentFromMethod(java.lang.reflect.Constructor c)
          It returns an array of InstrumentationRepository containing all the java block of the given Constructor to instrument.
static InstrumentationRepository[] getBlockToInstrumentFromMethod(java.lang.reflect.Method m)
          It returns an array of InstrumentationRepository containing all the java block of the given Method to instrument.
static InstrumentationRepository[] getConstructorAndMethodToInstrument(java.lang.String binaryClassName)
          It returns an array of InstrumentationRepository containing all the java block contained into the given Class to instrument.
static java.lang.Class[] getInnerClasses(java.lang.String binaryClassName)
          Used to retrieve all the inner classes of a class.
protected static boolean isLocalVariableInstruction(org.apache.bcel.generic.Instruction i)
          It checks if the Instruction is a sub class of LocalVariableInstruction.
protected static boolean isTheSame(org.apache.bcel.classfile.Method m, java.lang.reflect.Constructor c)
          It compares a java.lang.reflect.Constructor with a org.apache.bcel.classfile.Method, returns true if they are the same.
protected static boolean isTheSame(org.apache.bcel.classfile.Method m, java.lang.reflect.Method c)
          It compares a java.lang.reflect.Method with a org.apache.bcel.classfile.Method, returns true if they are the same.
 
Methods inherited from class ataspectj.AtAspectjComponent
done
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryLoader

public RepositoryLoader()
Method Detail

getInnerClasses

public static java.lang.Class[] getInnerClasses(java.lang.String binaryClassName)
                                         throws java.lang.ClassNotFoundException
Used to retrieve all the inner classes of a class.

Parameters:
binaryClassName - the name of the class to investigate
Returns:
an array of the inner classes.
Throws:
java.lang.ClassNotFoundException

getAllMethodToInstrument

public static java.lang.reflect.Method[] getAllMethodToInstrument(java.lang.String binaryClassName)
                                                           throws java.lang.ClassNotFoundException
It retuns all the java methods that contain a block annotation.

Parameters:
binaryClassName - The name of the class to check.
Returns:
The array af java methods
Throws:
java.lang.ClassNotFoundException - Raised if the class is not found.

getAllConstructorToInstrument

public static java.lang.reflect.Constructor[] getAllConstructorToInstrument(java.lang.String binaryClassName)
                                                                     throws java.lang.ClassNotFoundException
It retuns all the java constructor that contain a block annotation.

Parameters:
binaryClassName - The name of the class to check.
Returns:
The array af java constructors
Throws:
java.lang.ClassNotFoundException - Raised if the class is not found.

getBCELMethodFromConstructor

public static org.apache.bcel.classfile.Method getBCELMethodFromConstructor(org.apache.bcel.classfile.Method[] all,
                                                                            java.lang.reflect.Constructor c)
                                                                     throws ConstructorNotFoundException
Search the specified java.lang.reflect.Contructor into the array of org.apache.bcel.classfile.Method pass as argument

Parameters:
all - The array of org.apache.bcel.classfile.Mehtod.
c - The java.lang.reflect.Constructor
Returns:
The corresponding org.apache.bcel.classfile.Method.
Throws:
ConstructorNotFoundException - Raised if the Constructor was not found into the bcel methods array.

getBCELMethodFromMethod

public static org.apache.bcel.classfile.Method getBCELMethodFromMethod(org.apache.bcel.classfile.Method[] all,
                                                                       java.lang.reflect.Method c)
                                                                throws MethodNotFoundException
Search the specified java.lang.reflect.Method into the array of org.apache.bcel.classfile.Method pass as argument

Parameters:
all - The array of org.apache.bcel.classfile.Mehtod.
c - The java.lang.reflect.Method
Returns:
The corresponding org.apache.bcel.classfile.Method.
Throws:
MethodNotFoundException - Raised if the Constructor was not found into the bcel methods array.

isTheSame

protected static boolean isTheSame(org.apache.bcel.classfile.Method m,
                                   java.lang.reflect.Constructor c)
It compares a java.lang.reflect.Constructor with a org.apache.bcel.classfile.Method, returns true if they are the same.

Parameters:
m - the bcel method.
c - the java Construcotor.
Returns:
true if they are the same entity.

isTheSame

protected static boolean isTheSame(org.apache.bcel.classfile.Method m,
                                   java.lang.reflect.Method c)
It compares a java.lang.reflect.Method with a org.apache.bcel.classfile.Method, returns true if they are the same.

Parameters:
m - the bcel method.
c - the java Method.
Returns:
true if they are the same entity.

convertType

public static org.apache.bcel.generic.Type[] convertType(java.lang.Class[] toconvert)
It Converts the array of java Classes into an array of bcel Types.

Parameters:
toconvert - the array of java Classes.
Returns:
the converted array of bcel org.apache.genric.Type.

isLocalVariableInstruction

protected static boolean isLocalVariableInstruction(org.apache.bcel.generic.Instruction i)
It checks if the Instruction is a sub class of LocalVariableInstruction.

Parameters:
i - the Instruction to check.
Returns:
true if is a local variable instruction.

getBlockToInstrumentFromMethod

public static InstrumentationRepository[] getBlockToInstrumentFromMethod(java.lang.reflect.Method m)
                                                                  throws java.lang.ClassNotFoundException,
                                                                         MethodNotFoundException
It returns an array of InstrumentationRepository containing all the java block of the given Method to instrument.

Parameters:
m - the java.lang.Method to investigate.
Returns:
an arrays of InstrumentationRepository.
Throws:
java.lang.ClassNotFoundException - Raised if the java class of the given method is not found.
MethodNotFoundException - Raises if an internal error occours.

getBlockToInstrumentFromMethod

public static InstrumentationRepository[] getBlockToInstrumentFromMethod(java.lang.reflect.Constructor c)
                                                                  throws java.lang.ClassNotFoundException,
                                                                         ConstructorNotFoundException
It returns an array of InstrumentationRepository containing all the java block of the given Constructor to instrument.

Parameters:
c - the java.lang.reflect.Constructor to investigate.
Returns:
an arrays of InstrumentationRepository.
Throws:
java.lang.ClassNotFoundException - Raised if the java class of the given constructor is not found.
ConstructorNotfoundException - Raises if an internal error occours.
ConstructorNotFoundException

getConstructorAndMethodToInstrument

public static InstrumentationRepository[] getConstructorAndMethodToInstrument(java.lang.String binaryClassName)
                                                                       throws java.lang.ClassNotFoundException,
                                                                              ConstructorNotFoundException,
                                                                              MethodNotFoundException
It returns an array of InstrumentationRepository containing all the java block contained into the given Class to instrument.

Parameters:
binaryClassName - the name of java class to investigate.
Returns:
an arrays of InstrumentationRepository.
Throws:
java.lang.ClassNotFoundException - Raised if the java class is not found.
ConstructorNotfoundException - Raises if an internal error occours.
MethodNotFoundException - Raises if an internal error occours.
ConstructorNotFoundException