本文整理汇总了Java中com.espertech.esper.schedule.ScheduleSpecUtil.computeValues方法的典型用法代码示例。如果您正苦于以下问题:Java ScheduleSpecUtil.computeValues方法的具体用法?Java ScheduleSpecUtil.computeValues怎么用?Java ScheduleSpecUtil.computeValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.espertech.esper.schedule.ScheduleSpecUtil
的用法示例。
在下文中一共展示了ScheduleSpecUtil.computeValues方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
}
示例3: 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);
}
}
示例4: 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);
}
示例5: 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);
}
}
示例6: 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);
}
}
}
示例7: 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);
}
}
示例8: 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);
}
}