當前位置: 首頁>>代碼示例>>Java>>正文


Java EPAdministratorHelper類代碼示例

本文整理匯總了Java中com.espertech.esper.core.service.EPAdministratorHelper的典型用法代碼示例。如果您正苦於以下問題:Java EPAdministratorHelper類的具體用法?Java EPAdministratorHelper怎麽用?Java EPAdministratorHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EPAdministratorHelper類屬於com.espertech.esper.core.service包,在下文中一共展示了EPAdministratorHelper類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toExpression

import com.espertech.esper.core.service.EPAdministratorHelper; //導入依賴的package包/類
public static ExprForge toExpression(String hint, StatementContext statementContext) throws ExprValidationException {
    String toCompile = "select * from java.lang.Object#time(" + hint + ")";
    StatementSpecRaw raw = EPAdministratorHelper.compileEPL(toCompile, hint, false, null,
            SelectClauseStreamSelectorEnum.ISTREAM_ONLY, statementContext.getEngineImportService(),
            statementContext.getVariableService(),
            statementContext.getEngineURI(), statementContext.getConfigSnapshot(),
            new PatternNodeFactoryImpl(), new ContextManagementServiceImpl(statementContext.getEngineURI()),
            new ExprDeclaredServiceImpl(), new TableServiceImpl());
    ExprNode expr = raw.getStreamSpecs().get(0).getViewSpecs()[0].getObjectParameters().get(0);
    ExprNode validated = EPLValidationUtil.validateSimpleGetSubtree(ExprNodeOrigin.HINT, expr, statementContext, OAEXPRESSIONTYPE, false);
    return validated.getForge();
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:13,代碼來源:ExcludePlanHintExprUtil.java

示例2: mapSQLParameters

import com.espertech.esper.core.service.EPAdministratorHelper; //導入依賴的package包/類
private static void mapSQLParameters(FromClause fromClause, StatementSpecRaw raw, StatementSpecMapContext mapContext) {
    if ((fromClause == null) || (fromClause.getStreams() == null)) {
        return;
    }
    int streamNum = -1;
    for (Stream stream : fromClause.getStreams()) {
        streamNum++;
        if (!(stream instanceof SQLStream)) {
            continue;
        }
        SQLStream sqlStream = (SQLStream) stream;

        List<PlaceholderParser.Fragment> sqlFragments = null;
        try {
            sqlFragments = PlaceholderParser.parsePlaceholder(sqlStream.getSqlWithSubsParams());
        } catch (PlaceholderParseException e) {
            throw new RuntimeException("Error parsing SQL placeholder expression '" + sqlStream.getSqlWithSubsParams() + "': ");
        }

        for (PlaceholderParser.Fragment fragment : sqlFragments) {
            if (!(fragment instanceof PlaceholderParser.ParameterFragment)) {
                continue;
            }

            // Parse expression, store for substitution parameters
            String expression = fragment.getValue();
            if (expression.toUpperCase(Locale.ENGLISH).equals(DatabasePollingViewableFactory.SAMPLE_WHERECLAUSE_PLACEHOLDER)) {
                continue;
            }

            if (expression.trim().length() == 0) {
                throw ASTWalkException.from("Missing expression within ${...} in SQL statement");
            }
            String toCompile = "select * from java.lang.Object where " + expression;
            StatementSpecRaw rawSqlExpr = EPAdministratorHelper.compileEPL(toCompile, expression, false, null, SelectClauseStreamSelectorEnum.ISTREAM_ONLY,
                    mapContext.getEngineImportService(), mapContext.getVariableService(), mapContext.getEngineURI(), mapContext.getConfiguration(), mapContext.getPatternNodeFactory(), mapContext.getContextManagementService(), mapContext.getExprDeclaredService(), mapContext.getTableService());

            if ((rawSqlExpr.getSubstitutionParameters() != null) && (rawSqlExpr.getSubstitutionParameters().size() > 0)) {
                throw ASTWalkException.from("EPL substitution parameters are not allowed in SQL ${...} expressions, consider using a variable instead");
            }

            if (rawSqlExpr.isHasVariables()) {
                mapContext.setHasVariables(true);
            }

            // add expression
            if (raw.getSqlParameters() == null) {
                raw.setSqlParameters(new HashMap<Integer, List<ExprNode>>());
            }
            List<ExprNode> listExp = raw.getSqlParameters().get(streamNum);
            if (listExp == null) {
                listExp = new ArrayList<ExprNode>();
                raw.getSqlParameters().put(streamNum, listExp);
            }
            listExp.add(rawSqlExpr.getFilterRootNode());
        }
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:59,代碼來源:StatementSpecMapper.java

示例3: mapSQLParameters

import com.espertech.esper.core.service.EPAdministratorHelper; //導入依賴的package包/類
private static void mapSQLParameters(FromClause fromClause, StatementSpecRaw raw, StatementSpecMapContext mapContext)
{
    if ((fromClause == null) || (fromClause.getStreams() == null)) {
        return;
    }
    int streamNum = -1;
    for (Stream stream : fromClause.getStreams()) {
        streamNum++;
        if (!(stream instanceof SQLStream)) {
            continue;
        }
        SQLStream sqlStream = (SQLStream) stream;

        List<PlaceholderParser.Fragment> sqlFragments = null;
        try
        {
            sqlFragments = PlaceholderParser.parsePlaceholder(sqlStream.getSqlWithSubsParams());
        }
        catch (PlaceholderParseException e)
        {
            throw new RuntimeException("Error parsing SQL placeholder expression '" + sqlStream.getSqlWithSubsParams() + "': ");
        }

        for (PlaceholderParser.Fragment fragment : sqlFragments)
        {
            if (!(fragment instanceof PlaceholderParser.ParameterFragment)) {
                continue;
            }

            // Parse expression, store for substitution parameters
            String expression = fragment.getValue();
            if (expression.toUpperCase().equals(DatabasePollingViewableFactory.SAMPLE_WHERECLAUSE_PLACEHOLDER)) {
                continue;
            }

            if (expression.trim().length() == 0) {
                throw new ASTWalkException("Missing expression within ${...} in SQL statement");
            }
            String toCompile = "select * from java.lang.Object where " + expression;
            StatementSpecRaw rawSqlExpr = EPAdministratorHelper.compileEPL(toCompile, expression, false, null, SelectClauseStreamSelectorEnum.ISTREAM_ONLY,
                    mapContext.getEngineImportService(), mapContext.getVariableService(), mapContext.getSchedulingService(), mapContext.getEngineURI(), mapContext.getConfiguration(), mapContext.getPatternNodeFactory(), mapContext.getContextManagementService(), mapContext.getExprDeclaredService());

            if ((rawSqlExpr.getSubstitutionParameters() != null) && (rawSqlExpr.getSubstitutionParameters().size() > 0)) {
                throw new ASTWalkException("EPL substitution parameters are not allowed in SQL ${...} expressions, consider using a variable instead");
            }

            if (rawSqlExpr.isHasVariables()) {
                mapContext.setHasVariables(true);
            }

            // add expression
            if (raw.getSqlParameters() == null) {
                raw.setSqlParameters(new HashMap<Integer, List<ExprNode>>());
            }
            List<ExprNode> listExp = raw.getSqlParameters().get(streamNum);
            if (listExp == null) {
                listExp = new ArrayList<ExprNode>();
                raw.getSqlParameters().put(streamNum, listExp);
            }
            listExp.add(rawSqlExpr.getFilterRootNode());
        }
    }
}
 
開發者ID:mobile-event-processing,項目名稱:Asper,代碼行數:64,代碼來源:StatementSpecMapper.java


注:本文中的com.espertech.esper.core.service.EPAdministratorHelper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。