Package org.codehaus.aspectwerkz.definition

Examples of org.codehaus.aspectwerkz.definition.PointcutDefinition


                    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(expression);
                        pointcutDef.setExpression(createFieldPattern(className,javaFields[i]));
                        pointcutDef.setType(PointcutType.SET);
                        aspectDef.addPointcutDef(pointcutDef);

                        ExpressionNamespace.getExpressionNamespace(aspectDef.getName())
                                .registerExpression(pointcutDef.getExpression(), "", expression, PointcutType.SET);

                        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(expression);
                        pointcutDef.setExpression(createFieldPattern(className,javaFields[i]));
                        pointcutDef.setType(PointcutType.GET);
                        aspectDef.addPointcutDef(pointcutDef);

                        ExpressionNamespace.getExpressionNamespace(aspectDef.getName())
                                .registerExpression(pointcutDef.getExpression(), "", expression, PointcutType.GET);

                        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(expression);
                        pointcutDef.setExpression(createThrowsPattern(exceptionClassPattern, javaMethods[i]));
                        pointcutDef.setType(PointcutType.THROWS);
                        aspectDef.addPointcutDef(pointcutDef);

                        ExpressionNamespace.getExpressionNamespace(aspectDef.getName())
                                .registerExpression(pointcutDef.getExpression(), "", expression, PointcutType.THROWS);

                        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(expression);
                        pointcutDef.setExpression(createCallerSidePattern(callerClassPattern, className, javaMethods[i]));
                        pointcutDef.setType(PointcutType.CALL);
                        aspectDef.addPointcutDef(pointcutDef);

                        ExpressionNamespace.getExpressionNamespace(aspectDef.getName())
                                .registerExpression(
                                pointcutDef.getExpression(), "", expression, PointcutType.CALL
                        );


                        String adviceAttribute = ((AdviceDefinition)it2.next()).getAttribute();
                        if (adviceAttribute == 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

                                              final String packageName) {
        for (Iterator it2 = aspect.elementIterator(); it2.hasNext();) {
            final Element nestedAdviceElement = (Element)it2.next();
            if (nestedAdviceElement.getName().trim().equals("pointcut-def")) {
                try {
                    final PointcutDefinition pointcutDef = new PointcutDefinition();

                    for (Iterator it3 = nestedAdviceElement.attributeIterator(); it3.hasNext();) {
                        Attribute attribute = (Attribute)it3.next();
                        final String name = attribute.getName().trim();
                        final String value = attribute.getValue().trim();
                        if (name.equals("name")) {
                            pointcutDef.setName(value);
                        }
                        else if (name.equals("type")) {
                            PointcutType type = null;
                            String expression = nestedAdviceElement.attributeValue("pattern");
                            if (expression==null || expression.length()==0)
                                expression = nestedAdviceElement.attributeValue("expression");
                            if (value.equalsIgnoreCase(METHOD)) {
                                type = PointcutType.EXECUTION;
                                pointcutDef.setExpression(PatternFactory.createMethodPattern(
                                        expression, packageName
                                ));
                            }
                            else if (value.equalsIgnoreCase(CFLOW)) {
                                //needed during AttributeC merge
                                type = PointcutType.CFLOW;
                                pointcutDef.setExpression(PatternFactory.createMethodPattern(
                                        expression, packageName
                                ));
                            }
                            else if (value.equalsIgnoreCase(SET_FIELD)) {
                                type = PointcutType.SET;
                                pointcutDef.setExpression(PatternFactory.createFieldPattern(
                                        expression, packageName
                                ));
                            }
                            else if (value.equalsIgnoreCase(GET_FIELD)) {
                                type = PointcutType.GET;
                                pointcutDef.setExpression(PatternFactory.createFieldPattern(
                                        expression, packageName
                                ));
                            }
                            else if (value.equalsIgnoreCase(THROWS)) {
                                type = PointcutType.THROWS;
                                pointcutDef.setExpression(PatternFactory.createThrowsPattern(
                                        expression, packageName
                                ));
                            }
                            else if (value.equalsIgnoreCase(CALLER_SIDE)) {
                                type = PointcutType.CALL;
                                pointcutDef.setExpression(PatternFactory.createCallPattern(
                                        expression, packageName
                                ));
                            }
                            else if (value.equalsIgnoreCase(CLASS)) {
                                type = PointcutType.CLASS;
                                pointcutDef.setExpression(PatternFactory.createClassPattern(
                                        expression, packageName
                                ));
                            }
                            pointcutDef.setType(type);
                        }
                        else if (name.equals("non-reentrant")) {
                            pointcutDef.setNonReentrant(value);
                        }
                    }
                    aspectDef.addPointcutDef(pointcutDef);
                }
                catch (Exception e) {
View Full Code Here

     */
    protected void createAndAddPointcutDefToAspectDef(final String name,
                                                      final PointcutType type,
                                                      final String expression,
                                                      final AspectDefinition aspectDef) {
        PointcutDefinition pointcutDef = new PointcutDefinition();
        pointcutDef.setName(name);
        pointcutDef.setType(type);
        pointcutDef.setExpression(expression);
        aspectDef.addPointcut(pointcutDef);

        // create and add a new expression template
        ExpressionNamespace.getExpressionNamespace(aspectDef.getName()).registerExpression(
                expression, "", name, type);
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.