Examples of ExpressionNamespace


Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

        if (expr.startsWith("cflow(")) {
            return Boolean.TRUE;
        } else {
            Expression expression = null;
            ExpressionContext ctx = (ExpressionContext)data;
            ExpressionNamespace ns = ctx.getNamespace();
            if (expr.startsWith("execution(")) {
                expression = ns.createExecutionExpression(
                        expr.substring(10, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("call(")) {
                expression = ns.createCallExpression(
                        expr.substring(5, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("set(")) {
                expression = ns.createSetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("get(")) {
                expression = ns.createGetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("class(")) {
                expression = ns.createClassExpression(
                        expr.substring(6, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("handler(")) {
                expression = ns.createHandlerExpression(
                        expr.substring(8, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("attribute(")) {
                expression = ns.createAttributeExpression(
                        expr.substring(10, expr.length()-1),
                        ""
                );
            } else {
                throw new RuntimeException("unknown anonymous: "+expr);
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

    public Object visit(NotNode node, Object data) {
        return getLeftHS(node, this, data);
    }

    public Object visit(Identifier node, Object data) {
        ExpressionNamespace space = (ExpressionNamespace)data;
        Expression expression = space.getExpression(node.name);
        if (expression!=null) {
            return expression.getType();
        } else {
            throw new RuntimeException("no such registered expression: " + node.name);
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

        }
    }

    public void testBuildExpressionWithTheSamePointcutTypes() {
        try {
            ExpressionNamespace space = ExpressionNamespace.getExpressionNamespace();
            space.registerExpression(space.createExpression("* test.ExpressionTest.set(..)", "", "pc1", PointcutType.EXECUTION));
            space.registerExpression(space.createExpression("* test.ExpressionTest.get(..)", "", "pc2", PointcutType.EXECUTION));
            Expression root = ExpressionNamespace.getExpressionNamespace().createExpression("pc1&&pc2");
        }
        catch (Exception e) {
            fail(e.toString());
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

        }
    }

    public void testBuildExpressionWithDifferentPointcutTypes() {
        try {
            ExpressionNamespace space = ExpressionNamespace.getExpressionNamespace();
            space.registerExpression(space.createExpression("* test.ExpressionTest.set(..)", "", "pc1", PointcutType.EXECUTION));
            space.registerExpression(space.createExpression("* test.ExpressionTest.get(..)", "", "pc2", PointcutType.CALL));
            Expression root = ExpressionNamespace.getExpressionNamespace().createExpression("pc1 && NOT pc2");
            fail("expected exception");
        }
        catch (Exception e) {
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

        }
    }

    public void testBuildExpressionWithDifferentPointcutTypesButOneIsCflow() {
        try {
            ExpressionNamespace space = ExpressionNamespace.getExpressionNamespace();
            space.registerExpression(space.createExpression("* test.ExpressionTest.set(..)", "", "pc1", PointcutType.EXECUTION));
            space.registerExpression(space.createExpression("* test.ExpressionTest.get(..)", "", "cf1", PointcutType.CFLOW));
            space.registerExpression(space.createExpression("* test.ExpressionTest.get2(..)", "", "cf2", PointcutType.CFLOW));
            //Expression root = ExpressionNamespace.getExpressionNamespace().createExpression("pc1 IN (cf1 OR cf2)");
            Expression root = ExpressionNamespace.getExpressionNamespace().createExpression("pc1 IN (cf1)");
        }
        catch (Exception e) {
            fail(e.toString());
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

        }
    }

    public void testMatchSingleAnonymousExpression() {
        try {
            ExpressionNamespace space = ExpressionNamespace.getExpressionNamespace();
            Expression root = space.createExpression("* test.ExpressionTest.set(..)", PointcutType.EXECUTION);

            ClassMetaData classMetaDataTrue = ReflectionMetaDataMaker.createClassMetaData(ExpressionTest.class);
            ClassMetaData classMetaDataFalse = ReflectionMetaDataMaker.createClassMetaData(ExpressionException.class);
            MethodMetaData methodMetaDataTrue = ReflectionMetaDataMaker.createMethodMetaData(ExpressionTest.class.getDeclaredMethod("set", new Class[]{}));
            MethodMetaData methodMetaDataFalse = ReflectionMetaDataMaker.createMethodMetaData(ExpressionTest.class.getDeclaredMethod("get", new Class[]{}));
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

    }


    public void testOneLevel_EXECUTION_OR() {
        try {
            ExpressionNamespace space = ExpressionNamespace.getExpressionNamespace();
            space.registerExpression("* test.ExpressionTest.set(..)", "", "pc1", PointcutType.EXECUTION);
            space.registerExpression("* test.ExpressionTest.get(..)", "", "pc2", PointcutType.EXECUTION);
            Expression root = space.createExpression("pc1 || pc2");

            ClassMetaData classMetaData1 = ReflectionMetaDataMaker.createClassMetaData(ExpressionTest.class);
            ClassMetaData classMetaData2 = ReflectionMetaDataMaker.createClassMetaData(ExpressionException.class);
            MethodMetaData methodMetaData1 = ReflectionMetaDataMaker.createMethodMetaData(ExpressionTest.class.getDeclaredMethod("set", new Class[]{}));
            MethodMetaData methodMetaData2 = ReflectionMetaDataMaker.createMethodMetaData(ExpressionTest.class.getDeclaredMethod("get", new Class[]{}));
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

        }
    }

    public void testOneLevel_CALL_OR() {
        try {
            ExpressionNamespace space = ExpressionNamespace.getExpressionNamespace();
            space.registerExpression("*->* test.ExpressionTest.set(..)", "", "pc1", PointcutType.CALL);
            space.registerExpression("*->* test.ExpressionTest.get(..)", "", "pc2", PointcutType.CALL);
            Expression root = space.createExpression("pc1 || pc2");

            ClassMetaData classMetaData1 = ReflectionMetaDataMaker.createClassMetaData(ExpressionTest.class);
            MethodMetaData methodMetaData1 = ReflectionMetaDataMaker.createMethodMetaData(ExpressionTest.class.getDeclaredMethod("set", new Class[]{}));
            MethodMetaData methodMetaData2 = ReflectionMetaDataMaker.createMethodMetaData(ExpressionTest.class.getDeclaredMethod("get", new Class[]{}));
            MethodMetaData methodMetaData3 = ReflectionMetaDataMaker.createMethodMetaData(ExpressionTest.class.getDeclaredMethod("suite", new Class[]{}));
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

//                                    packageName,
//                                    pointcutName,
//                                    pointcutType
//                            );
//                    Expression.registerExpressionTemplate(expressionTemplate);
                    ExpressionNamespace space = ExpressionNamespace.getExpressionNamespace(aspectName);
                    space.registerExpression(expression, packageName, pointcutName, pointcutType);
                }
                catch (Exception e) {
                    throw new WrappedRuntimeException(e);
                }
            }
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.expression.ExpressionNamespace

                        else if (name.equals("advice-ref")) {
                            bindAdviceRule.addAdviceRef(value);
                        }
                    }
                    // add binding here once cflow expr has been assembled (@since jjtree)
                    ExpressionNamespace space = ExpressionNamespace.getExpressionNamespace(aspectDef.getName());
                    bindAdviceRule.setExpression(space.createExpression(pointcutExpression));

                    parseAdviceWeavingRuleNestedElements(nestedAdviceElement, bindAdviceRule);
                    aspectDef.addBindAdviceRule(bindAdviceRule);
                }
                catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.