Package org.codehaus.aspectwerkz.pointcut

Examples of org.codehaus.aspectwerkz.pointcut.CallPointcut


                        classMetaData,
                        m_methodMetaData
                );

                for (Iterator it = pointcuts.iterator(); it.hasNext();) {
                    CallPointcut callerSidePointcut = (CallPointcut)it.next();

                    IndexTuple[] preAdviceIndexes = callerSidePointcut.getPreAdviceIndexes();
                    for (int j = 0; j < preAdviceIndexes.length; j++) {
                        preAdvices.add(preAdviceIndexes[j]);
                    }

                    IndexTuple[] postAdviceIndexes = callerSidePointcut.getPostAdviceIndexes();
                    for (int j = 0; j < postAdviceIndexes.length; j++) {
                        postAdvices.add(postAdviceIndexes[j]);
                    }
                }
View Full Code Here


     * @param expression the expression
     * @return the call pointcut
     */
    public CallPointcut getCallPointcut(final String expression) {
        for (Iterator it = m_callPointcuts.iterator(); it.hasNext();) {
            CallPointcut pointcut = (CallPointcut)it.next();
            if (pointcut.getExpression().getExpression().equals(expression)) {
                return pointcut;
            }
        }
        return null;
    }
View Full Code Here

        if (classMetaData == null) throw new IllegalArgumentException("class meta-data can not be null");
        if (methodMetaData == null) throw new IllegalArgumentException("method meta-data can not be null");

        List pointcutList = new ArrayList();
        for (Iterator it = m_callPointcuts.iterator(); it.hasNext();) {
            final CallPointcut pointcut = (CallPointcut)it.next();
            if (pointcut.getExpression().match(classMetaData, methodMetaData)) {
                pointcutList.add(pointcut);
            }
        }
        return pointcutList;
    }
View Full Code Here

            List beforeAdvices = aspectDef.getBeforeAdvices();
            for (Iterator it2 = beforeAdvices.iterator(); it2.hasNext();) {
                AdviceDefinition adviceDef = (AdviceDefinition)it2.next();

                CallPointcut pointcut = aspectMetaData.getCallPointcut(
                        adviceDef.getExpression().getExpression()
                );
                if (pointcut == null) {
                    pointcut = new CallPointcut(uuid, adviceDef.getExpression());
                    aspectMetaData.addCallPointcut(pointcut);
                }
                pointcut.addBeforeAdvice(adviceDef.getName());
            }

            List afterAdvices = aspectDef.getAfterAdvices();
            for (Iterator it2 = afterAdvices.iterator(); it2.hasNext();) {
                AdviceDefinition adviceDef = (AdviceDefinition)it2.next();

                CallPointcut pointcut = aspectMetaData.getCallPointcut(
                        adviceDef.getExpression().getExpression()
                );
                if (pointcut == null) {
                    pointcut = new CallPointcut(uuid, adviceDef.getExpression());
                    aspectMetaData.addCallPointcut(pointcut);
                }
                pointcut.addAfterAdvice(adviceDef.getName());
            }
        }
    }
View Full Code Here

                    // create call pointcut
                    Expression expression = bindAdviceRule.getExpression();
                    if (!expression.getType().equals(PointcutType.CALL)) {
                        continue;
                    }
                    CallPointcut pointcut = new CallPointcut(uuid, expression);

                    // add before and after advices
                    List adviceRefs = bindAdviceRule.getAdviceRefs();
                    for (Iterator it3 = adviceRefs.iterator(); it3.hasNext();) {
                        String adviceRef = (String)it3.next();
                        if (((XmlDefSystem)SystemLoader.getSystem(uuid)).
                                getAdvice(adviceRef) instanceof PreAdvice) {
                            pointcut.addBeforeAdvice(adviceRef);
                        }
                        else if (((XmlDefSystem)SystemLoader.getSystem(uuid)).
                                getAdvice(adviceRef) instanceof PostAdvice) {
                            pointcut.addAfterAdvice(adviceRef);
                        }
                    }

                    // add advices from advice stacks
                    List adviceStackRefs = bindAdviceRule.getAdviceStackRefs();
                    for (Iterator it3 = adviceStackRefs.iterator(); it3.hasNext();) {
                        AdviceStackDefinition adviceStackDefinition =
                                definition.getAdviceStackDefinition((String)it3.next());

                        adviceRefs = adviceStackDefinition.getAdviceRefs();
                        for (Iterator it4 = adviceRefs.iterator(); it4.hasNext();) {
                            String adviceRef = (String)it4.next();
                            if (((XmlDefSystem)SystemLoader.getSystem(uuid)).
                                    getAdvice(adviceRef) instanceof PreAdvice) {
                                pointcut.addBeforeAdvice(adviceRef);
                            }
                            else if (((XmlDefSystem)SystemLoader.getSystem(uuid)).
                                    getAdvice(adviceRef) instanceof PostAdvice) {
                                pointcut.addAfterAdvice(adviceRef);
                            }
                        }
                    }
                    // add the call pointcut
                    aspect.addCallPointcut(pointcut);
View Full Code Here

                    getPointcutManager(aspectDef.getName());

            for (Iterator it2 = aspectDef.getAroundAdvices().iterator(); it2.hasNext();) {
                AdviceDefinition adviceDef = (AdviceDefinition)it2.next();
                if (adviceDef.getExpression().isOfType(PointcutType.CALL)) {
                    CallPointcut pointcut = pointcutManager.getCallPointcut(adviceDef.getExpression().getExpression());
                    if (pointcut == null) {
                        pointcut = new CallPointcut(uuid, adviceDef.getExpression());
                        pointcutManager.addCallPointcut(pointcut);
                    }
                    pointcut.addAroundAdvice(adviceDef.getName());
                }
            }

            for (Iterator it2 = aspectDef.getBeforeAdvices().iterator(); it2.hasNext();) {
                AdviceDefinition adviceDef = (AdviceDefinition)it2.next();
                if (adviceDef.getExpression().isOfType(PointcutType.CALL)) {
                    CallPointcut pointcut = pointcutManager.getCallPointcut(adviceDef.getExpression().getExpression());
                    if (pointcut == null) {
                        pointcut = new CallPointcut(uuid, adviceDef.getExpression());
                        pointcutManager.addCallPointcut(pointcut);
                    }
                    pointcut.addBeforeAdvice(adviceDef.getName());
                }
            }

            for (Iterator it2 = aspectDef.getAfterAdvices().iterator(); it2.hasNext();) {
                AdviceDefinition adviceDef = (AdviceDefinition)it2.next();
                if (adviceDef.getExpression().isOfType(PointcutType.CALL)) {
                    CallPointcut pointcut = pointcutManager.getCallPointcut(adviceDef.getExpression().getExpression());
                    if (pointcut == null) {
                        pointcut = new CallPointcut(uuid, adviceDef.getExpression());
                        pointcutManager.addCallPointcut(pointcut);
                    }
                    pointcut.addAfterAdvice(adviceDef.getName());
                }
            }
        }
    }
View Full Code Here

                            cflowPointcutDef.setType(PointcutType.CFLOW);
                            cflowPointcutDef.setExpression(value.getExpression());
                        }

                        // create call pointcut
                        CallPointcut pointcut = new CallPointcut(uuid, value);

                        // register the cflow advices in the system and create the cflow system aspect
                        // (if it does not already exist)
                        if (!SystemLoader.getSystem(uuid).getAspectManager().hasAspect(CFlowSystemAspect.NAME)) {
                            AspectDefinition cflowAspect = new AspectDefinition(
                                    CFlowSystemAspect.NAME,
                                    CFlowSystemAspect.CLASS_NAME,
                                    CFlowSystemAspect.DEPLOYMENT_MODEL
                            );
                            cflowAspect.addPointcut(cflowPointcutDef);

                            Class cflowAspectClass = CFlowSystemAspect.class;
                            try {
                                // add the cflow pre advice
                                cflowAspect.addBeforeAdvice(
                                        new AdviceDefinition(
                                                CFlowSystemAspect.PRE_ADVICE,
                                                cflowAspect.getName(),
                                                cflowAspect.getClassName(),
                                                value,
                                                cflowAspectClass.getDeclaredMethod(
                                                        CFlowSystemAspect.PRE_ADVICE,
                                                        new Class[]{JoinPoint.class}
                                                ),
                                                CFlowSystemAspect.PRE_ADVICE_INDEX,
                                                cflowAspect
                                        )
                                );

                                // add the cflow post advice
                                cflowAspect.addAfterAdvice(
                                        new AdviceDefinition(
                                                CFlowSystemAspect.POST_ADVICE,
                                                cflowAspect.getName(),
                                                cflowAspect.getClassName(),
                                                value,
                                                cflowAspectClass.getDeclaredMethod(
                                                        CFlowSystemAspect.POST_ADVICE,
                                                        new Class[]{JoinPoint.class}
                                                ),
                                                CFlowSystemAspect.POST_ADVICE_INDEX,
                                                cflowAspect
                                        )
                                );
                            }
                            catch (NoSuchMethodException e) {
                                ;
                            }

                            // add the advice to the aspectwerkz definition
                            definition.addAspect(cflowAspect);

                            // add the advice to the aspectwerkz system
                            registerAspect(uuid, cflowAspect, new HashMap());
                        }

                        // add the pointcut definition to the method pointcut
                        pointcut.addPointcutDef(cflowPointcutDef);

                        // add references to the cflow advices to the cflow pointcut
                        pointcut.addBeforeAdvice(CFlowSystemAspect.PRE_ADVICE);
                        pointcut.addAfterAdvice(CFlowSystemAspect.POST_ADVICE);

                        // add the method pointcut
                        aspect.addCallPointcut(pointcut);

View Full Code Here

                        getMethodTuple(definedClass, joinPointHash)
                        .getWrapperMethod()
                )
        );
        for (Iterator it = methodCallPointcuts.iterator(); it.hasNext();) {
            CallPointcut pointcut = (CallPointcut)it.next();
            AdviceContainer advices = new AdviceContainer(
                    pointcut.getAroundAdviceIndexes(),
                    pointcut.getBeforeAdviceIndexes(),
                    pointcut.getAfterAdviceIndexes()
            );
            methodCallAdvices.add(advices);
        }
        AdviceContainer[] adviceContainers = new AdviceContainer[methodCallAdvices.size()];
        int i = 0;
View Full Code Here

                        getConstructorTuple(definedClass, joinPointHash)
                        .getWrapperConstructor()
                )
        );
        for (Iterator it = constructorCallPointcuts.iterator(); it.hasNext();) {
            CallPointcut pointcut = (CallPointcut)it.next();
            AdviceContainer advices = new AdviceContainer(
                    pointcut.getAroundAdviceIndexes(),
                    pointcut.getBeforeAdviceIndexes(),
                    pointcut.getAfterAdviceIndexes()
            );
            constructorCallAdvices.add(advices);
        }
        AdviceContainer[] adviceContainers = new AdviceContainer[constructorCallAdvices.size()];
        int i = 0;
View Full Code Here

                    // create call pointcut
                    Expression expression = bindAdviceRule.getExpression();
                    if (!expression.getType().equals(PointcutType.CALL)) {
                        continue;
                    }
                    CallPointcut pointcut = new CallPointcut(uuid, expression);

                    // add before and after advices
                    List adviceRefs = bindAdviceRule.getAdviceRefs();
                    for (Iterator it3 = adviceRefs.iterator(); it3.hasNext();) {
                        String adviceRef = (String)it3.next();
                        if (((XmlDefSystem)SystemLoader.getSystem(uuid)).
                                getAdvice(adviceRef) instanceof PreAdvice) {
                            pointcut.addBeforeAdvice(adviceRef);
                        }
                        else if (((XmlDefSystem)SystemLoader.getSystem(uuid)).
                                getAdvice(adviceRef) instanceof PostAdvice) {
                            pointcut.addAfterAdvice(adviceRef);
                        }
                    }

                    // add advices from advice stacks
                    List adviceStackRefs = bindAdviceRule.getAdviceStackRefs();
                    for (Iterator it3 = adviceStackRefs.iterator(); it3.hasNext();) {
                        AdviceStackDefinition adviceStackDefinition =
                                definition.getAdviceStackDefinition((String)it3.next());

                        adviceRefs = adviceStackDefinition.getAdviceRefs();
                        for (Iterator it4 = adviceRefs.iterator(); it4.hasNext();) {
                            String adviceRef = (String)it4.next();
                            if (((XmlDefSystem)SystemLoader.getSystem(uuid)).
                                    getAdvice(adviceRef) instanceof PreAdvice) {
                                pointcut.addBeforeAdvice(adviceRef);
                            }
                            else if (((XmlDefSystem)SystemLoader.getSystem(uuid)).
                                    getAdvice(adviceRef) instanceof PostAdvice) {
                                pointcut.addAfterAdvice(adviceRef);
                            }
                        }
                    }
                    // add the call pointcut
                    aspect.addCallPointcut(pointcut);
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.pointcut.CallPointcut

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.