org.codehaus.aspectwerkz.joinpoint.management
Class JoinPointBase

java.lang.Object
  extended byorg.codehaus.aspectwerkz.joinpoint.management.JoinPointBase
All Implemented Interfaces:
JoinPoint, Serializable, StaticJoinPoint

public abstract class JoinPointBase
extends Object
implements JoinPoint, Serializable

Base class for the join point implementations.

Author:
Jonas Bonér , Alexandre Vasseur
See Also:
Serialized Form

Field Summary
protected  AfterAdviceExecutor m_afterAdviceExecutor
           
protected  AroundAdviceExecutor m_aroundAdviceExecutor
           
protected  BeforeAdviceExecutor m_beforeAdviceExecutor
           
protected  boolean m_checkCflow
           
protected  JoinPointMetaData m_joinPointMetaData
           
protected  Map m_metaData
           
protected  PointcutType m_pointcutType
           
protected  AspectSystem m_system
           
protected  Class m_targetClass
           
protected  int m_type
           
protected  String m_typeAsString
           
 
Fields inherited from interface org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint
CONSTRUCTOR_CALL, CONSTRUCTOR_EXECUTION, FIELD_GET, FIELD_SET, HANDLER, METHOD_CALL, METHOD_EXECUTION, STATIC_INITIALIZATION
 
Constructor Summary
JoinPointBase(int type, Class targetClass, JoinPointMetaData joinPointMetaData, AroundAdviceExecutor aroundAdviceExecutor, BeforeAdviceExecutor beforeAdviceExecutor, AfterAdviceExecutor afterAdviceExecutor)
          Creates a new join point base instance.
JoinPointBase(String uuid, int type, Class targetClass, JoinPointMetaData joinPointMetaData, AroundAdviceExecutor aroundAdviceExecutor, BeforeAdviceExecutor beforeAdviceExecutor, AfterAdviceExecutor afterAdviceExecutor)
          Creates a new join point base instance.
JoinPointBase(String uuid, int type, Class targetClass, List cflow, ExpressionContext ctx, AroundAdviceExecutor aroundAdviceExecutor, BeforeAdviceExecutor beforeAdviceExecutor, AfterAdviceExecutor afterAdviceExecutor)
          Creates a new join point base instance.
 
Method Summary
 void addMetaData(Object key, Object value)
          Adds metadata.
 StaticJoinPoint deepCopy()
          Clones the join point instance.
abstract  Object[] extractArguments(int[] methodToArgIndexes)
          Extracts a subset of the joinPoint instance RTTI arguments.
 Object getCallee()
          Returns the callee instance.
 Object getCaller()
          Returns the caller instance.
 Class getCallerClass()
          Returns the caller class.
static String getJoinPointTypeAsString(int type)
          Sets the join point type to a string representation.
 Object getMetaData(Object key)
          Returns metadata matching a specfic key.
static PointcutType getPointcutType(int type)
          Sets the join point type to a string representation.
 Object getTarget()
          Returns the target instance ('this').
 Class getTargetClass()
          Returns the target class.
static Object getTargetField(JoinPoint joinPoint)
          Gets the target field.
 Object getThis()
          Returns the 'this' instance (the one currently executing).
 String getType()
          Returns the join point type.
static Object invokeJoinPoint(JoinPoint joinPoint, int joinPointType)
          Invoke the join point.
static Object invokeTargetConstructorCall(JoinPoint joinPoint)
          Invokes the original constructor.
static Object invokeTargetConstructorExecution(JoinPoint joinPoint)
          Invokes the prefixed constructor.
static Object invokeTargetMethodCall(JoinPoint joinPoint)
          Invokes the original method - call context.
static Object invokeTargetMethodExecution(JoinPoint joinPoint)
          Invokes the original method - execution context.
 boolean isInCflow()
          Checks if the join point is in the correct control flow.
 void reset()
          Resets the join point.
protected abstract  void setRtti(Rtti rtti)
          Allows to pass the RTTI to the JP.
static void setTargetField(JoinPoint joinPoint)
          Sets the target field.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.codehaus.aspectwerkz.joinpoint.JoinPoint
getRtti
 
Methods inherited from interface org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint
getSignature, proceed
 

Field Detail

m_targetClass

protected Class m_targetClass

m_type

protected int m_type

m_typeAsString

protected String m_typeAsString

m_system

protected transient AspectSystem m_system

m_checkCflow

protected boolean m_checkCflow

m_aroundAdviceExecutor

protected AroundAdviceExecutor m_aroundAdviceExecutor

m_beforeAdviceExecutor

protected BeforeAdviceExecutor m_beforeAdviceExecutor

m_afterAdviceExecutor

protected AfterAdviceExecutor m_afterAdviceExecutor

m_metaData

protected Map m_metaData

m_pointcutType

protected PointcutType m_pointcutType

m_joinPointMetaData

protected transient JoinPointMetaData m_joinPointMetaData
Constructor Detail

JoinPointBase

public JoinPointBase(int type,
                     Class targetClass,
                     JoinPointMetaData joinPointMetaData,
                     AroundAdviceExecutor aroundAdviceExecutor,
                     BeforeAdviceExecutor beforeAdviceExecutor,
                     AfterAdviceExecutor afterAdviceExecutor)
Creates a new join point base instance.

Parameters:
type -
targetClass -
joinPointMetaData -
aroundAdviceExecutor -
beforeAdviceExecutor -
afterAdviceExecutor -

JoinPointBase

public JoinPointBase(String uuid,
                     int type,
                     Class targetClass,
                     JoinPointMetaData joinPointMetaData,
                     AroundAdviceExecutor aroundAdviceExecutor,
                     BeforeAdviceExecutor beforeAdviceExecutor,
                     AfterAdviceExecutor afterAdviceExecutor)
Creates a new join point base instance.

Parameters:
uuid -
type -
targetClass -
joinPointMetaData -
aroundAdviceExecutor -
beforeAdviceExecutor -
afterAdviceExecutor -

JoinPointBase

public JoinPointBase(String uuid,
                     int type,
                     Class targetClass,
                     List cflow,
                     ExpressionContext ctx,
                     AroundAdviceExecutor aroundAdviceExecutor,
                     BeforeAdviceExecutor beforeAdviceExecutor,
                     AfterAdviceExecutor afterAdviceExecutor)
Creates a new join point base instance.

Parameters:
uuid -
type -
targetClass -
cflow -
ctx -
aroundAdviceExecutor -
beforeAdviceExecutor -
afterAdviceExecutor -
Method Detail

deepCopy

public StaticJoinPoint deepCopy()
Clones the join point instance.

Specified by:
deepCopy in interface StaticJoinPoint
Returns:

reset

public void reset()
Resets the join point.

Will restart the execution chain of advice.

Specified by:
reset in interface JoinPoint

getMetaData

public Object getMetaData(Object key)
Returns metadata matching a specfic key.

Specified by:
getMetaData in interface StaticJoinPoint
Parameters:
key - the key to the metadata
Returns:
the value

addMetaData

public void addMetaData(Object key,
                        Object value)
Adds metadata.

Specified by:
addMetaData in interface StaticJoinPoint
Parameters:
key - the key to the metadata
value - the value

getCallee

public Object getCallee()
Returns the callee instance.

Specified by:
getCallee in interface StaticJoinPoint
Returns:
the callee instance

getCaller

public Object getCaller()
Returns the caller instance.

Specified by:
getCaller in interface StaticJoinPoint
Returns:
the caller instance

getThis

public Object getThis()
Returns the 'this' instance (the one currently executing).

Specified by:
getThis in interface StaticJoinPoint
Returns:
'this'

getCallerClass

public Class getCallerClass()
Returns the caller class.

Specified by:
getCallerClass in interface StaticJoinPoint
Returns:
the caller class

invokeTargetMethodExecution

public static Object invokeTargetMethodExecution(JoinPoint joinPoint)
                                          throws Throwable
Invokes the original method - execution context.

Parameters:
joinPoint - the join point instance
Returns:
the result from the method invocation
Throws:
Throwable - the exception from the original method

invokeTargetMethodCall

public static Object invokeTargetMethodCall(JoinPoint joinPoint)
                                     throws Throwable
Invokes the original method - call context.

Parameters:
joinPoint - the join point instance
Returns:
the result from the method invocation
Throws:
Throwable - the exception from the original method

invokeTargetConstructorExecution

public static Object invokeTargetConstructorExecution(JoinPoint joinPoint)
                                               throws Throwable
Invokes the prefixed constructor.

Parameters:
joinPoint - the join point instance
Returns:
the newly created instance
Throws:
Throwable - the exception from the original constructor

invokeTargetConstructorCall

public static Object invokeTargetConstructorCall(JoinPoint joinPoint)
                                          throws Throwable
Invokes the original constructor.

Parameters:
joinPoint - the join point instance
Returns:
the newly created instance
Throws:
Throwable - the exception from the original constructor TODO: FIX BUG - When a constructor has both a CALL and EXECUTION join point, only the CALL will be executed, redirecting to the wrapper constructor

setTargetField

public static void setTargetField(JoinPoint joinPoint)
                           throws Throwable
Sets the target field.

Parameters:
joinPoint - the join point instance
Throws:
Throwable - the exception from the original method

getTargetField

public static Object getTargetField(JoinPoint joinPoint)
                             throws Throwable
Gets the target field.

Parameters:
joinPoint - the join point instance
Returns:
the target field
Throws:
Throwable - the exception from the original method

getJoinPointTypeAsString

public static String getJoinPointTypeAsString(int type)
Sets the join point type to a string representation.

Parameters:
type - the type

getPointcutType

public static PointcutType getPointcutType(int type)
Sets the join point type to a string representation.

Parameters:
type - the type

invokeJoinPoint

public static Object invokeJoinPoint(JoinPoint joinPoint,
                                     int joinPointType)
                              throws Throwable
Invoke the join point.

Parameters:
joinPoint - the join point instance
Returns:
the result from the invocation
Throws:
Throwable

getTarget

public Object getTarget()
Returns the target instance ('this'). If the join point is executing in a static context it returns null.

Specified by:
getTarget in interface StaticJoinPoint
Returns:
the target instance

getTargetClass

public Class getTargetClass()
Returns the target class.

Specified by:
getTargetClass in interface StaticJoinPoint
Returns:
the target class

getType

public String getType()
Returns the join point type.

Specified by:
getType in interface StaticJoinPoint
Returns:
the type

isInCflow

public boolean isInCflow()
Checks if the join point is in the correct control flow.

Returns:
true if we have a parse

toString

public String toString()

extractArguments

public abstract Object[] extractArguments(int[] methodToArgIndexes)
Extracts a subset of the joinPoint instance RTTI arguments. This is used to support args() syntax. This method is not exposed in the JoinPoint interface since user does not need it.

Parameters:
methodToArgIndexes -
Returns:

setRtti

protected abstract void setRtti(Rtti rtti)
Allows to pass the RTTI to the JP. The JPBase implementation delegates getTarget to the RTTI. Since in 1.0 engine, JP are cached and shared, while the RTTI is not, we need to set the RTTI (AW-265). This method MUST not be called by the user.

Parameters:
rtti -


Copyright © 2002-2004 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.