Package org.codehaus.aspectwerkz.definition

Examples of org.codehaus.aspectwerkz.definition.PointcutDefinition


     * Validates pointcut definitions
     * @param pointcutDefs a Collection of PointcutDefinitions
     */
    private void validatePointcuts(Collection pointcutDefs) {
        for (Iterator i = pointcutDefs.iterator(); i.hasNext();) {
            PointcutDefinition def = (PointcutDefinition)i.next();
            validateSyntax(def.getName(), "pointcut");
        }
    }
View Full Code Here


     * @param aspectDef the aspect definition
     */
    private static void handlePointcutDefinitions(final Element aspectElement,
                                                  final AspectDefinition aspectDef) {
        for (Iterator it2 = aspectDef.getPointcutDefs().iterator(); it2.hasNext();) {
            PointcutDefinition pointcutDef = (PointcutDefinition)it2.next();

            Element pointcutDefElement = aspectElement.addElement("pointcut-def");
            pointcutDefElement.addAttribute("name", pointcutDef.getName());
            pointcutDefElement.addAttribute("non-reentrant", pointcutDef.getNonReentrant());

            PointcutType pointcutType = pointcutDef.getType();
            if (pointcutType.equals(PointcutType.EXECUTION)) {
                pointcutDefElement.addAttribute("type", "method");
            }
            else if (pointcutType.equals(PointcutType.CALL)) {
                pointcutDefElement.addAttribute("type", "callerSide");
            }
            else if (pointcutType.equals(PointcutType.GET)) {
                pointcutDefElement.addAttribute("type", "getField");
            }
            else if (pointcutType.equals(PointcutType.SET)) {
                pointcutDefElement.addAttribute("type", "setField");
            }
            else if (pointcutType.equals(PointcutType.CFLOW)) {
                pointcutDefElement.addAttribute("type", "cflow");
            }
            else if (pointcutType.equals(PointcutType.THROWS)) {
                pointcutDefElement.addAttribute("type", "throws");
            }
            else if (pointcutType.equals(PointcutType.CLASS)) {
                pointcutDefElement.addAttribute("type", "class");
            }
            else {
                throw new ExpressionException("pointcut type not supported: " + pointcutType);
            }

            Expression.createExpressionTemplate(
                    aspectDef.getName(),
                    pointcutDef.getExpression(),
                    "",
                    pointcutDef.getName(),
                    pointcutType
            );

            pointcutDefElement.addAttribute("pattern", pointcutDef.getExpression());
        }
    }
View Full Code Here

                    String attribute = attributes[k];

                    String expression = pointcutName + counter;

                    // create and add a new pointcut definition
                    PointcutDefinition pointcutDef = new PointcutDefinition();
                    pointcutDef.setName(pointcutName);
                    pointcutDef.setExpression(expression);
                    pointcutDef.setType(PointcutType.EXECUTION);
                    definition.getAspectDefinition(AspectWerkzDefinition.SYSTEM_ASPECT).
                            addPointcutDef(pointcutDef);

                    // create a new controller definition
                    ControllerDefinition controllerDef = new ControllerDefinition();
View Full Code Here

                    for (Iterator it2 = definition.getAdviceDefinitions().iterator(); it2.hasNext();) {
                        String expression = pointcutName + counter;

                        // create and add a new pointcut def
                        PointcutDefinition pointcutDef = new PointcutDefinition();
                        pointcutDef.setName(pointcutName);
                        pointcutDef.setExpression(expression);
                        pointcutDef.setType(PointcutType.EXECUTION);
                        pointcutDef.setNonReentrant(isNonReentrant);
                        aspectDef.addPointcutDef(pointcutDef);

                        String adviceAttribute = ((AdviceDefinition)it2.next()).getAttribute();
                        if (adviceAttribute == null) {
                            continue;
View Full Code Here

                    String attribute = setFieldAttributes[k];
                    for (Iterator it2 = definition.getAdviceDefinitions().iterator(); it2.hasNext();) {
                        String expression = pointcutName + counter;

                        // create and add a new pointcut def
                        PointcutDefinition pointcutDef = new PointcutDefinition();
                        pointcutDef.setName(pointcutName);
                        pointcutDef.setExpression(expression);
                        pointcutDef.setType(PointcutType.SET);
                        aspectDef.addPointcutDef(pointcutDef);

                        String adviceAttribute = ((AdviceDefinition)it2.next()).getAttribute();
                        if (adviceAttribute == null) {
                            continue;
View Full Code Here

                    for (Iterator it2 = definition.getAdviceDefinitions().iterator(); it2.hasNext();) {
                        String expression = pointcutName + counter;

                        // create and add a new pointcut def
                        PointcutDefinition pointcutDef = new PointcutDefinition();
                        pointcutDef.setName(pointcutName);
                        pointcutDef.setExpression(expression);
                        pointcutDef.setType(PointcutType.GET);
                        aspectDef.addPointcutDef(pointcutDef);
                        String adviceAttribute = ((AdviceDefinition)it2.next()).getAttribute();
                        if (adviceAttribute == null) {
                            continue;
                        }
View Full Code Here

                    }
                    for (Iterator it2 = definition.getAdviceDefinitions().iterator(); it2.hasNext();) {
                        String expression = pointcutName + counter;

                        // create and add a new pointcut def
                        PointcutDefinition pointcutDef = new PointcutDefinition();
                        pointcutDef.setName(pointcutName);
                        pointcutDef.setExpression(expression);
                        pointcutDef.setType(PointcutType.THROWS);
                        aspectDef.addPointcutDef(pointcutDef);

                        String adviceAttribute = ((AdviceDefinition)it2.next()).getAttribute();
                        if (adviceAttribute == null) {
                            continue;
View Full Code Here

                    }
                    for (Iterator it2 = definition.getAdviceDefinitions().iterator(); it2.hasNext();) {
                        String expression = pointcutName + counter;

                        // create and add a new pointcut def
                        PointcutDefinition pointcutDef = new PointcutDefinition();
                        pointcutDef.setName(pointcutName);
                        pointcutDef.setExpression(expression);
                        pointcutDef.setType(PointcutType.CALL);
                        aspectDef.addPointcutDef(pointcutDef);


                        String adviceAttribute = ((AdviceDefinition)it2.next()).getAttribute();
                        if (adviceAttribute == null) {
View Full Code Here

     * @param pointcutName the pointcut name
     * @return the pointcut definition
     */
    public PointcutDefinition getPointcutDef(final String pointcutName) {
        for (Iterator it = m_pointcutDefs.iterator(); it.hasNext();) {
            PointcutDefinition pointcutDef = (PointcutDefinition)it.next();
            if (pointcutDef.getName().equals(pointcutName)) {
                return pointcutDef;
            }
        }
        return null;
    }
View Full Code Here

            final AspectDefinition abstractAspect = definition.getAbstractAspectDefinition(extendsRef);
            if (abstractAspect == null) {
                throw new DefinitionException("abstract aspect [" + aspectDef.getExtends() + "] is not defined");
            }
            for (Iterator it = abstractAspect.getPointcutDefs().iterator(); it.hasNext();) {
                final PointcutDefinition pointcutDef = (PointcutDefinition)it.next();
                aspectDef.addPointcutDef(pointcutDef);
            }
            for (Iterator it = abstractAspect.getBindAdviceRules().iterator(); it.hasNext();) {
                final BindAdviceRule bindAdviceRule = (BindAdviceRule)it.next();
//                for (Iterator it2 = aspectDef.getPointcutDefs().iterator(); it2.hasNext();) {
View Full Code Here

TOP

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

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.