Exemplo n.º 1
0
        public override void Activate(
            IntSeqKey path,
            object[] parentPartitionKeys,
            EventBean optionalTriggeringEvent,
            IDictionary<string, object> optionalTriggeringPattern)
        {
            hashSvc.MgmtCreate(path, parentPartitionKeys);

            if (factory.HashSpec.IsPreallocate) {
                int[] subpathOrCPIds = ActivateByPreallocate(path, parentPartitionKeys, optionalTriggeringEvent);
                hashSvc.MgmtSetSubpathOrCPIdsWhenPreallocate(path, subpathOrCPIds);
                return;
            }

            ContextControllerDetailHashItem[] hashItems = factory.HashSpec.Items;
            ContextControllerFilterEntry[] filterEntries = new ContextControllerFilterEntry[hashItems.Length];

            for (int i = 0; i < hashItems.Length; i++) {
                ContextControllerDetailHashItem item = hashItems[i];
                filterEntries[i] = new ContextControllerHashFilterEntry(this, path, item, parentPartitionKeys);

                if (optionalTriggeringEvent != null) {
                    bool match = AgentInstanceUtil.EvaluateFilterForStatement(
                        optionalTriggeringEvent,
                        realization.AgentInstanceContextCreate,
                        filterEntries[i].FilterHandle);

                    if (match) {
                        MatchFound(item, optionalTriggeringEvent, path);
                    }
                }
            }

            hashSvc.MgmtSetFilters(path, filterEntries);
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
        private ContextControllerFilterEntry ActivateFilterNoInit(
            ContextControllerDetailKeyedItem item,
            EventBean optionalTriggeringEvent,
            IntSeqKey controllerPath,
            object[] parentPartitionKeys)
        {
            var callback = new ContextControllerKeyedFilterEntryNoInit(this, controllerPath, parentPartitionKeys, item);
            if (optionalTriggeringEvent != null) {
                var match = AgentInstanceUtil.EvaluateFilterForStatement(
                    optionalTriggeringEvent,
                    realization.AgentInstanceContextCreate,
                    callback.FilterHandle);

                if (match) {
                    callback.MatchFound(optionalTriggeringEvent, null);
                }
            }

            return callback;
        }
Exemplo n.º 4
0
        public bool Activate(
            EventBean optionalTriggeringEvent,
            ContextControllerEndConditionMatchEventProvider endConditionMatchEventProvider,
            IDictionary<string, object> optionalTriggeringPattern)
        {
            var agentInstanceContext = controller.Realization.AgentInstanceContextCreate;

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

            filterHandle = new EPStatementHandleCallbackFilter(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                filterCallback);
            var filterValueSet = ComputeFilterValues(agentInstanceContext);
            if (filterValueSet != null) {
                agentInstanceContext.FilterService.Add(
                    filter.FilterSpecActivatable.FilterForEventType,
                    filterValueSet,
                    filterHandle);
                var filtersVersion = agentInstanceContext.FilterService.FiltersVersion;
                agentInstanceContext.EpStatementAgentInstanceHandle.StatementFilterVersion.StmtFilterVersion = filtersVersion;
            }

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

            return match;
        }