当前位置: 首页>>代码示例>>Java>>正文


Java ScheduleSpecUtil类代码示例

本文整理汇总了Java中com.espertech.esper.schedule.ScheduleSpecUtil的典型用法代码示例。如果您正苦于以下问题:Java ScheduleSpecUtil类的具体用法?Java ScheduleSpecUtil怎么用?Java ScheduleSpecUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScheduleSpecUtil类属于com.espertech.esper.schedule包,在下文中一共展示了ScheduleSpecUtil类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: crontabScheduleValidate

import com.espertech.esper.schedule.ScheduleSpecUtil; //导入依赖的package包/类
public static ExprEvaluator[] crontabScheduleValidate(ExprNodeOrigin origin, List<ExprNode> scheduleSpecExpressionList, StatementContext context, boolean allowBindingConsumption)
        throws ExprValidationException {

    // Validate the expressions
    ExprEvaluator[] expressions = new ExprEvaluator[scheduleSpecExpressionList.size()];
    int count = 0;
    ExprEvaluatorContextStatement evaluatorContextStmt = new ExprEvaluatorContextStatement(context, false);
    for (ExprNode parameters : scheduleSpecExpressionList) {
        ExprValidationContext validationContext = new ExprValidationContext(new StreamTypeServiceImpl(context.getEngineURI(), false), context.getEngineImportService(), context.getStatementExtensionServicesContext(), null, context.getSchedulingService(), context.getVariableService(), context.getTableService(), evaluatorContextStmt, context.getEventAdapterService(), context.getStatementName(), context.getStatementId(), context.getAnnotations(), context.getContextDescriptor(), false, false, allowBindingConsumption, false, null, false);
        ExprNode node = ExprNodeUtilityRich.getValidatedSubtree(origin, parameters, validationContext);
        expressions[count++] = ExprNodeCompiler.allocateEvaluator(node.getForge(), context.getEngineImportService(), ExprNodeUtilityCore.class, false, context.getStatementName());
    }

    if (expressions.length <= 4 || expressions.length >= 8) {
        throw new ExprValidationException("Invalid schedule specification: " + ScheduleSpecUtil.getExpressionCountException(expressions.length));
    }

    return expressions;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:20,代码来源:EPLScheduleExpressionUtil.java

示例2: toCrontabSchedule

import com.espertech.esper.schedule.ScheduleSpecUtil; //导入依赖的package包/类
public static ScheduleSpec toCrontabSchedule(List<ExprNode> scheduleSpecExpressionList, StatementContext context)
    throws ExprValidationException {

    // Validate the expressions
    ExprEvaluator[] expressions = new ExprEvaluator[scheduleSpecExpressionList.size()];
    int count = 0;
    ExprEvaluatorContextStatement evaluatorContextStmt = new ExprEvaluatorContextStatement(context);
    for (ExprNode parameters : scheduleSpecExpressionList)
    {
        ExprValidationContext validationContext = new ExprValidationContext(new StreamTypeServiceImpl(context.getEngineURI(), false), context.getMethodResolutionService(), null, context.getSchedulingService(), context.getVariableService(), evaluatorContextStmt, context.getEventAdapterService(), context.getStatementName(), context.getStatementId(), context.getAnnotations(), context.getContextDescriptor());
        ExprNode node = ExprNodeUtility.getValidatedSubtree(parameters, validationContext);
        expressions[count++] = node.getExprEvaluator();
    }

    // Build a schedule
    try
    {
        Object[] scheduleSpecParameterList = evaluateExpressions(expressions, evaluatorContextStmt);
        return ScheduleSpecUtil.computeValues(scheduleSpecParameterList);
    }
    catch (ScheduleParameterException e)
    {
        throw new IllegalArgumentException("Invalid schedule specification : " + e.getMessage(), e);
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:26,代码来源:ExprNodeUtility.java

示例3: setObserverParameters

import com.espertech.esper.schedule.ScheduleSpecUtil; //导入依赖的package包/类
public void setObserverParameters(List<ExprNode> parameters, MatchedEventConvertor convertor, ExprValidationContext validationContext) throws ObserverParameterException {
    ObserverParameterUtil.validateNoNamedParameters("timer:at", parameters);
    if (log.isDebugEnabled()) {
        log.debug(".setObserverParameters " + parameters);
    }

    if ((parameters.size() < 5) || (parameters.size() > 7)) {
        throw new ObserverParameterException("Invalid number of parameters for timer:at");
    }

    this.parameters = parameters;
    this.convertor = convertor;

    // if all parameters are constants, lets try to evaluate and build a schedule for early validation
    boolean allConstantResult = true;
    for (ExprNode param : parameters) {
        if (!param.isConstantResult()) {
            allConstantResult = false;
        }
    }

    if (allConstantResult) {
        try {
            List<Object> observerParameters = PatternExpressionUtil.evaluate("Timer-at observer", new MatchedEventMapImpl(convertor.getMatchedEventMapMeta()), parameters, convertor, null);
            spec = ScheduleSpecUtil.computeValues(observerParameters.toArray());
        } catch (ScheduleParameterException e) {
            throw new ObserverParameterException("Error computing crontab schedule specification: " + e.getMessage(), e);
        }
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:31,代码来源:TimerAtObserverFactory.java

示例4: computeSpec

import com.espertech.esper.schedule.ScheduleSpecUtil; //导入依赖的package包/类
public ScheduleSpec computeSpec(MatchedEventMap beginState, PatternAgentInstanceContext context) {
    if (spec != null) {
        return spec;
    }
    List<Object> observerParameters = PatternExpressionUtil.evaluate("Timer-at observer", beginState, parameters, convertor, context.getAgentInstanceContext());
    try {
        return ScheduleSpecUtil.computeValues(observerParameters.toArray());
    } catch (ScheduleParameterException e) {
        throw new EPException("Error computing crontab schedule specification: " + e.getMessage(), e);
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:12,代码来源:TimerAtObserverFactory.java

示例5: makeNew

import com.espertech.esper.schedule.ScheduleSpecUtil; //导入依赖的package包/类
public OutputConditionPolled makeNew(AgentInstanceContext agentInstanceContext) {
    ScheduleSpec scheduleSpec;
    try {
        Object[] scheduleSpecParameterList = evaluate(expressions, agentInstanceContext);
        scheduleSpec = ScheduleSpecUtil.computeValues(scheduleSpecParameterList);
    } catch (ScheduleParameterException e) {
        throw new IllegalArgumentException("Invalid schedule specification : " + e.getMessage(), e);
    }
    OutputConditionPolledCrontabState state = new OutputConditionPolledCrontabState(scheduleSpec, null, 0);
    return new OutputConditionPolledCrontab(agentInstanceContext, state);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:12,代码来源:OutputConditionPolledCrontabFactory.java

示例6: crontabScheduleBuild

import com.espertech.esper.schedule.ScheduleSpecUtil; //导入依赖的package包/类
public static ScheduleSpec crontabScheduleBuild(ExprEvaluator[] scheduleSpecEvaluators, ExprEvaluatorContext context) {

        // Build a schedule
        try {
            Object[] scheduleSpecParameterList = evaluateExpressions(scheduleSpecEvaluators, context);
            return ScheduleSpecUtil.computeValues(scheduleSpecParameterList);
        } catch (ScheduleParameterException e) {
            throw new EPException("Invalid schedule specification: " + e.getMessage(), e);
        }
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:11,代码来源:EPLScheduleExpressionUtil.java

示例7: setObserverParameters

import com.espertech.esper.schedule.ScheduleSpecUtil; //导入依赖的package包/类
public void setObserverParameters(List<ExprNode> parameters, MatchedEventConvertor convertor) throws ObserverParameterException
{
    if (log.isDebugEnabled())
    {
        log.debug(".setObserverParameters " + parameters);
    }

    if ((parameters.size() < 5) || (parameters.size() > 6))
    {
        throw new ObserverParameterException("Invalid number of parameters for timer:at");
    }

    this.parameters = parameters;
    this.convertor = convertor;

    // if all parameters are constants, lets try to evaluate and build a schedule for early validation
    boolean allConstantResult = true;
    for (ExprNode param : parameters)
    {
        if (!param.isConstantResult())
        {
            allConstantResult = false;
        }
    }

    if (allConstantResult)
    {
        try
        {
            List<Object> observerParameters = PatternExpressionUtil.evaluate("Timer-at observer", new MatchedEventMapImpl(convertor.getMatchedEventMapMeta()), parameters, convertor, null);
            spec = ScheduleSpecUtil.computeValues(observerParameters.toArray());
        }
        catch (ScheduleParameterException e)
        {
            throw new ObserverParameterException("Error computing crontab schedule specification: " + e.getMessage(), e);
        }
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:39,代码来源:TimerAtObserverFactory.java

示例8: computeSpec

import com.espertech.esper.schedule.ScheduleSpecUtil; //导入依赖的package包/类
protected ScheduleSpec computeSpec(MatchedEventMap beginState, PatternAgentInstanceContext context) {
    if (spec != null) {
        return spec;
    }
    List<Object> observerParameters = PatternExpressionUtil.evaluate("Timer-at observer", beginState, parameters, convertor, context.getAgentInstanceContext());
    try {
        return ScheduleSpecUtil.computeValues(observerParameters.toArray());
    }
    catch (ScheduleParameterException e) {
        throw new EPException("Error computing crontab schedule specification: " + e.getMessage(), e);
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:13,代码来源:TimerAtObserverFactory.java

示例9: OutputConditionPolledCrontab

import com.espertech.esper.schedule.ScheduleSpecUtil; //导入依赖的package包/类
/**
 * Constructor.
 * @param agentInstanceContext is the view context for time scheduling
 * @param scheduleSpecExpressionList list of schedule parameters
 * @throws com.espertech.esper.epl.expression.ExprValidationException if the crontab expression failed to validate
 */
public OutputConditionPolledCrontab(List<ExprNode> scheduleSpecExpressionList,
                               AgentInstanceContext agentInstanceContext)
        throws ExprValidationException
{
    if (agentInstanceContext == null)
    {
        String message = "OutputConditionTime requires a non-null view context";
        throw new NullPointerException(message);
    }

    this.agentInstanceContext = agentInstanceContext;

    // Validate the expression
    ExprEvaluator[] expressions = new ExprEvaluator[scheduleSpecExpressionList.size()];
    int count = 0;
    ExprValidationContext validationContext = new ExprValidationContext(new StreamTypeServiceImpl(agentInstanceContext.getStatementContext().getEngineURI(), false), agentInstanceContext.getStatementContext().getMethodResolutionService(), null, agentInstanceContext.getStatementContext().getSchedulingService(), agentInstanceContext.getStatementContext().getVariableService(), agentInstanceContext, agentInstanceContext.getStatementContext().getEventAdapterService(), agentInstanceContext.getStatementContext().getStatementName(), agentInstanceContext.getStatementContext().getStatementId(), agentInstanceContext.getStatementContext().getAnnotations(), agentInstanceContext.getStatementContext().getContextDescriptor());
    for (ExprNode parameters : scheduleSpecExpressionList)
    {
        ExprNode node = ExprNodeUtility.getValidatedSubtree(parameters, validationContext);
        expressions[count++] = node.getExprEvaluator();
    }

    try
    {
        Object[] scheduleSpecParameterList = evaluate(expressions, agentInstanceContext);
        scheduleSpec = ScheduleSpecUtil.computeValues(scheduleSpecParameterList);
    }
    catch (ScheduleParameterException e)
    {
        throw new IllegalArgumentException("Invalid schedule specification : " + e.getMessage(), e);
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:39,代码来源:OutputConditionPolledCrontab.java


注:本文中的com.espertech.esper.schedule.ScheduleSpecUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。