Package org.codehaus.aspectwerkz.pointcut

Examples of org.codehaus.aspectwerkz.pointcut.CallerSidePointcut


        synchronized (m_callerSidePointcuts) {
            if (m_callerSidePointcuts.containsKey(pattern)) {
                return (CallerSidePointcut)m_callerSidePointcuts.get(pattern);
            }
            else {
                final CallerSidePointcut pointcut = new CallerSidePointcut(m_uuid, pattern);
                m_callerSidePointcuts.put(pattern, pointcut);
                return pointcut;
            }
        }
    }
View Full Code Here


        if (className == null) throw new IllegalArgumentException("class name 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_callerSidePointcuts.values().iterator(); it.hasNext();) {
            final CallerSidePointcut pointcut = (CallerSidePointcut)it.next();
            if (pointcut.matches(className, methodMetaData)) {
                pointcutList.add(pointcut);
            }
        }
        return pointcutList;
    }
View Full Code Here

                List postAdvices = new ArrayList();

                List pointcuts = m_system.getCallerSidePointcuts(getCalleeClassName(), m_methodMetaData);

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

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

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

        synchronized (m_callerSidePointcuts) {
            if (m_callerSidePointcuts.containsKey(pattern)) {
                return (CallerSidePointcut)m_callerSidePointcuts.get(pattern);
            }
            else {
                final CallerSidePointcut pointcut = new CallerSidePointcut(m_uuid, pattern);
                m_callerSidePointcuts.put(pattern, pointcut);
                return pointcut;
            }
        }
    }
View Full Code Here

        if (className == null) throw new IllegalArgumentException("class name 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_callerSidePointcuts.values().iterator(); it.hasNext();) {
            final CallerSidePointcut pointcut = (CallerSidePointcut)it.next();
            if (pointcut.matches(className, methodMetaData)) {
                pointcutList.add(pointcut);
            }
        }
        return pointcutList;
    }
View Full Code Here

                        getCalleeClassName(),
                        m_methodMetaData
                );

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

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

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

                List adviceWeavingRules = aspectDefinition.getAdviceWeavingRules();
                for (Iterator it2 = adviceWeavingRules.iterator(); it2.hasNext();) {
                    AdviceWeavingRule weavingRule = (AdviceWeavingRule)it2.next();

                    // create caller side pointcut
                    CallerSidePointcut pointcut = new CallerSidePointcut(
                            uuid, weavingRule.getExpression());

                    // add all referenced poincuts definitions
                    boolean hasCallerSidePointcut = false;
                    List pointcutRefs = weavingRule.getPointcutRefs();
                    for (Iterator it3 = pointcutRefs.iterator(); it3.hasNext();) {
                        PointcutDefinition pointcutDefinition =
                                aspectDefinition.getPointcutDef((String)it3.next());
                        if (pointcutDefinition != null && pointcutDefinition.getType().
                                equalsIgnoreCase(PointcutDefinition.CALLER_SIDE)) {
                            pointcut.addPointcutDef(pointcutDefinition);
                            hasCallerSidePointcut = true;
                        }
                    }

                    // check if the weaving rule had a caller side pointcut, if not continue
                    if (!hasCallerSidePointcut) {
                        continue;
                    }

                    // add pre and post advices
                    List adviceRefs = weavingRule.getAdviceRefs();
                    for (Iterator it3 = adviceRefs.iterator(); it3.hasNext();) {
                        String adviceRef = (String)it3.next();
                        if (AspectWerkz.getSystem(uuid).
                                getAdvice(adviceRef) instanceof PreAdvice) {
                            pointcut.addPreAdvice(adviceRef);
                        }
                        else if (AspectWerkz.getSystem(uuid).
                                getAdvice(adviceRef) instanceof PostAdvice) {
                            pointcut.addPostAdvice(adviceRef);
                        }
                    }

                    // add advices from advice stacks
                    List adviceStackRefs = weavingRule.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 (AspectWerkz.getSystem(uuid).getAdvice(adviceRef) instanceof PreAdvice) {
                                pointcut.addPreAdvice(adviceRef);
                            }
                            else if (AspectWerkz.getSystem(uuid).getAdvice(adviceRef) instanceof PostAdvice) {
                                pointcut.addPostAdvice(adviceRef);
                            }
                        }
                    }
                    // add the caller side pointcut
                    aspect.addCallerSidePointcut(pointcut);
View Full Code Here

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

                    // create caller side pointcut
                    CallerSidePointcut callerSidePointcut =
                            new CallerSidePointcut(uuid, cflowExpression);
                    if (!(cflowPointcutDef != null && cflowPointcutDef.getType().
                            equalsIgnoreCase(PointcutDefinition.CFLOW))) {
                        continue;
                    }
                    // register the cflow advices in the system (if they does not already exist)
                    if (!AspectWerkz.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 (!AspectWerkz.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
                    callerSidePointcut.addPointcutDef(cflowPointcutDef);
                    // add references to the cflow advices to the cflow pointcut
                    callerSidePointcut.addPreAdvice(CFlowPreAdvice.NAME);
                    callerSidePointcut.addPostAdvice(CFlowPostAdvice.NAME);
                    // add the method pointcut
                    aspect.addCallerSidePointcut(callerSidePointcut);

                    // add a mapping between the cflow pattern and the method patterns affected
                    for (Iterator it3 = weavingRule.getPointcutRefs().iterator(); it3.hasNext();) {
View Full Code Here

TOP

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

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.