Package org.codehaus.aspectwerkz.expression

Examples of org.codehaus.aspectwerkz.expression.ExpressionInfo


     * @return
     */
    public Object visit(ASTCflow node, Object data) {
        int cflowID = node.hashCode();
        Node subNode = node.jjtGetChild(0);
        ExpressionInfo subExpression = new ExpressionInfo(subNode, m_namespace);
        subExpression.inheritPossibleArgumentFrom(m_expressionInfo);
        ((List)data).add(new CflowBinding(cflowID, subExpression, false));
        return data;
    }
View Full Code Here


     * @return
     */
    public Object visit(ASTCflowBelow node, Object data) {
        int cflowID = node.hashCode();
        Node subNode = node.jjtGetChild(0);
        ExpressionInfo subExpression = new ExpressionInfo(subNode, m_namespace);
        subExpression.inheritPossibleArgumentFrom(m_expressionInfo);
        ((List)data).add(new CflowBinding(cflowID, subExpression, true));
        return data;
    }
View Full Code Here

        // do a lookup first to avoid infinite recursion when:
        // <pointcut name="pc" ...> [will be registered as pc]
        // <advice bind-to="pc" ...> [will be registered as pc and should not override previous one !]
        ExpressionNamespace namespace = ExpressionNamespace.getNamespace(aspectDef.getQualifiedName());
        ExpressionInfo info = namespace.getExpressionInfoOrNull(pointcutName);
        if (info == null) {
            info = new ExpressionInfo(expression, aspectDef.getQualifiedName());
            // extract the pointcut signature map
            if (pointcutCallSignature != null) {
                String[] parameters = Strings.splitString(pointcutCallSignature, ",");
                for (int i = 0; i < parameters.length; i++) {
                    String[] parameterInfo = Strings.splitString(
                            Strings.replaceSubString(parameters[i].trim(), "  ", " "),
                            " "
                    );
                    info.addArgument(parameterInfo[1], parameterInfo[0], aspectDef.getClassInfo().getClassLoader());
                }
            }
        }
        ExpressionNamespace.getNamespace(aspectDef.getQualifiedName()).addExpressionInfo(pointcutName, info);
    }
View Full Code Here

    public static void createAndAddAdvisableDef(final String expression, final SystemDefinition systemDef) {
        AspectDefinition virtualAspectDef = systemDef.getAspectDefinition(Virtual.class.getName());
        virtualAspectDef.addPointcutDefinition(new PointcutDefinition(expression));

        AdviceDefinition virtualAdviceDef = (AdviceDefinition) virtualAspectDef.getBeforeAdviceDefinitions().get(0);
        ExpressionInfo oldExpressionInfo = virtualAdviceDef.getExpressionInfo();
        String newExpression;
        if (oldExpressionInfo != null) {
            String oldExpression = oldExpressionInfo.toString();
            newExpression = oldExpression + " || " + expression;
        } else {
            newExpression = expression;
        }

        virtualAdviceDef.setExpressionInfo(
                new ExpressionInfo(
                        newExpression,
                        virtualAspectDef.getQualifiedName()
                )
        );
    }
View Full Code Here

        final AdviceDefinition virtualAdviceDef = (AdviceDefinition) virtualAspectDef.getBeforeAdviceDefinitions().get(
                0
        );

        final StringBuffer newExpression = new StringBuffer();
        final ExpressionInfo oldExpressionInfo = virtualAdviceDef.getExpressionInfo();
        if (oldExpressionInfo != null) {
            String oldExpression = oldExpressionInfo.toString();
            newExpression.append(oldExpression);
        }
        final Collection deploymentScopes = systemDef.getDeploymentScopes();
        if (deploymentScopes.size() != 0 && oldExpressionInfo != null) {
            newExpression.append(" || ");
        }
        for (Iterator it = deploymentScopes.iterator(); it.hasNext();) {
            DeploymentScope deploymentScope = (DeploymentScope) it.next();
            newExpression.append(deploymentScope.getExpression());
            if (it.hasNext()) {
                newExpression.append(" || ");
            }
        }
        if (newExpression.length() != 0) {
            virtualAdviceDef.setExpressionInfo(
                    new ExpressionInfo(
                            newExpression.toString(),
                            virtualAspectDef.getQualifiedName()
                    )
            );
        }
View Full Code Here

                                                          final String specialArgumentType,
                                                          final String aspectName,
                                                          final String aspectClassName,
                                                          final MethodInfo methodInfo,
                                                          final AspectDefinition aspectDef) {
        ExpressionInfo expressionInfo = new ExpressionInfo(
                expression,
                aspectDef.getQualifiedName()
        );

        // support for pointcut signature
        String adviceCallSignature = null;
        String resolvedSpecialArgumentType = specialArgumentType;
        if (adviceName.indexOf('(') > 0) {
            adviceCallSignature = adviceName.substring(adviceName.indexOf('(') + 1, adviceName.lastIndexOf(')'));
            String[] parameters = Strings.splitString(adviceCallSignature, ",");
            for (int i = 0; i < parameters.length; i++) {
                String[] parameterInfo = Strings.splitString(
                        Strings.replaceSubString(parameters[i].trim(), "  ", " "),
                        " "
                );
                // Note: for XML defined aspect, we support anonymous parameters like
                // advice(JoinPoint, Rtti) as well as abbreviations, so we have to assign
                // them a name here, as well as their real type
                String paramName, paramType = null;
                if (parameterInfo.length == 2) {
                    paramName = parameterInfo[1];
                    paramType = parameterInfo[0];
                    //FIXME -- ?? what ??
                } else {
                    paramName = "anonymous_" + i;
                    paramType = (String) Pattern.ABBREVIATIONS.get(parameterInfo[0]);
                }
                // skip the parameter if this ones is a after returning / throwing binding
                if (paramName.equals(specialArgumentType)) {
                    resolvedSpecialArgumentType = paramType;
                    expressionInfo.setSpecialArgumentName(paramName);
                } else {
                    expressionInfo.addArgument(paramName, paramType, aspectDef.getClassInfo().getClassLoader());
                }
            }
        }

        // check that around advice return Object else the compiler will fail
View Full Code Here

                                                        final DeploymentModel deploymentModel,
                                                        final boolean isTransient,
                                                        final SystemDefinition systemDef) {
        final MixinDefinition mixinDef = new MixinDefinition(mixinClassInfo, deploymentModel, isTransient, systemDef);
        if (expression != null) {
            ExpressionInfo expressionInfo = new ExpressionInfo(expression, systemDef.getUuid());

            // auto-name the pointcut which is anonymous for introduction
            ExpressionNamespace.getNamespace(systemDef.getUuid()).addExpressionInfo(
                    EXPRESSION_PREFIX + expression.hashCode(),
                    expressionInfo
View Full Code Here

                                                                                        final AspectDefinition aspectDef) {
        final InterfaceIntroductionDefinition introDef = new InterfaceIntroductionDefinition(
                introductionName, interfaceClassName
        );
        if (expression != null) {
            ExpressionInfo expressionInfo = new ExpressionInfo(expression, aspectDef.getQualifiedName());

            // auto-name the pointcut which is anonymous for introduction
            ExpressionNamespace.getNamespace(aspectDef.getQualifiedName()).addExpressionInfo(
                    EXPRESSION_PREFIX + expression.hashCode(),
                    expressionInfo
View Full Code Here

        ExpressionNamespace namespace = ExpressionNamespace.getNamespace(aspectDef

                .getFullQualifiedName());

        ExpressionInfo expressionInfo = new ExpressionInfo(pointcut, aspectDef

                .getFullQualifiedName());

        namespace.addExpressionInfo(pointcutName, expressionInfo);
View Full Code Here

                }

                //TODO - do we care about non bounded pointcut ?
                for (Iterator iterator2 = aspectDefinition.getAdviceDefinitions().iterator(); iterator2.hasNext();) {
                    AdviceDefinition adviceDefinition = (AdviceDefinition) iterator2.next();
                    final ExpressionInfo expressionInfo = adviceDefinition.getExpressionInfo();
                    if (expressionInfo == null) {
                        continue;
                    }
                    if (expressionInfo.getExpression().match(expressionContext)) {
                        // compute the target method to advice method arguments map, and grab information about this
                        // and target bindings
                        expressionContext.resetRuntimeState();
                        ArgsIndexVisitor.updateContextForRuntimeInformation(
                                expressionInfo,
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.expression.ExpressionInfo

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.