Examples of ExprNodeScript


Examples of com.espertech.esper.epl.script.ExprNodeScript

                String name = chain.get(0).getName();
                if (mapContext.getExpressionDeclarations() != null && mapContext.getExpressionDeclarations().containsKey(name)) {
                    return new ExprDeclaredNodeImpl(mapContext.getExpressionDeclarations().get(name), chain.get(0).getParameters());
                }
                if (mapContext.getScripts() != null && mapContext.getScripts().containsKey(name)) {
                    return new ExprNodeScript(mapContext.getConfiguration().getEngineDefaults().getScripts().getDefaultDialect(), mapContext.getScripts().get(name), chain.get(0).getParameters());
                }
            }
            return new ExprDotNode(chain,
                    mapContext.getConfiguration().getEngineDefaults().getExpression().isDuckTyping(),
                    mapContext.getConfiguration().getEngineDefaults().getExpression().isUdfCache());
View Full Code Here

Examples of com.espertech.esper.epl.script.ExprNodeScript

            ExprLambdaGoesNode lambdaNode = (ExprLambdaGoesNode) expr;
            LambdaExpression lambdaExpr = new LambdaExpression(new ArrayList<String>(lambdaNode.getGoesToNames()));
            return lambdaExpr;
        }
        else if (expr instanceof ExprNodeScript) {
            ExprNodeScript scriptNode = (ExprNodeScript) expr;
            DotExpression dotExpr = new DotExpression();
            dotExpr.add(scriptNode.getScript().getName(), unmapExpressionDeep(scriptNode.getParameters(), unmapContext));
            return dotExpr;
        }
        throw new IllegalArgumentException("Could not map expression node of type " + expr.getClass().getSimpleName());
    }
View Full Code Here

Examples of com.espertech.esper.epl.script.ExprNodeScript

            Pair<String, String> mappedPropertyPair = ASTFilterSpecHelper.getMappedPropertyPair(node);
            if (mappedPropertyPair != null) {
                ExpressionScriptProvided script = findScript(mappedPropertyPair.getFirst(), 1);
                if (script != null) {
                    exprNode = new ExprNodeScript(configurationInformation.getEngineDefaults().getScripts().getDefaultDialect(), script,
                            Collections.<ExprNode>singletonList(new ExprConstantNodeImpl(mappedPropertyPair.getSecond())));
                }
            }
        }
        // --> this is more then one child node, and the first child node is a simple property
View Full Code Here

Examples of com.espertech.esper.epl.script.ExprNodeScript

        if (!scriptExpressions.isEmpty()) {
            String name = node.getChild(0).getText();
            List<ExprChainedSpec> chained = getLibFuncChain(parent);
            ExpressionScriptProvided script = findScript(name, chained.get(0).getParameters().size());
            if (script != null) {
                astExprNodeMap.put(node, new ExprNodeScript(configurationInformation.getEngineDefaults().getScripts().getDefaultDialect(), script, chained.get(0).getParameters()));
                return;
            }
        }

        // Could be a mapped property with an expression-parameter "mapped(expr)" or array property with an expression-parameter "array(expr)".
View Full Code Here

Examples of com.espertech.esper.epl.script.ExprNodeScript

        // try scripting expression
        if (!scriptExpressions.isEmpty()) {
            String name = chained.get(0).getName();
            ExpressionScriptProvided script = findScript(name, chained.get(0).getParameters().size());
            if (script != null) {
                dotNode.addChildNode(new ExprNodeScript(configurationInformation.getEngineDefaults().getScripts().getDefaultDialect(), script, chained.get(0).getParameters()));
                chained.remove(0);
            }
        }

        astExprNodeMap.put(node, dotNode);
View Full Code Here

Examples of com.espertech.esper.epl.script.ExprNodeScript

    public static ExprNodeScript getExistsScript(String defaultDialect, String expressionName, List<ExprNode> parameters, Collection<ExpressionScriptProvided> scriptExpressions, ExprDeclaredService exprDeclaredService) {
        if (!scriptExpressions.isEmpty()) {
            ExpressionScriptProvided script = findScript(expressionName, parameters.size(), scriptExpressions);
            if (script != null) {
                return new ExprNodeScript(defaultDialect, script, parameters);
            }
        }

        List<ExpressionScriptProvided> globalScripts = exprDeclaredService.getScriptsByName(expressionName);
        ExpressionScriptProvided script = findScript(expressionName, parameters.size(), globalScripts);
        if (script != null) {
            return new ExprNodeScript(defaultDialect, script, parameters);
        }
        return null;
    }
View Full Code Here

Examples of com.espertech.esper.epl.script.ExprNodeScript

            EsperEPL2GrammarParser.EventPropertyAtomicContext first = ctx.eventPropertyAtomic().get(0);
            if (first.lp != null) {
                String ident = ASTUtil.escapeDot(first.eventPropertyIdent().getText());
                String key = StringValue.parseString(first.s.getText());
                List<ExprNode> params = Collections.<ExprNode>singletonList(new ExprConstantNodeImpl(key));
                ExprNodeScript scriptNode = ExprDeclaredHelper.getExistsScript(getDefaultDialect(), ident, params, scriptExpressions, exprDeclaredService);
                if (scriptNode != null) {
                    exprNode = scriptNode;
                }
            }
        }
View Full Code Here

Examples of com.espertech.esper.epl.script.ExprNodeScript

            ASTExprHelper.exprCollectAddSubNodesAddParentNode(exprNode, ctx, astExprNodeMap);
            return;
        }

        // try script
        ExprNodeScript scriptNode = ExprDeclaredHelper.getExistsScript(configurationInformation.getEngineDefaults().getScripts().getDefaultDialect(), chain.get(0).getName(), chain.get(0).getParameters(), scriptExpressions, exprDeclaredService);
        if (scriptNode != null) {
            chain.remove(0);
            ExprNode exprNode;
            if (chain.isEmpty()) {
                exprNode = scriptNode;
View Full Code Here

Examples of com.espertech.esper.epl.script.ExprNodeScript

                String name = chain.get(0).getName();
                ExprDeclaredNodeImpl declared = ExprDeclaredHelper.getExistsDeclaredExpr(name, chain.get(0).getParameters(), mapContext.getExpressionDeclarations().values(), mapContext.getExprDeclaredService(), mapContext.getContextDescriptor());
                if (declared != null) {
                    return declared;
                }
                ExprNodeScript script = ExprDeclaredHelper.getExistsScript(mapContext.getConfiguration().getEngineDefaults().getScripts().getDefaultDialect(),
                        name, chain.get(0).getParameters(), mapContext.getScripts().values(), mapContext.getExprDeclaredService());
                if (script != null) {
                    return script;
                }
            }
View Full Code Here

Examples of com.espertech.esper.epl.script.ExprNodeScript

            ExprLambdaGoesNode lambdaNode = (ExprLambdaGoesNode) expr;
            LambdaExpression lambdaExpr = new LambdaExpression(new ArrayList<String>(lambdaNode.getGoesToNames()));
            return lambdaExpr;
        }
        else if (expr instanceof ExprNodeScript) {
            ExprNodeScript scriptNode = (ExprNodeScript) expr;
            DotExpression dotExpr = new DotExpression();
            dotExpr.add(scriptNode.getScript().getName(), unmapExpressionDeep(scriptNode.getParameters(), unmapContext));
            return dotExpr;
        }
        else if (expr instanceof ExprGroupingNode) {
            return new GroupingExpression();
        }
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.