コード例 #1
0
        public void Deactivate()
        {
            if (filterHandle == null) {
                return;
            }

            AgentInstanceContext agentInstanceContext = controller.Realization.AgentInstanceContextCreate;
            FilterValueSetParam[][] addendum = ContextManagerUtil.ComputeAddendumNonStmt(
                partitionKeys,
                filter.FilterSpecActivatable,
                controller.Realization);
            FilterValueSetParam[][] filterValueSet = filter.FilterSpecActivatable.GetValueSet(
                null,
                addendum,
                agentInstanceContext,
                agentInstanceContext.StatementContextFilterEvalEnv);
            agentInstanceContext.FilterService.Remove(
                filterHandle,
                filter.FilterSpecActivatable.FilterForEventType,
                filterValueSet);
            filterHandle = null;
            long filtersVersion = agentInstanceContext.StatementContext.FilterService.FiltersVersion;
            agentInstanceContext.EpStatementAgentInstanceHandle.StatementFilterVersion.StmtFilterVersion =
                filtersVersion;
        }
コード例 #2
0
        public ContextControllerHashFilterEntry(
            ContextControllerHashImpl callback,
            IntSeqKey controllerPath,
            ContextControllerDetailHashItem item,
            object[] parentPartitionKeys)
        {
            this.callback = callback;
            this.controllerPath = controllerPath;
            this.item = item;

            AgentInstanceContext agentInstanceContext = callback.AgentInstanceContextCreate;
            this.filterHandle = new EPStatementHandleCallbackFilter(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                this);
            FilterValueSetParam[][] addendum = ContextManagerUtil.ComputeAddendumNonStmt(
                parentPartitionKeys,
                item.FilterSpecActivatable,
                callback.Realization);
            this.filterValueSet = item.FilterSpecActivatable.GetValueSet(
                null,
                addendum,
                agentInstanceContext,
                agentInstanceContext.StatementContextFilterEvalEnv);
            agentInstanceContext.FilterService.Add(
                item.FilterSpecActivatable.FilterForEventType,
                filterValueSet,
                filterHandle);
            long filtersVersion = agentInstanceContext.FilterService.FiltersVersion;
            agentInstanceContext.EpStatementAgentInstanceHandle.StatementFilterVersion.StmtFilterVersion =
                filtersVersion;
        }
コード例 #3
0
 private FilterValueSetParam[][] ComputeFilterValues(AgentInstanceContext agentInstanceContext)
 {
     var addendum = ContextManagerUtil.ComputeAddendumNonStmt(
         partitionKeys,
         filter.FilterSpecActivatable,
         controller.Realization);
     return filter.FilterSpecActivatable.GetValueSet(
         null,
         addendum,
         agentInstanceContext,
         agentInstanceContext.StatementContextFilterEvalEnv);
 }
コード例 #4
0
        public bool Activate(
            EventBean optionalTriggeringEvent,
            ContextControllerEndConditionMatchEventProvider endConditionMatchEventProvider)
        {
            AgentInstanceContext agentInstanceContext = controller.Realization.AgentInstanceContextCreate;

            FilterHandleCallback filterCallback = new ProxyFilterHandleCallback() {
                ProcMatchFound = (
                    theEvent,
                    allStmtMatches) => FilterMatchFound(theEvent),
                ProcIsSubselect = () => false,
            };

            FilterValueSetParam[][] addendum = ContextManagerUtil.ComputeAddendumNonStmt(
                partitionKeys,
                filter.FilterSpecActivatable,
                controller.Realization);
            filterHandle = new EPStatementHandleCallbackFilter(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                filterCallback);
            FilterValueSetParam[][] filterValueSet = filter.FilterSpecActivatable.GetValueSet(
                null,
                addendum,
                agentInstanceContext,
                agentInstanceContext.StatementContextFilterEvalEnv);
            agentInstanceContext.FilterService.Add(
                filter.FilterSpecActivatable.FilterForEventType,
                filterValueSet,
                filterHandle);
            long filtersVersion = agentInstanceContext.FilterService.FiltersVersion;
            agentInstanceContext.EpStatementAgentInstanceHandle.StatementFilterVersion.StmtFilterVersion =
                filtersVersion;

            bool match = false;
            if (optionalTriggeringEvent != null) {
                match = AgentInstanceUtil.EvaluateFilterForStatement(
                    optionalTriggeringEvent,
                    agentInstanceContext,
                    filterHandle);
            }

            return match;
        }
コード例 #5
0
        public bool Activate(
            EventBean optionalTriggeringEvent,
            ContextControllerEndConditionMatchEventProvider endConditionMatchEventProvider,
            IDictionary<string, object> optionalTriggeringPattern)
        {
            patternStopCallback?.Stop();

            var agentInstanceContext = controller.Realization.AgentInstanceContextCreate;
            Func<FilterSpecActivatable, FilterValueSetParam[][]> contextAddendumFunction = filter =>
                ContextManagerUtil.ComputeAddendumNonStmt(partitionKeys, filter, controller.Realization);
            var patternAgentInstanceContext = new PatternAgentInstanceContext(
                pattern.PatternContext,
                agentInstanceContext,
                false,
                contextAddendumFunction);
            var rootNode = EvalNodeUtil.MakeRootNodeFromFactory(pattern.Pattern, patternAgentInstanceContext);

            var matchedEventMap = new MatchedEventMapImpl(pattern.PatternContext.MatchedEventMapMeta);
            if (optionalTriggeringEvent != null) {
                endConditionMatchEventProvider?.PopulateEndConditionFromTrigger(
                    matchedEventMap,
                    optionalTriggeringEvent);
            }

            if (optionalTriggeringPattern != null) {
                endConditionMatchEventProvider?.PopulateEndConditionFromTrigger(matchedEventMap, optionalTriggeringPattern);
            }
            
            // capture any callbacks that may occur right after start
            var callback = new ConditionPatternMatchCallback(this);
            patternStopCallback = rootNode.Start(callback, pattern.PatternContext, matchedEventMap, false);
            callback.forwardCalls = true;

            if (callback.IsInvoked) {
                MatchFound(Collections.GetEmptyMap<string, object>(), optionalTriggeringEvent);
            }

            return false;
        }
コード例 #6
0
        protected void Start(FilterSpecActivatable activatable)
        {
            if (filterHandle != null) {
                throw new IllegalStateException("Already started");
            }

            var agentInstanceContext = callback.AgentInstanceContextCreate;
            filterHandle = new EPStatementHandleCallbackFilter(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                this);
            var addendum = ContextManagerUtil.ComputeAddendumNonStmt(
                parentPartitionKeys,
                activatable,
                callback.Realization);
            filterValueSet = activatable.GetValueSet(
                null,
                addendum,
                agentInstanceContext,
                agentInstanceContext.StatementContextFilterEvalEnv);
            agentInstanceContext.FilterService.Add(activatable.FilterForEventType, filterValueSet, filterHandle);
            var filtersVersion = agentInstanceContext.FilterService.FiltersVersion;
            agentInstanceContext.EpStatementAgentInstanceHandle.StatementFilterVersion.StmtFilterVersion =
                filtersVersion;
        }