Package org.codehaus.aspectwerkz.joinpoint

Examples of org.codehaus.aspectwerkz.joinpoint.JoinPoint


                    handlerHash, JoinPointType.HANDLER, PointcutType.HANDLER, joinPointInfo, m_targetClass,
                    m_targetClass
            );
        }

        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map pointcutTypeToAdvicesMap = s_registry.getAdvicesForJoinPoint(m_classHash, handlerHash);

            AdviceContainer[] adviceIndexes = (AdviceContainer[])pointcutTypeToAdvicesMap.get(PointcutType.HANDLER);
            joinPoint =
            createCatchClauseJoinPoint(exceptionInstance.getClass(), m_targetClass, handlerSignature, adviceIndexes);

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            }
            else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        // intialize the join point before each usage
        ((JoinPointBase)joinPoint).setTargetInstance(targetInstance);
        ((CatchClauseSignature)joinPoint.getSignature()).setParameterValue(exceptionInstance);

        ((JoinPointBase)joinPoint).proceed();
    }
View Full Code Here


                m_targetClass,                     
                m_targetClass,
                targetInstance,
                targetInstance);
        }
        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map joinPointMetaDataMap = s_registry.getJoinPointMetaData(m_classHash, methodHash);
            JoinPointMetaData joinPointMetaData = (JoinPointMetaData) joinPointMetaDataMap.get(PointcutType.EXECUTION);
            AdviceIndexInfo[] adviceIndexes = joinPointMetaData.adviceIndexes;
            List cflowExpressions = joinPointMetaData.cflowExpressions;
            Pointcut cflowPointcut = joinPointMetaData.cflowPointcut;
            initCflowManagement(cflowPointcut, joinPointInfo);
            switch (joinPointType) {
                case JoinPointType.METHOD_EXECUTION:
                    joinPoint = createMethodJoinPoint(
                        methodHash,
                        joinPointType,
                        m_targetClass,
                        adviceIndexes,
                        joinPointMetaData,
                        targetInstance,
                        targetInstance);
                    break;
                case JoinPointType.CONSTRUCTOR_EXECUTION:
                    joinPoint = createConstructorJoinPoint(
                        methodHash,
                        joinPointType,
                        m_targetClass,
                        adviceIndexes,
                        joinPointMetaData,
                        targetInstance,
                        targetInstance);
                    break;
                default:
                    throw new RuntimeException("join point type not valid");
            }

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            } else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        // set the RTTI
        Rtti rtti = joinPoint.getRtti().cloneFor(targetInstance, targetInstance);
        if (parameters != null) {
            ((CodeRtti) rtti).setParameterValues(parameters);
        }
        setRtti(joinPointInfo, rtti);
        enterCflow(joinPointInfo);
        try {
            return joinPoint.proceed();
        } finally {
            unsetRtti(joinPointInfo);
            exitCflow(joinPointInfo);
        }
    }
View Full Code Here

                thisClass,
                m_targetClass,
                thisInstance,
                thisInstance);
        }
        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map joinPointMetaDataMap = s_registry.getJoinPointMetaData(m_classHash, methodHash);
            JoinPointMetaData joinPointMetaData = (JoinPointMetaData) joinPointMetaDataMap.get(PointcutType.CALL);
            AdviceIndexInfo[] adviceIndexes = joinPointMetaData.adviceIndexes;
            List cflowExpressions = joinPointMetaData.cflowExpressions;
            Pointcut cflowPointcut = joinPointMetaData.cflowPointcut;
            initCflowManagement(cflowPointcut, joinPointInfo);
            switch (joinPointType) {
                case JoinPointType.METHOD_CALL:

                    // TODO: make diff between target and this instances
                    joinPoint = createMethodJoinPoint(
                        methodHash,
                        joinPointType,
                        thisClass,
                        adviceIndexes,
                        joinPointMetaData,
                        thisInstance,
                        thisInstance);
                    break;
                case JoinPointType.CONSTRUCTOR_CALL:

                    // TODO: make diff between target and this instances
                    joinPoint = createConstructorJoinPoint(
                        methodHash,
                        joinPointType,
                        thisClass,
                        adviceIndexes,
                        joinPointMetaData,
                        thisInstance,
                        thisInstance);
                    break;
                default:
                    throw new RuntimeException("join point type not valid");
            }

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            } else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        Rtti rtti = joinPoint.getRtti().cloneFor(targetInstance, thisInstance);//AW-265
        if (parameters != null) {
            ((CodeRtti) rtti).setParameterValues(parameters);
        }
        setRtti(joinPointInfo, rtti);
        enterCflow(joinPointInfo);
        try {
            return joinPoint.proceed();
        } finally {
            unsetRtti(joinPointInfo);
            exitCflow(joinPointInfo);
        }
    }
View Full Code Here

                declaringClass,
                m_targetClass,
                targetInstance,
                targetInstance);
        }
        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map joinPointMetaDataMap = s_registry.getJoinPointMetaData(m_classHash, fieldHash);
            JoinPointMetaData joinPointMetaData = (JoinPointMetaData) joinPointMetaDataMap.get(PointcutType.SET);
            AdviceIndexInfo[] adviceIndexes = joinPointMetaData.adviceIndexes;
            List cflowExpressions = joinPointMetaData.cflowExpressions;
            Pointcut cflowPointcut = joinPointMetaData.cflowPointcut;
            initCflowManagement(cflowPointcut, joinPointInfo);
            joinPoint = createFieldJoinPoint(
                fieldHash,
                JoinPointType.FIELD_SET,
                m_targetClass,
                adviceIndexes,
                joinPointMetaData,
                targetInstance,
                targetInstance);

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            } else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        // intialize the join point before each usage
        Rtti rtti = joinPoint.getRtti().cloneFor(targetInstance, targetInstance);//AW-265
        if (fieldValue[0] != null) {
            ((FieldRtti) rtti).setFieldValue(fieldValue[0]);
            // array due to sucky javassist field handling
        }
        setRtti(joinPointInfo, rtti);
        enterCflow(joinPointInfo);
        try {
            joinPoint.proceed();
        } finally {
            unsetRtti(joinPointInfo);
            exitCflow(joinPointInfo);
        }
    }
View Full Code Here

                declaringClass,
                m_targetClass,
                targetInstance,
                targetInstance);
        }
        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map joinPointMetaDataMap = s_registry.getJoinPointMetaData(m_classHash, fieldHash);
            JoinPointMetaData joinPointMetaData = (JoinPointMetaData) joinPointMetaDataMap.get(PointcutType.GET);
            AdviceIndexInfo[] adviceIndexes = joinPointMetaData.adviceIndexes;
            List cflowExpressions = joinPointMetaData.cflowExpressions;
            Pointcut cflowPointcut = joinPointMetaData.cflowPointcut;
            initCflowManagement(cflowPointcut, joinPointInfo);
            joinPoint = createFieldJoinPoint(
                fieldHash,
                JoinPointType.FIELD_GET,
                m_targetClass,
                adviceIndexes,
                joinPointMetaData,
                targetInstance,
                targetInstance);

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            } else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        // intialize the join point before each usage
        Rtti rtti = joinPoint.getRtti().cloneFor(targetInstance, targetInstance);//AW-265
        setRtti(joinPointInfo, rtti);
        enterCflow(joinPointInfo);
        try {
            return joinPoint.proceed();
        } finally {
            unsetRtti(joinPointInfo);
            exitCflow(joinPointInfo);
        }
    }
View Full Code Here

                m_targetClass,
                m_targetClass,
                targetInstance,
                targetInstance);
        }
        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map joinPointMetaDataMap = s_registry.getJoinPointMetaData(m_classHash, handlerHash);
            JoinPointMetaData joinPointMetaData = (JoinPointMetaData) joinPointMetaDataMap.get(PointcutType.HANDLER);
            AdviceIndexInfo[] adviceIndexes = joinPointMetaData.adviceIndexes;
            List cflowExpressions = joinPointMetaData.cflowExpressions;
            Pointcut cflowPointcut = joinPointMetaData.cflowPointcut;
            initCflowManagement(cflowPointcut, joinPointInfo);
            joinPoint = createCatchClauseJoinPoint(
                exceptionInstance.getClass(),
                m_targetClass,
                handlerSignature,
                adviceIndexes,
                joinPointMetaData,
                targetInstance,
                targetInstance);

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            } else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        // intialize the join point before each usage
        Rtti rtti = joinPoint.getRtti().cloneFor(targetInstance, targetInstance);//AW-265
        ((CatchClauseRtti)rtti).setParameterValue(exceptionInstance);
        setRtti(joinPointInfo, rtti);
        enterCflow(joinPointInfo);
        try {
            joinPoint.proceed();
        } finally {
            unsetRtti(joinPointInfo);
            exitCflow(joinPointInfo);
        }
    }
View Full Code Here

     * Helper method, pop the rtti from the stack and reset the JP with the next on stack
     *
     * @param joinPointInfo
     */
    private static void unsetRtti(final JoinPointInfo joinPointInfo) {
        JoinPoint joinPoint = joinPointInfo.joinPoint;
        // pop the old RTTI from the stack
        joinPointInfo.rttiStack.pop();
        // and peek the next one to pass it back to the joinpoint if there is one (else it means out of cflow)
        if (!joinPointInfo.rttiStack.isEmpty()) {
            ((JoinPointBase)joinPoint).setRtti((Rtti)joinPointInfo.rttiStack.peek());
View Full Code Here

     *
     * @param joinPointInfo
     * @param rtti
     */
    private static void setRtti(final JoinPointInfo joinPointInfo, final Rtti rtti) {
        JoinPoint joinPoint = joinPointInfo.joinPoint;
        ((JoinPointBase)joinPoint).setRtti(rtti);
        joinPointInfo.rttiStack.push(rtti);
    }
View Full Code Here

            handleJitCompilation(
                    methodHash, joinPointType, PointcutType.EXECUTION, joinPointInfo, m_targetClass,
                    m_targetClass, targetInstance, targetInstance
            );
        }
        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map joinPointMetaDataMap = s_registry.getJoinPointMetaData(m_classHash, methodHash);
            JoinPointMetaData joinPointMetaData = (JoinPointMetaData)joinPointMetaDataMap.get(PointcutType.EXECUTION);
            AdviceIndexInfo[] adviceIndexes = joinPointMetaData.adviceIndexes;
            List cflowExpressions = joinPointMetaData.cflowExpressions;
            Pointcut cflowPointcut = joinPointMetaData.cflowPointcut;
            initCflowManagement(cflowPointcut, joinPointInfo);
            switch (joinPointType) {
                case JoinPointType.METHOD_EXECUTION:
                    joinPoint = createMethodJoinPoint(
                            methodHash, joinPointType, m_targetClass, adviceIndexes,
                            joinPointMetaData, targetInstance, targetInstance
                    );
                    break;
                case JoinPointType.CONSTRUCTOR_EXECUTION:
                    joinPoint = createConstructorJoinPoint(
                            methodHash, joinPointType, m_targetClass, adviceIndexes,
                            joinPointMetaData, targetInstance, targetInstance
                    );
                    break;
                default:
                    throw new RuntimeException("join point type not valid");
            }

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            } else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        // set the RTTI
        joinPoint.setTargetInstance(targetInstance);
        if (parameters != null) {
            ((CodeRtti)joinPoint.getRtti()).setParameterValues(parameters);
        }
        enterCflow(joinPointInfo);
        try {
            return joinPoint.proceed();
        } finally {
            exitCflow(joinPointInfo);
        }
    }
View Full Code Here

            handleJitCompilation(
                    methodHash, joinPointType, PointcutType.CALL, joinPointInfo, thisClass, m_targetClass,
                    thisInstance, thisInstance
            );
        }
        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map joinPointMetaDataMap = s_registry.getJoinPointMetaData(m_classHash, methodHash);
            JoinPointMetaData joinPointMetaData = (JoinPointMetaData)joinPointMetaDataMap.get(PointcutType.CALL);
            AdviceIndexInfo[] adviceIndexes = joinPointMetaData.adviceIndexes;
            List cflowExpressions = joinPointMetaData.cflowExpressions;
            Pointcut cflowPointcut = joinPointMetaData.cflowPointcut;
            initCflowManagement(cflowPointcut, joinPointInfo);
            switch (joinPointType) {
                case JoinPointType.METHOD_CALL:

                    // TODO: make diff between target and this instances
                    joinPoint = createMethodJoinPoint(
                            methodHash, joinPointType, thisClass, adviceIndexes,
                            joinPointMetaData, thisInstance, thisInstance
                    );
                    break;
                case JoinPointType.CONSTRUCTOR_CALL:

                    // TODO: make diff between target and this instances
                    joinPoint = createConstructorJoinPoint(
                            methodHash, joinPointType, thisClass, adviceIndexes,
                            joinPointMetaData, thisInstance, thisInstance
                    );
                    break;
                default:
                    throw new RuntimeException("join point type not valid");
            }

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            } else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }
        joinPoint.setTargetInstance(thisInstance);
        if (parameters != null) {
            ((CodeRtti)joinPoint.getRtti()).setParameterValues(parameters);
        }
        enterCflow(joinPointInfo);
        try {
            return joinPoint.proceed();
        } finally {
            exitCflow(joinPointInfo);
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.joinpoint.JoinPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.