Package org.codehaus.aspectwerkz.pointcut

Examples of org.codehaus.aspectwerkz.pointcut.CallPointcut


                        // get the referenced cflow poincut definition
                        PointcutDefinition cflowPointcutDef =
                                aspectDefinition.getPointcutDef(value.getName());

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

                        // register the cflow advices in the system (if they does not already exist)
                        //TODO: [alex] clean this - works as well when commented.
                        if (!SystemLoader.getSystem(uuid).hasAspect(CFlowPreAdvice.NAME)) {
                            AdviceDefinition adviceDef = CFlowPreAdvice.getDefinition();
                            // add the advice to the aspectwerkz definition
                            definition.addAdvice(adviceDef);
                            // add the advice to the aspectwerkz system
                            registerAdvice(uuid, adviceDef);
                        }
                        if (!SystemLoader.getSystem(uuid).hasAspect(CFlowPostAdvice.NAME)) {
                            AdviceDefinition adviceDef = CFlowPostAdvice.getDefinition();
                            // add the advice to the aspectwerkz definition
                            definition.addAdvice(adviceDef);
                            // add the advice to the aspectwerkz system
                            registerAdvice(uuid, adviceDef);
                        }

                        // add the pointcut definition to the method pointcut
                        pointcut.addPointcutDef(cflowPointcutDef);
                        // add references to the cflow advices to the cflow pointcut
                        pointcut.addBeforeAdvice(CFlowPreAdvice.NAME);
                        pointcut.addAfterAdvice(CFlowPostAdvice.NAME);
                        // add the method pointcut
                        aspect.addCallPointcut(pointcut);

                        //TODO USELESS - does not support NOT IN
                        // impl a visitor
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

                        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

            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

                        // get the referenced cflow poincut definition
                        PointcutDefinition cflowPointcutDef =
                                aspectDef.getPointcutDef(value.getName());

                        // 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).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

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.