示例#1
0
        public static ExprForge[] CrontabScheduleValidate(
            ExprNodeOrigin origin,
            IList<ExprNode> scheduleSpecExpressionList,
            bool allowBindingConsumption,
            StatementRawInfo statementRawInfo,
            StatementCompileTimeServices services)
        {
            // Validate the expressions
            ExprForge[] expressions = new ExprForge[scheduleSpecExpressionList.Count];
            int count = 0;
            ExprValidationContext validationContext =
                new ExprValidationContextBuilder(new StreamTypeServiceImpl(false), statementRawInfo, services)
                    .WithAllowBindingConsumption(allowBindingConsumption)
                    .Build();
            foreach (ExprNode parameters in scheduleSpecExpressionList) {
                ExprNode node = ExprNodeUtilityValidate.GetValidatedSubtree(origin, parameters, validationContext);
                expressions[count++] = node.Forge;
            }

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

            return expressions;
        }
示例#2
0
 public static ScheduleSpec CrontabScheduleBuild(
     ExprEvaluator[] scheduleSpecEvaluators,
     ExprEvaluatorContext context)
 {
     try {
         object[] scheduleSpecParameterList = EvaluateExpressions(scheduleSpecEvaluators, context);
         return ScheduleSpecUtil.ComputeValues(scheduleSpecParameterList);
     }
     catch (ScheduleParameterException e) {
         throw new EPException("Invalid schedule specification: " + e.Message, e);
     }
 }