Ejemplo n.º 1
0
        public bool Inspect(MatchedEventMap matchEvent)
        {
            var eventsPerStream = convertor.Invoke(matchEvent);

            try {
                var result = expression.Evaluate(eventsPerStream, true, quitable.Context.AgentInstanceContext);
                if (result == null) {
                    return false;
                }

                if (true.Equals(result)) {
                    return true;
                }

                quitable.GuardQuit();
                return false;
            }
            catch (EPRuntimeException ex) {
                var message = "Failed to evaluate expression for pattern-guard for statement '" +
                              quitable.Context.AgentInstanceContext.StatementName +
                              "'";
                if (ex.Message != null) {
                    message += ": " + ex.Message;
                }

                log.Error(message, ex);
                throw new EPException(message);
            }
        }
Ejemplo n.º 2
0
 public static object GetKeys(
     MatchedEventMap matchEvent,
     MatchedEventConvertor convertor,
     ExprEvaluator expression,
     AgentInstanceContext agentInstanceContext)
 {
     var eventsPerStream = convertor.Invoke(matchEvent);
     return expression.Evaluate(eventsPerStream, true, agentInstanceContext);
 }
 public TimerScheduleSpec Compute(
     MatchedEventConvertor optionalConvertor,
     MatchedEventMap beginState,
     ExprEvaluatorContext exprEvaluatorContext,
     TimeZoneInfo timeZone,
     TimeAbacus timeAbacus)
 {
     EventBean[] eventsPerStream = optionalConvertor == null ? null : optionalConvertor.Invoke(beginState);
     return Compute(date, repetitions, timePeriod, eventsPerStream, exprEvaluatorContext, timeZone, timeAbacus);
 }
Ejemplo n.º 4
0
 public TimerScheduleSpec Compute(
     MatchedEventConvertor optionalConvertor,
     MatchedEventMap beginState,
     ExprEvaluatorContext exprEvaluatorContext,
     TimeZoneInfo timeZone,
     TimeAbacus timeAbacus)
 {
     EventBean[] events = optionalConvertor == null ? null : optionalConvertor.Invoke(beginState);
     return Compute(parameter, events, exprEvaluatorContext);
 }
Ejemplo n.º 5
0
        public EventObserver MakeObserver(
            PatternAgentInstanceContext context,
            MatchedEventMap beginState,
            ObserverEventEvaluator observerEventEvaluator,
            object observerState,
            bool isFilterChildNonQuitting)
        {
            var events = convertor == null ? null : convertor.Invoke(beginState);
            var filename = PatternExpressionUtil.EvaluateChecked(
                "File-exists observer ",
                filenameExpression,
                events,
                context.AgentInstanceContext);
            if (filename == null) {
                throw new EPException("Filename evaluated to null");
            }

            return new MyFileExistsObserver(beginState, observerEventEvaluator, filename.ToString());
        }