Package org.codehaus.aspectwerkz.definition

Examples of org.codehaus.aspectwerkz.definition.AdviceDefinition


                                // retrieve a sorted advices list => matches the sorted method list
                                // in the
                                // aspectContainer
                                List advices = crossCuttingInfo.getAspectDefinition().getAllAdvices();
                                for (Iterator it = advices.iterator(); it.hasNext();) {
                                    final AdviceDefinition adviceDef = (AdviceDefinition) it.next();
                                    AdviceInfo tuple = new AdviceInfo(
                                        indexAspect,
                                        adviceDef.getMethodIndex(),
                                        m_aspectManager,
                                        adviceDef.getType(),
                                        adviceDef.getSpecialArgumentType());

                                    //prefix AdviceName with AspectName to allow AspectReuse
                                    m_adviceIndexes.put(crossCuttingInfo.getName() + "/" + adviceDef.getName(), tuple);
                                }

                                // mixins
                                List introductions = crossCuttingInfo.getAspectDefinition().getIntroductions();
View Full Code Here


        ExpressionNamespace namespace = ExpressionNamespace.getNamespace(aspectDef
                .getFullQualifiedName());
        ExpressionInfo expressionInfo = new ExpressionInfo(pointcut, aspectDef
                .getFullQualifiedName());
        namespace.addExpressionInfo(pointcutName, expressionInfo);
        AdviceDefinition newDef = null;
        for (Iterator arounds = aspectDef.getAroundAdvices().iterator(); arounds.hasNext();) {
            AdviceDefinition around = (AdviceDefinition) arounds.next();
            if (around.getName().equals(aspectName + ".logMethod")) {
                // copy the logMethod advice
                // note: we could add a totally new advice as well
                newDef = around.copyAt(expressionInfo);
                break;
            }
        }
        aspectDef.addAroundAdvice(newDef);
View Full Code Here

        SystemDefinition sysDef = DefinitionLoader.getDefinition(HotSwapTarget.class
                .getClassLoader(), "hotdeployed");
        AspectDefinition aspectDef = sysDef.getAspectDefinition(aspectName);
        List removedAdviceDefs = new ArrayList();
        for (Iterator arounds = aspectDef.getAroundAdvices().iterator(); arounds.hasNext();) {
            AdviceDefinition around = (AdviceDefinition) arounds.next();
            if (pointcutName.equals(around.getExpressionInfo().getExpressionAsString())) {
                System.out.println("<removing> " + around.getName() + " at " + pointcutName);
                removedAdviceDefs.add(around);
            } else {
                //System.out.println("around = " + around.getExpression().getName());
            }
        }
View Full Code Here

                    if (aroundAnnotation != null) {
                        final String expression = aroundAnnotation.pointcut();
                        final String adviceName = AspectAnnotationParser.getMethodPointcutCallSignature(
                                method.getName(), aroundAnnotation
                        );
                        AdviceDefinition adviceDef = DefinitionParserHelper.createAdviceDefinition(
                                adviceName,
                                aroundAnnotation.getType(),
                                expression,
                                null,
                                aspectName,
                                aspectClassName,
                                method,
                                methodIndex,
                                aspectDef
                        );
                        aspectDef.addAroundAdvice(adviceDef);
                    }
                }
                List beforeAnnotations = Annotations.getAnnotations(AnnotationC.ANNOTATION_BEFORE, method);
                for (Iterator iterator = beforeAnnotations.iterator(); iterator.hasNext();) {
                    BeforeAnnotationProxy beforeAnnotation = (BeforeAnnotationProxy) iterator.next();
                    if (beforeAnnotation != null) {
                        final String expression = beforeAnnotation.pointcut();
                        final String adviceName = AspectAnnotationParser.getMethodPointcutCallSignature(
                                method.getName(), beforeAnnotation
                        );
                        AdviceDefinition adviceDef = DefinitionParserHelper.createAdviceDefinition(
                                adviceName,
                                beforeAnnotation.getType(),
                                expression,
                                null,
                                aspectName,
                                aspectClassName,
                                method,
                                methodIndex,
                                aspectDef
                        );
                        aspectDef.addBeforeAdvice(adviceDef);
                    }
                }
                List afterAnnotations = Annotations.getAnnotations(AnnotationC.ANNOTATION_AFTER, method);
                for (Iterator iterator = afterAnnotations.iterator(); iterator.hasNext();) {
                    AfterAnnotationProxy afterAnnotation = (AfterAnnotationProxy) iterator.next();
                    if (afterAnnotation != null) {
                        final String expression = afterAnnotation.pointcut();
                        final String adviceName = AspectAnnotationParser.getMethodPointcutCallSignature(
                                method.getName(), afterAnnotation
                        );
                        AdviceDefinition adviceDef = DefinitionParserHelper.createAdviceDefinition(
                                adviceName,
                                afterAnnotation.getType(),
                                expression,
                                afterAnnotation.getSpecialArgumentType(),
                                aspectName,
View Full Code Here

        for (Iterator it = systemDefs.iterator(); it.hasNext();) {
            SystemDefinition systemDef = (SystemDefinition) it.next();
            for (Iterator it2 = systemDef.getAspectDefinitions().iterator(); it2.hasNext();) {
                AspectDefinition aspectDef = (AspectDefinition) it2.next();
                for (Iterator it3 = aspectDef.getAfterAdviceDefinitions().iterator(); it3.hasNext();) {
                    AdviceDefinition adviceDef = (AdviceDefinition) it3.next();
                    DefinitionChangeElement changeElement =
                            (DefinitionChangeElement) m_definitionChangeElements.get(adviceDef.getQualifiedName());
                    if (changeElement != null) {
                        changeElement.getAdviceDef().setExpressionInfo(changeElement.getOldExpression());
                    }
                }
            }
View Full Code Here

            final AspectDefinition aspectDef = systemDef.getAspectDefinition(className);
            if (aspectDef != null) {

                final Set newExpressions = new HashSet();
                for (Iterator it2 = aspectDef.getAdviceDefinitions().iterator(); it2.hasNext();) {
                    AdviceDefinition adviceDef = (AdviceDefinition) it2.next();
                    ExpressionInfo oldExpression = adviceDef.getExpressionInfo();
                    if (oldExpression == null) { // if null, then already undeployed
                        continue;
                    }
                    adviceDef.setExpressionInfo(null);
                    newExpressions.add(oldExpression);
                }
                redefine(newExpressions);
            }
        }
View Full Code Here

        systemDef.addAspectOverwriteIfExists(newAspectDef);

        final Set newExpressions = new HashSet();
        for (Iterator it2 = newAspectDef.getAdviceDefinitions().iterator(); it2.hasNext();) {
            AdviceDefinition adviceDef = (AdviceDefinition) it2.next();
            ExpressionInfo oldExpression = adviceDef.getExpressionInfo();
            if (oldExpression == null) {
                continue;
            }
            deploymentHandle.registerDefinitionChange(adviceDef, oldExpression);

            final ExpressionInfo newExpression = deploymentScope.newExpressionInfo(oldExpression);
            adviceDef.setExpressionInfo(newExpression);
            newExpressions.add(newExpression);
        }
        return newExpressions;
    }
View Full Code Here

                }
            }
        }
        for (Iterator iterator = getAroundAdviceInfo(javaClass).iterator(); iterator.hasNext();) {
            AdviceInfo ajAdviceInfo = (AdviceInfo) iterator.next();
            AdviceDefinition adviceDef = handleAdviceInfo(classInfo, aspectDef, ajAdviceInfo);
            aspectDef.addAroundAdviceDefinition(adviceDef);
        }
        for (Iterator iterator = getBeforeAdviceInfo(javaClass).iterator(); iterator.hasNext();) {
            AdviceInfo ajAdviceInfo = (AdviceInfo) iterator.next();
            AdviceDefinition adviceDef = handleAdviceInfo(classInfo, aspectDef, ajAdviceInfo);
            aspectDef.addBeforeAdviceDefinition(adviceDef);
        }
        for (Iterator iterator = getAfterFinallyAdviceInfo(javaClass).iterator(); iterator.hasNext();) {
            AdviceInfo ajAdviceInfo = (AdviceInfo) iterator.next();
            AdviceDefinition adviceDef = handleAdviceInfo(classInfo, aspectDef, ajAdviceInfo);
            aspectDef.addAfterAdviceDefinition(adviceDef);
        }
        for (Iterator iterator = getAfterReturningAdviceInfo(javaClass).iterator(); iterator.hasNext();) {
            AdviceInfo ajAdviceInfo = (AdviceInfo) iterator.next();
            AdviceDefinition adviceDef = handleAdviceInfo(classInfo, aspectDef, ajAdviceInfo);
            aspectDef.addAfterAdviceDefinition(adviceDef);
        }
        for (Iterator iterator = getAfterThrowingAdviceInfo(javaClass).iterator(); iterator.hasNext();) {
            AdviceInfo ajAdviceInfo = (AdviceInfo) iterator.next();
            AdviceDefinition adviceDef = handleAdviceInfo(classInfo, aspectDef, ajAdviceInfo);
            aspectDef.addAfterAdviceDefinition(adviceDef);
        }
    }
View Full Code Here

                                       final AspectDefinition aspectDef) {
        List aroundAnnotations = AsmAnnotations.getAnnotations(AOPAnnotationConstants.ANNOTATION_AROUND(), method);
        for (Iterator iterator = aroundAnnotations.iterator(); iterator.hasNext();) {
            Around aroundAnnotation = (Around) iterator.next();
            if (aroundAnnotation != null) {
                AdviceDefinition adviceDef = DefinitionParserHelper.createAdviceDefinition(
                        getAdviceNameAsInSource(method),
                        AdviceType.AROUND,
                        aroundAnnotation.value(),
                        null,
                        aspectName,
View Full Code Here

                                       final AspectDefinition aspectDef) {
        List beforeAnnotations = AsmAnnotations.getAnnotations(AOPAnnotationConstants.ANNOTATION_BEFORE(), method);
        for (Iterator iterator = beforeAnnotations.iterator(); iterator.hasNext();) {
            Before beforeAnnotation = (Before) iterator.next();
            if (beforeAnnotation != null) {
                AdviceDefinition adviceDef = DefinitionParserHelper.createAdviceDefinition(
                        getAdviceNameAsInSource(method),
                        AdviceType.BEFORE,
                        beforeAnnotation.value(),
                        null,
                        aspectName,
View Full Code Here

TOP

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

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.