Ejemplo n.º 1
0
        public TimeAccumView(
            TimeAccumViewFactory timeBatchViewFactory,
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            ViewUpdatedCollection viewUpdatedCollection,
            TimePeriodProvide timePeriodProvide)
        {
            this.agentInstanceContext = agentInstanceContext.AgentInstanceContext;
            factory = timeBatchViewFactory;
            this.viewUpdatedCollection = viewUpdatedCollection;
            scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();
            this.timePeriodProvide = timePeriodProvide;

            ScheduleHandleCallback callback = new ProxyScheduleHandleCallback {
                ProcScheduledTrigger = () => {
                    agentInstanceContext.AuditProvider.ScheduleFire(
                        agentInstanceContext.AgentInstanceContext,
                        ScheduleObjectType.view,
                        factory.ViewName);
                    agentInstanceContext.InstrumentationProvider.QViewScheduledEval(factory);
                    SendRemoveStream();
                    agentInstanceContext.InstrumentationProvider.AViewScheduledEval();
                }
            };
            handle = new EPStatementHandleCallbackSchedule(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                callback);
        }
Ejemplo n.º 2
0
 public FirstUniqueByPropertyView(
     FirstUniqueByPropertyViewFactory viewFactory,
     AgentInstanceViewFactoryChainContext agentInstanceContext)
 {
     this.viewFactory = viewFactory;
     this.agentInstanceContext = agentInstanceContext.AgentInstanceContext;
 }
Ejemplo n.º 3
0
 public WeightedAverageView(
     WeightedAverageViewFactory viewFactory,
     AgentInstanceViewFactoryChainContext agentInstanceContext)
 {
     this.viewFactory = viewFactory;
     this.agentInstanceContext = agentInstanceContext.AgentInstanceContext;
 }
Ejemplo n.º 4
0
        public TimeOrderView(
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            TimeOrderViewFactory factory,
            IStreamSortRankRandomAccess optionalSortedRandomAccess,
            TimePeriodProvide timePeriodProvide)
        {
            this.agentInstanceContext = agentInstanceContext.AgentInstanceContext;
            this.factory = factory;
            this.optionalSortedRandomAccess = optionalSortedRandomAccess;
            scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();
            this.timePeriodProvide = timePeriodProvide;

            sortedEvents = new OrderedListDictionary<object, object>();

            ScheduleHandleCallback callback = new ProxyScheduleHandleCallback {
                ProcScheduledTrigger = () => {
                    agentInstanceContext.AuditProvider.ScheduleFire(
                        agentInstanceContext.AgentInstanceContext,
                        ScheduleObjectType.view,
                        factory.ViewName);
                    agentInstanceContext.InstrumentationProvider.QViewScheduledEval(factory);
                    Expire();
                    agentInstanceContext.InstrumentationProvider.AViewScheduledEval();
                }
            };
            handle = new EPStatementHandleCallbackSchedule(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                callback);
        }
        public override View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
        {
            var builtinBean           = new ObjectArrayEventBean(ExpressionViewOAFieldEnumExtensions.GetPrototypeOA(), BuiltinMapType);
            var viewUpdatedCollection = agentInstanceViewFactoryContext.StatementContext.ViewServicePreviousFactory.GetOptPreviousExprRelativeAccess(agentInstanceViewFactoryContext);

            return(new ExpressionBatchView(this, viewUpdatedCollection, ExpiryExpressionEvaluator, AggregationServiceFactoryDesc, builtinBean, VariableNames, agentInstanceViewFactoryContext));
        }
Ejemplo n.º 6
0
 public UnivariateStatisticsView(
     UnivariateStatisticsViewFactory viewFactory,
     AgentInstanceViewFactoryChainContext agentInstanceContext)
 {
     this.viewFactory = viewFactory;
     this.agentInstanceContext = agentInstanceContext.AgentInstanceContext;
 }
        public View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
        {
            var timeDeltaComputation  = _timeDeltaComputationFactory.Make(ViewName, "view", agentInstanceViewFactoryContext.AgentInstanceContext);
            var viewUpdatedCollection = agentInstanceViewFactoryContext.StatementContext.ViewServicePreviousFactory.GetOptPreviousExprRelativeAccess(agentInstanceViewFactoryContext);

            return(new ExternallyTimedBatchView(this, _timestampExpression, _timestampExpressionEval, timeDeltaComputation, _optionalReferencePoint, viewUpdatedCollection, agentInstanceViewFactoryContext));
        }
        public override View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
        {
            var builtinBean  = new ObjectArrayEventBean(ExpressionViewOAFieldEnumExtensions.GetPrototypeOA(), BuiltinMapType);
            var randomAccess = ViewServiceHelper.GetOptPreviousExprRandomAccess(agentInstanceViewFactoryContext);

            return(new ExpressionWindowView(this, randomAccess, ExpiryExpression.ExprEvaluator, AggregationServiceFactoryDesc, builtinBean, VariableNames, agentInstanceViewFactoryContext));
        }
Ejemplo n.º 9
0
        public View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
        {
            int sortWindowSize = ViewFactorySupport.EvaluateSizeParam(ViewName, _sizeEvaluator, agentInstanceViewFactoryContext.AgentInstanceContext);
            IStreamSortRankRandomAccess rankedRandomAccess = agentInstanceViewFactoryContext.StatementContext.ViewServicePreviousFactory.GetOptPreviousExprSortedRankedAccess(agentInstanceViewFactoryContext);

            return(new RankWindowView(this, _uniqueCriteriaExpressions, _uniqueEvals, _sortCriteriaExpressions, _sortEvals, _isDescendingValues, sortWindowSize, rankedRandomAccess, _useCollatorSort, agentInstanceViewFactoryContext));
        }
Ejemplo n.º 10
0
        public UnionView(
            AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext,
            UnionViewFactory factory,
            IList<View> viewList)
        {
            agentInstanceContext = agentInstanceViewFactoryContext.AgentInstanceContext;
            ViewFactory = factory;
            views = viewList.ToArray();
            unionWindow = new RefCountedSet<EventBean>();
            oldEventsPerView = new EventBean[viewList.Count][];

            for (var i = 0; i < viewList.Count; i++) {
                var view = new LastPostObserverView(i);
                views[i].Child = view;
                view.Observer = this;
            }

            // recover
            for (var i = 0; i < views.Length; i++) {
                var viewSnapshot = views[i].GetEnumerator();
                while (viewSnapshot.MoveNext()) {
                    EventBean theEvent = viewSnapshot.Current;
                    unionWindow.Add(theEvent);
                }
            }
        }
Ejemplo n.º 11
0
        public TimeAccumViewRStream(
            TimeAccumViewFactory timeBatchViewFactory,
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            TimePeriodProvide timePeriodProvide)
        {
            _agentInstanceContext = agentInstanceContext.AgentInstanceContext;
            _factory = timeBatchViewFactory;
            _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();
            _timePeriodProvide = timePeriodProvide;

            ScheduleHandleCallback callback = new ProxyScheduleHandleCallback() {
                ProcScheduledTrigger = () => {
                    agentInstanceContext.AuditProvider.ScheduleFire(
                        agentInstanceContext.AgentInstanceContext,
                        ScheduleObjectType.view,
                        _factory.ViewName);
                    agentInstanceContext.InstrumentationProvider.QViewScheduledEval(_factory);
                    SendRemoveStream();
                    agentInstanceContext.InstrumentationProvider.AViewScheduledEval();
                },
            };
            _handle = new EPStatementHandleCallbackSchedule(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                callback);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="timeBatchViewFactory">for copying this view in a group-by</param>
        /// <param name="agentInstanceContext">The agent instance context.</param>
        /// <param name="timeDeltaComputation">is the number of milliseconds to batch events for</param>
        /// <param name="numberOfEvents">is the event count before the batch fires off</param>
        /// <param name="forceOutput">is true if the batch should produce empty output if there is no value to output following time intervals</param>
        /// <param name="isStartEager">is true for start-eager</param>
        /// <param name="viewUpdatedCollection">is a collection that the view must Update when receiving events</param>
        public TimeLengthBatchView(
            TimeLengthBatchViewFactory timeBatchViewFactory,
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            ExprTimePeriodEvalDeltaConst timeDeltaComputation,
            long numberOfEvents,
            bool forceOutput,
            bool isStartEager,
            ViewUpdatedCollection viewUpdatedCollection)
        {
            _agentInstanceContext       = agentInstanceContext;
            _timeLengthBatchViewFactory = timeBatchViewFactory;
            _timeDeltaComputation       = timeDeltaComputation;
            _numberOfEvents             = numberOfEvents;
            _isStartEager          = isStartEager;
            _viewUpdatedCollection = viewUpdatedCollection;
            _isForceOutput         = forceOutput;

            _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();

            // schedule the first callback
            if (isStartEager)
            {
                ScheduleCallback(0);
            }

            agentInstanceContext.AddTerminationCallback(Stop);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="agentInstanceViewFactoryContext">The agent instance view factory context.</param>
 /// <param name="keepAllViewFactory">for copying this view in a group-by</param>
 /// <param name="viewUpdatedCollection">for satisfying queries that select previous events in window order</param>
 public KeepAllView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext, KeepAllViewFactory keepAllViewFactory, ViewUpdatedCollection viewUpdatedCollection)
 {
     AgentInstanceViewFactoryContext = agentInstanceViewFactoryContext;
     _keepAllViewFactory             = keepAllViewFactory;
     _indexedEvents         = new LinkedHashSet <EventBean>();
     _viewUpdatedCollection = viewUpdatedCollection;
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="viewUpdatedCollection">is a collection that the view must update when receiving events</param>
        /// <param name="timeBatchViewFactory">fr copying this view in a group-by</param>
        /// <param name="agentInstanceContext">is required view services</param>
        /// <param name="timeDeltaComputation">delta computation</param>
        public TimeAccumView(
            TimeAccumViewFactory timeBatchViewFactory,
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            ExprTimePeriodEvalDeltaConst timeDeltaComputation,
            ViewUpdatedCollection viewUpdatedCollection)
        {
            _agentInstanceContext = agentInstanceContext;
            _factory = timeBatchViewFactory;
            _timeDeltaComputation  = timeDeltaComputation;
            _viewUpdatedCollection = viewUpdatedCollection;

            _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();

            var callback = new ProxyScheduleHandleCallback
            {
                ProcScheduledTrigger = extensionServicesContext =>
                {
                    if (InstrumentationHelper.ENABLED)
                    {
                        InstrumentationHelper.Get().QViewScheduledEval(this, _factory.ViewName);
                    }
                    SendRemoveStream();
                    if (InstrumentationHelper.ENABLED)
                    {
                        InstrumentationHelper.Get().AViewScheduledEval();
                    }
                }
            };

            _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback);
            agentInstanceContext.AddTerminationCallback(this);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="agentInstanceViewFactoryContext">The agent instance view factory context.</param>
        /// <param name="factory">the view factory</param>
        /// <param name="eventType">the parent event type</param>
        /// <param name="viewList">the list of data window views</param>
        public UnionAsymetricView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext, UnionViewFactory factory, EventType eventType, IList <View> viewList)
        {
            _agentInstanceViewFactoryContext = agentInstanceViewFactoryContext;
            _unionViewFactory = factory;
            _eventType        = eventType;
            _views            = viewList.ToArray();
            _unionWindow      = new RefCountedSet <EventBean>();
            _oldEventsPerView = new EventBean[viewList.Count][];

            for (var i = 0; i < viewList.Count; i++)
            {
                var view = new LastPostObserverView(i);
                _views[i].RemoveAllViews();
                _views[i].AddView(view);
                view.Observer = this;
            }

            // recover
            for (var i = 0; i < _views.Length; i++)
            {
                var viewSnapshot = _views[i].GetEnumerator();
                while (viewSnapshot.MoveNext())
                {
                    var theEvent = viewSnapshot.Current;
                    _unionWindow.Add(theEvent);
                }
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Instantiate subviews for the given group view and the given key value to group-by. Makes shallow
        /// copies of each child view and its subviews up to the merge point. Sets up merge data views for
        /// merging the group-by key value back in.
        /// </summary>
        /// <param name="groupView">is the parent view for which to copy subviews for</param>
        /// <param name="propertyNames">names of expressions or properties</param>
        /// <param name="groupByValues">is the key values to group-by</param>
        /// <param name="agentInstanceContext">is the view services that sub-views may need</param>
        /// <returns>
        /// a single view or a list of views that are copies of the original list, with copied children, withdata merge views added to the copied child leaf views.
        /// </returns>
        public static Object MakeSubViews(
            GroupByView groupView,
            String[] propertyNames,
            Object groupByValues,
            AgentInstanceViewFactoryChainContext agentInstanceContext)
        {
            if (!groupView.HasViews)
            {
                const string message = "Unexpected empty list of child nodes for group view";
                Log.Error(".copySubViews " + message);
                throw new EPException(message);
            }

            Object subviewHolder;

            if (groupView.Views.Length == 1)
            {
                subviewHolder = CopyChildView(groupView, propertyNames, groupByValues, agentInstanceContext, groupView.Views[0]);
            }
            else
            {
                // For each child node
                var subViewList = new List <View>(4);
                subviewHolder = subViewList;
                foreach (var originalChildView in groupView.Views)
                {
                    var copyChildView = CopyChildView(groupView, propertyNames, groupByValues, agentInstanceContext, originalChildView);
                    subViewList.Add(copyChildView);
                }
            }

            return(subviewHolder);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="timeBatchViewFactory">for copying this view in a group-by</param>
        /// <param name="agentInstanceContext">The agent instance context.</param>
        /// <param name="timeDeltaComputation">computes the number of milliseconds to batch events for</param>
        /// <param name="referencePoint">is the reference point onto which to base intervals, or null ifthere is no such reference point supplied</param>
        /// <param name="forceOutput">is true if the batch should produce empty output if there is no value to output following time intervals</param>
        /// <param name="isStartEager">is true for start-eager</param>
        /// <param name="viewUpdatedCollection">is a collection that the view must Update when receiving events</param>
        public TimeBatchView(TimeBatchViewFactory timeBatchViewFactory,
                             AgentInstanceViewFactoryChainContext agentInstanceContext,
                             ExprTimePeriodEvalDeltaConst timeDeltaComputation,
                             long?referencePoint,
                             bool forceOutput,
                             bool isStartEager,
                             ViewUpdatedCollection viewUpdatedCollection)
        {
            _agentInstanceContext  = agentInstanceContext;
            _timeBatchViewFactory  = timeBatchViewFactory;
            _timeDeltaComputation  = timeDeltaComputation;
            _initialReferencePoint = referencePoint;
            _isStartEager          = isStartEager;
            _viewUpdatedCollection = viewUpdatedCollection;
            _isForceOutput         = forceOutput;

            _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();

            // schedule the first callback
            if (isStartEager)
            {
                if (_currentReferencePoint == null)
                {
                    _currentReferencePoint = agentInstanceContext.StatementContext.SchedulingService.Time;
                }
                ScheduleCallback();
                _isCallbackScheduled = true;
            }

            agentInstanceContext.AddTerminationCallback(Stop);
        }
Ejemplo n.º 18
0
 public UniqueByPropertyView(
     UniqueByPropertyViewFactory viewFactory,
     AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
 {
     _viewFactory = viewFactory;
     _agentInstanceContext = agentInstanceViewFactoryContext.AgentInstanceContext;
 }
Ejemplo n.º 19
0
 public View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
 {
     ViewUpdatedCollection randomAccess =
         agentInstanceViewFactoryContext.StatementContext.ViewServicePreviousFactory
             .GetOptPreviousExprRandomAccess(agentInstanceViewFactoryContext);
     return new KeepAllView(agentInstanceViewFactoryContext, this, randomAccess);
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="timeBatchViewFactory">for copying this view in a group-by</param>
        /// <param name="agentInstanceContext">The agent instance context.</param>
        /// <param name="timeDeltaComputation">The time delta computation.</param>
        public TimeAccumViewRStream(
            TimeAccumViewFactory timeBatchViewFactory,
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            ExprTimePeriodEvalDeltaConst timeDeltaComputation)
        {
            _agentInstanceContext = agentInstanceContext;
            _factory = timeBatchViewFactory;
            _timeDeltaComputation = timeDeltaComputation;

            _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();

            ScheduleHandleCallback callback = new ProxyScheduleHandleCallback
            {
                ProcScheduledTrigger = extensionServicesContext =>
                {
                    using (Instrument.With(
                               i => i.QViewScheduledEval(this, _factory.ViewName),
                               i => i.AViewScheduledEval()))
                    {
                        SendRemoveStream();
                    }
                }
            };

            _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback);
            agentInstanceContext.AddTerminationCallback(Stop);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="agentInstanceContext">The agent instance context.</param>
        /// <param name="timeWindowViewFactory">for copying the view in a group-by</param>
        /// <param name="timeDeltaComputation">is the computation of number of milliseconds before events gets pushedout of the timeWindow as oldData in the Update method.</param>
        /// <param name="viewUpdatedCollection">is a collection the view must Update when receiving events</param>
        public TimeWindowView(
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            TimeWindowViewFactory timeWindowViewFactory,
            ExprTimePeriodEvalDeltaConst timeDeltaComputation,
            ViewUpdatedCollection viewUpdatedCollection)
        {
            _agentInstanceContext  = agentInstanceContext;
            _timeWindowViewFactory = timeWindowViewFactory;
            _timeDeltaComputation  = timeDeltaComputation;
            _viewUpdatedCollection = viewUpdatedCollection;
            _scheduleSlot          = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();
            _timeWindow            = new TimeWindow(agentInstanceContext.IsRemoveStream);

            ScheduleHandleCallback callback = new ProxyScheduleHandleCallback
            {
                ProcScheduledTrigger = extensionServicesContext => Instrument.With(
                    i => i.QViewScheduledEval(this, timeWindowViewFactory.ViewName),
                    i => i.AViewScheduledEval(),
                    Expire)
            };

            _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback);

            if (agentInstanceContext.StatementContext.ScheduleAdjustmentService != null)
            {
                agentInstanceContext.StatementContext.ScheduleAdjustmentService.AddCallback(this);
            }
            agentInstanceContext.AddTerminationCallback(Stop);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="rankWindowViewFactory">for copying this view in a group-by</param>
        /// <param name="uniqueCriteriaExpressions">The unique criteria expressions.</param>
        /// <param name="uniqueCriteriaEvaluators">The unique criteria evaluators.</param>
        /// <param name="sortCriteriaExpressions">is the event property names to sort</param>
        /// <param name="sortCriteriaEvaluators">The sort criteria evaluators.</param>
        /// <param name="descendingValues">indicates whether to sort ascending or descending for each field</param>
        /// <param name="sortWindowSize">is the window size</param>
        /// <param name="optionalRankedRandomAccess">is the friend class handling the random access, if required byexpressions</param>
        /// <param name="isSortUsingCollator">for string value sorting using compare or Collator</param>
        /// <param name="agentInstanceViewFactoryContext">The agent instance view factory context.</param>
        public RankWindowView(RankWindowViewFactory rankWindowViewFactory,
                              ExprNode[] uniqueCriteriaExpressions,
                              ExprEvaluator[] uniqueCriteriaEvaluators,
                              ExprNode[] sortCriteriaExpressions,
                              ExprEvaluator[] sortCriteriaEvaluators,
                              bool[] descendingValues,
                              int sortWindowSize,
                              IStreamSortRankRandomAccess optionalRankedRandomAccess,
                              bool isSortUsingCollator,
                              AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
        {
            _rankWindowViewFactory           = rankWindowViewFactory;
            _uniqueCriteriaExpressions       = uniqueCriteriaExpressions;
            _uniqueCriteriaEvaluators        = uniqueCriteriaEvaluators;
            _sortCriteriaExpressions         = sortCriteriaExpressions;
            _sortCriteriaEvaluators          = sortCriteriaEvaluators;
            _isDescendingValues              = descendingValues;
            _sortWindowSize                  = sortWindowSize;
            _optionalRankedRandomAccess      = optionalRankedRandomAccess;
            _agentInstanceViewFactoryContext = agentInstanceViewFactoryContext;

            _comparator        = CollectionUtil.GetComparator(sortCriteriaEvaluators, isSortUsingCollator, _isDescendingValues);
            _sortedEvents      = new OrderedDictionary <object, object>(_comparator);
            _uniqueKeySortKeys = new Dictionary <Object, Object>();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="agentInstanceContext">The agent instance context.</param>
        /// <param name="viewFactory">for copying this view in a group-by</param>
        /// <param name="timestampExpr">the property name of the event supplying timestamp values</param>
        /// <param name="timestampEvaluator">The timestamp evaluator.</param>
        /// <param name="timeDeltaComputation">The time delta computation.</param>
        /// <param name="optionalSortedRandomAccess">is the friend class handling the random access, if required byexpressions</param>
        public TimeOrderView(
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            ViewFactory viewFactory,
            ExprNode timestampExpr,
            ExprEvaluator timestampEvaluator,
            ExprTimePeriodEvalDeltaConst timeDeltaComputation,
            IStreamSortRankRandomAccess optionalSortedRandomAccess)
        {
            _agentInstanceContext       = agentInstanceContext;
            _viewFactory                = viewFactory;
            _timestampExpression        = timestampExpr;
            _timestampEvaluator         = timestampEvaluator;
            _timeDeltaComputation       = timeDeltaComputation;
            _optionalSortedRandomAccess = optionalSortedRandomAccess;
            _scheduleSlot               = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();

            _sortedEvents = new OrderedDictionary <Object, Object>();

            ScheduleHandleCallback callback = new ProxyScheduleHandleCallback
            {
                ProcScheduledTrigger = extensionServicesContext => Instrument.With(
                    i => i.QViewScheduledEval(this, _viewFactory.ViewName),
                    i => i.AViewScheduledEval(),
                    Expire)
            };

            _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback);
            agentInstanceContext.AddTerminationCallback(Stop);
        }
Ejemplo n.º 24
0
 public ExpressionBatchView(
     ExpressionBatchViewFactory factory,
     ViewUpdatedCollection viewUpdatedCollection,
     ObjectArrayEventBean builtinEventProps,
     AgentInstanceViewFactoryChainContext agentInstanceContext)
     : base(factory, viewUpdatedCollection, builtinEventProps, agentInstanceContext)
 {
 }
Ejemplo n.º 25
0
        public View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
        {
            if (IsReclaimAged) {
                return new GroupByViewReclaimAged(this, agentInstanceViewFactoryContext);
            }

            return new GroupByViewImpl(this, agentInstanceViewFactoryContext);
        }
Ejemplo n.º 26
0
 public View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
 {
     int size = ViewFactoryUtil.EvaluateSizeParam(
         ViewName,
         this.size,
         agentInstanceViewFactoryContext.AgentInstanceContext);
     return new FirstLengthWindowView(agentInstanceViewFactoryContext, this, size);
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="propertyNames">is the name of the field that is added to any events received by this view.</param>
 /// <param name="mergeValues">is the values of the field that is added to any events received by this view.</param>
 /// <param name="mergedResultEventType">is the event type that the merge view reports to it's child views</param>
 /// <param name="agentInstanceContext">contains required view services</param>
 public AddPropertyValueOptionalView(AgentInstanceViewFactoryChainContext agentInstanceContext, string[] propertyNames, object mergeValues, EventType mergedResultEventType)
 {
     _propertyNames        = propertyNames;
     _propertyValues       = mergeValues;
     _eventType            = mergedResultEventType;
     _agentInstanceContext = agentInstanceContext;
     _newToOldEventMap     = new Dictionary <EventBean, EventBean>();
 }
Ejemplo n.º 28
0
 public View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext)
 {
     if (IsReclaimAged)
     {
         return(new GroupByViewReclaimAged(agentInstanceViewFactoryContext, _criteriaExpressions, ExprNodeUtility.GetEvaluators(_criteriaExpressions), _reclaimMaxAge, _reclaimFrequency));
     }
     return(new GroupByViewImpl(agentInstanceViewFactoryContext, _criteriaExpressions, ExprNodeUtility.GetEvaluators(_criteriaExpressions)));
 }
Ejemplo n.º 29
0
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="groupByGroupByViewFactory">view factory</param>
 /// <param name="agentInstanceContext">contains required view services</param>
 public GroupByViewImpl(
     GroupByViewFactory groupByGroupByViewFactory,
     AgentInstanceViewFactoryChainContext agentInstanceContext)
 {
     _groupByViewFactory = groupByGroupByViewFactory;
     this.agentInstanceContext = agentInstanceContext;
     MergeView = new MergeView(this, groupByGroupByViewFactory.EventType);
 }
Ejemplo n.º 30
0
        protected ExpressionViewBase(
            ViewUpdatedCollection viewUpdatedCollection,
            ExprEvaluator expiryExpression,
            AggregationServiceFactoryDesc aggregationServiceFactoryDesc,
            ObjectArrayEventBean builtinEventProps,
            ISet <String> variableNames,
            AgentInstanceViewFactoryChainContext agentInstanceContext)
        {
            ViewUpdatedCollection = viewUpdatedCollection;
            ExpiryExpression      = expiryExpression;
            BuiltinEventProps     = builtinEventProps;
            EventsPerStream       = new EventBean[] { null, builtinEventProps };
            VariableNames         = variableNames;
            AgentInstanceContext  = agentInstanceContext;

            if (variableNames != null && !variableNames.IsEmpty())
            {
                foreach (String variable in variableNames)
                {
                    var variableName    = variable;
                    var agentInstanceId = agentInstanceContext.AgentInstanceId;
                    var variableService = agentInstanceContext.StatementContext.VariableService;

                    agentInstanceContext.StatementContext.VariableService.RegisterCallback(variable, agentInstanceId, Update);
                    agentInstanceContext.AddTerminationCallback(
                        new ProxyStopCallback(() => variableService.UnregisterCallback(variableName, agentInstanceId, Update)));
                }

                ScheduleHandleCallback callback = new ProxyScheduleHandleCallback
                {
                    ProcScheduledTrigger = extensionServicesContext => Instrument.With(
                        i => i.QViewScheduledEval(this, ViewName),
                        i => i.AViewScheduledEval(),
                        ScheduleCallback)
                };
                ScheduleSlot   = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();
                ScheduleHandle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback);
                agentInstanceContext.AddTerminationCallback(this);
            }
            else
            {
                ScheduleSlot   = -1;
                ScheduleHandle = null;
            }

            if (aggregationServiceFactoryDesc != null)
            {
                AggregationService = aggregationServiceFactoryDesc.AggregationServiceFactory.MakeService(
                    agentInstanceContext.AgentInstanceContext,
                    agentInstanceContext.AgentInstanceContext.StatementContext.EngineImportService, false, null);
                AggregateNodes = aggregationServiceFactoryDesc.Expressions;
            }
            else
            {
                AggregationService = null;
                AggregateNodes     = Collections.GetEmptyList <AggregationServiceAggExpressionDesc>();
            }
        }