Package org.codehaus.aspectwerkz.definition

Examples of org.codehaus.aspectwerkz.definition.SystemDefinition


    public void transform(final Context context, final Klass klass) throws NotFoundException {
        List definitions = context.getDefinitions();

        // loop over all the definitions
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            ExpressionContext ctx = new ExpressionContext(PointcutType.WITHIN, classInfo, classInfo);
            if (classFilter(ctClass, ctx, definition)) {
                continue;
View Full Code Here


        //AXm_joinPointIndex =
        // TransformationUtil.getJoinPointIndex(klass.getCtClass()); //TODO
        // thread safe reentrant
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            final SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            if (classFilter(definition, new ExpressionContext(PointcutType.CALL, null, classInfo), ctClass)) {
                continue;
            }
            ctClass.instrument(new ExprEditor() {
                public void edit(MethodCall methodCall) throws CannotCompileException {
                    // AW-228, super.callSomething(..) is not a valid join point
                    if (methodCall.isSuper()) {
                        return;
                    }
                    try {
                        CtBehavior where;
                        try {
                            where = methodCall.where();
                        } catch (RuntimeException e) {
                            // <clinit> access leads to a bug in Javassist
                            where = ctClass.getClassInitializer();
                        }

                        // filter caller methods
                        if (methodFilterCaller(where)) {
                            return;
                        }

                        // get the callee method name, signature and class name
                        CtMethod calleeMethod = methodCall.getMethod();
                        String calleeClassName = methodCall.getClassName();

                        // filter callee classes
                        if (!definition.inIncludePackage(calleeClassName)) {
                            return;
                        }

                        // filter callee methods
                        if (methodFilterCallee(calleeMethod)) {
                            return;
                        }
                        JavassistClassInfoRepository classInfoRepository = JavassistClassInfoRepository
                                .getRepository(context.getLoader());

                        // TODO: callee side class info is NOT used, make use of it
                        ClassInfo calleeSideClassInfo = classInfoRepository.getClassInfo(calleeClassName);
                        if (calleeSideClassInfo == null) {
                            calleeSideClassInfo = JavassistClassInfo.getClassInfo(ctClass.getClassPool().get(
                                calleeClassName), context.getLoader());
                        }

                        // create the caller method info, used for 'within' and
                        // 'withincode'
                        MemberInfo withinMemberInfo = null;
                        if (where instanceof CtMethod) {
                            withinMemberInfo = JavassistMethodInfo.getMethodInfo((CtMethod) where, context.getLoader());
                        } else if (where instanceof CtConstructor) {
                            withinMemberInfo = JavassistConstructorInfo.getConstructorInfo(
                                (CtConstructor) where,
                                context.getLoader());
                        }

                        // create the callee method info
                        MethodInfo calleeSideMethodInfo = JavassistMethodInfo.getMethodInfo(
                            methodCall.getMethod(),
                            context.getLoader());
                        ExpressionContext ctx = new ExpressionContext(
                            PointcutType.CALL,
                            calleeSideMethodInfo,
                            withinMemberInfo);
                        if (definition.hasPointcut(ctx) || definition.hasCflowPointcut(ctx)) {
                            // check the callee class is not the same as target
                            // class, if that is the case
                            // then we have have class loaded and set in the
                            // ___AW_clazz already
                            String declaringClassMethodName = TransformationConstants.STATIC_CLASS_FIELD;
View Full Code Here

    public void transform(final Context context, final Klass klass) throws NotFoundException, CannotCompileException {
        List definitions = context.getDefinitions();

        // loop over all the definitions
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();

            //            ClassInfo classInfo = new JavassistClassInfo(ctClass,
            // context.getLoader());
            // do we need to prepare the class
View Full Code Here

        //m_joinPointIndex =
        // TransformationUtil.getJoinPointIndex(klass.getCtClass()); //TODO
        // thread safe and reentrant
        // loop over all the definitions
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            final SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            final ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            if (classFilter(ctClass, new ExpressionContext(PointcutType.SET, classInfo, classInfo), definition)
                && classFilter(ctClass, new ExpressionContext(PointcutType.GET, classInfo, classInfo), definition)) {
                continue;
View Full Code Here

        //AXm_joinPointIndex =
        // TransformationUtil.getJoinPointIndex(klass.getCtClass()); //TODO
        // thread safe reentrant
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            final SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            if (classFilter(definition, new ExpressionContext(PointcutType.HANDLER, null, classInfo), ctClass)) {
                continue;
            }
            ctClass.instrument(new ExprEditor() {
                public void edit(Handler handlerExpr) throws CannotCompileException {
                    try {
                        CtClass exceptionClass = null;
                        try {
                            exceptionClass = handlerExpr.getType();
                        } catch (NullPointerException e) {
                            return;
                        }
                        CtBehavior where = null;
                        try {
                            where = handlerExpr.where();
                        } catch (RuntimeException e) {
                            // <clinit> access leads to a bug in Javassist
                            where = ctClass.getClassInitializer();
                        }
                        MemberInfo withinMethodInfo = null;
                        if (where instanceof CtMethod) {
                            withinMethodInfo = JavassistMethodInfo.getMethodInfo((CtMethod) where, context.getLoader());
                        } else if (where instanceof CtConstructor) {
                            withinMethodInfo = JavassistConstructorInfo.getConstructorInfo(
                                (CtConstructor) where,
                                context.getLoader());
                        }
                        ClassInfo exceptionClassInfo = JavassistClassInfo.getClassInfo(exceptionClass, context
                                .getLoader());
                        ExpressionContext ctx = new ExpressionContext(
                            PointcutType.HANDLER,
                            exceptionClassInfo,
                            withinMethodInfo);
                        if (definition.hasPointcut(ctx)) {
                            // call the wrapper method instead of the callee
                            // method
                            StringBuffer body = new StringBuffer();
                            body.append(TransformationConstants.JOIN_POINT_MANAGER_FIELD);
                            body.append('.');
View Full Code Here

     * @param klass the class set.
     */
    public void transform(final Context context, final Klass klass) throws Exception {
        List definitions = context.getDefinitions();
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            ClassInfo classMetaData = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());

            ExpressionContext[] ctxs = new ExpressionContext[]{
                new ExpressionContext(PointcutType.EXECUTION, classMetaData, classMetaData),
View Full Code Here

     * @param klass the class set.
     */
    public void transform(final Context context, final Klass klass) throws NotFoundException, CannotCompileException {
        List definitions = context.getDefinitions();
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            final SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            if (classFilter(definition, new ExpressionContext(PointcutType.CALL, null, classInfo), ctClass)) {
                return;
            }
View Full Code Here

        //AXm_joinPointIndex =
        // TransformationUtil.getJoinPointIndex(klass.getCtClass()); //TODO
        // thread safe and reentrant
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            if (classFilter(definition, new ExpressionContext(PointcutType.EXECUTION, classInfo, classInfo), ctClass)) {
                continue;
            }
View Full Code Here

    public void transform(final Context context, final Klass klass) {
        List definitions = context.getDefinitions();

        // loop over all the definitions
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            SystemDefinition definition = (SystemDefinition) it.next();
            final CtClass ctClass = klass.getCtClass();
            ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            ExpressionContext ctx = new ExpressionContext(PointcutType.WITHIN, classInfo, classInfo);
            if (classFilter(ctClass, ctx, definition)) {
                continue;
View Full Code Here

        List definitions = context.getDefinitions();

        //m_joinPointIndex = TransformationUtil.getJoinPointIndex(klass.getCtClass()); //TODO thread safe and reentrant
        // loop over all the definitions
        for (Iterator it = definitions.iterator(); it.hasNext();) {
            final SystemDefinition definition = (SystemDefinition)it.next();
            final CtClass ctClass = klass.getCtClass();
            final ClassInfo classInfo = JavassistClassInfo.getClassInfo(ctClass, context.getLoader());
            if (classFilter(ctClass, new ExpressionContext(PointcutType.SET, classInfo, null), definition)
                && classFilter(ctClass, new ExpressionContext(PointcutType.GET, classInfo, null), definition)) {
                continue;
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.definition.SystemDefinition

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.