Package org.apache.commons.jexl2

Examples of org.apache.commons.jexl2.DebugInfo


        Debugger dbg = new Debugger();
        // iterate over all expression in cache
        Iterator<Map.Entry<String,ASTJexlScript>> inodes = jexl.cache.entrySet().iterator();
        while (inodes.hasNext()) {
            Map.Entry<String,ASTJexlScript> entry = inodes.next();
            JexlNode node = entry.getValue();
            // recreate expr string from AST
            dbg.debug(node);
            String expressiondbg = dbg.data();
            // recreate expr from string
            Expression exprdbg = jdbg.createExpression(expressiondbg);
            // make arg cause become the root cause
            JexlNode root = ((ExpressionImpl) exprdbg).script;
            while (root.jjtGetParent() != null) {
                root = root.jjtGetParent();
            }
            // test equality
            String reason = JexlTestCase.checkEquals(root, node);
            if (reason != null) {
                throw new RuntimeException("debugger equal failed: "
View Full Code Here


    /** {@inheritDoc} */
    public Object visit(ASTWhileStatement node, Object data) {
        Object result = null;
        /* first objectNode is the expression */
        Node expressionNode = node.jjtGetChild(0);
        while (arithmetic.toBoolean(expressionNode.jjtAccept(this, data))) {
            // execute statement
            result = node.jjtGetChild(1).jjtAccept(this, data);
        }

        return result;
View Full Code Here

    {
        JexlContext jc = new MapContext();
        jc.set("aString", "Hello");
        Foo foo = new Foo();
        jc.set("foo", foo);
        Parser parser = new Parser(new StringReader(";"));
        parser.parse(new StringReader("aString = 'World';"), null);
       
        assertExpression(jc, "hello = 'world'", "world");
        assertEquals("hello variable not changed", "world", jc.get("hello"));
        assertExpression(jc, "result = 1 + 1", new Integer(2));
        assertEquals("result variable not changed", new Integer(2), jc.get("result"));
View Full Code Here

     * @throws InvalidSearchConditionException in case of errors retrieving identifiers
     */
    private Set<String> getWhereClause(final String expression, final String value, final AttributableUtil attrUtil)
            throws InvalidSearchConditionException {

        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.hasText(token.toString())) {
            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

            if (token.kind == ParserConstants.IDENTIFIER) {
View Full Code Here

     * @return where clauses to use to build the query.
     * @throws InvalidSearchConditionException in case of errors retrieving identifiers.
     */
    private Set<String> getWhereClause(final String expression, final String value)
            throws InvalidSearchConditionException {
        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.isNotBlank(token.toString())) {
            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

            if (token.kind == ParserConstants.IDENTIFIER) {
View Full Code Here

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.hasText(token.toString())) {
            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

            if (token.kind == ParserConstants.IDENTIFIER) {
                identifiers.add(token.toString());
            }
        }

        // Sort literals in order to process later literals included into others
        Collections.sort(literals, new Comparator<String>() {
View Full Code Here

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.isNotBlank(token.toString())) {
            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

            if (token.kind == ParserConstants.IDENTIFIER) {
                identifiers.add(token.toString());
            }
        }

        // Sort literals in order to process later literals included into others
        Collections.sort(literals, new Comparator<String>() {
View Full Code Here

    private DebugInfo createDebugInfo(BpelObject bpelObject, String description) {
        int lineNo = bpelObject == null ? -1 : bpelObject.getLineNo();
        String str = description == null && bpelObject != null ? bpelObject.toString() : null;
        Map<QName, Object> extElmt = bpelObject == null ? null : bpelObject.getExtensibilityElements();
        DebugInfo debugInfo = new DebugInfo(_processDef.getSource(), lineNo, extElmt);
        debugInfo.description = str;
        return debugInfo;
    }
View Full Code Here

    private DebugInfo createDebugInfo(BpelObject bpelObject, String description) {
        int lineNo = bpelObject == null ? -1 : bpelObject.getLineNo();
        String str = description == null && bpelObject != null ? bpelObject.toString() : null;
        Map<QName, Object> extElmt = bpelObject == null ? null : bpelObject.getExtensibilityElements();
        DebugInfo debugInfo = new DebugInfo(_processDef.getSource(), lineNo, extElmt);
        debugInfo.description = str;
        return debugInfo;
    }
View Full Code Here

            OAssign.Copy ocopy = new OAssign.Copy(_context.getOProcess());
                ocopy.keepSrcElementName = scopy.isKeepSrcElement();
                ocopy.ignoreMissingFromData = scopy.isIgnoreMissingFromData();
                ocopy.insertMissingToData = scopy.isInsertMissingToData();
                ocopy.ignoreUninitializedFromVariable = scopy.isIgnoreUninitializedFromVariable();
                ocopy.debugInfo = new DebugInfo(_context.getSourceLocation(), scopy.getLineNo(),
                        source.getExtensibilityElements());
                try {
                    if (scopy.getFrom() == null)
                        throw new CompilationException(__cmsgs.errMissingFromSpec().setSource(scopy));
                    ocopy.from = compileFrom(scopy.getFrom());
                    if (scopy.getTo() == null)
                        throw new CompilationException(__cmsgs.errMissingToSpec().setSource(scopy));
                    ocopy.to = compileTo(scopy.getTo());

                    verifyCopy(ocopy);
                    oassign.operations.add(ocopy);

                } catch (CompilationException ce) {
                    _context.recoveredFromError(scopy, ce);
                }
          } else if (operation instanceof ExtensionAssignOperation) {
            ExtensionAssignOperation sop = (ExtensionAssignOperation)operation;
            OAssign.ExtensionAssignOperation oext = new OAssign.ExtensionAssignOperation(_context.getOProcess());
            oext.debugInfo = new DebugInfo(_context.getSourceLocation(), sop.getLineNo(), source.getExtensibilityElements());
            try {
              if (source.is20Draft()) {
                throw new CompilationException(__cmsgs.errExtensibleAssignNotSupported());
              }
              Element el = sop.getNestedElement();
View Full Code Here

TOP

Related Classes of org.apache.commons.jexl2.DebugInfo

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.