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 void MatchFound(
            ContextControllerDetailHashItem item,
            EventBean theEvent,
            IntSeqKey controllerPath)
        {
            int value = item.Lookupable.Getter.Get(theEvent).AsInt32();

            if (hashSvc.HashHasSeenPartition(controllerPath, value)) {
                return;
            }

            object[] parentPartitionKeys = hashSvc.MgmtGetParentPartitionKeys(controllerPath);
            ContextPartitionInstantiationResult result = realization.ContextPartitionInstantiate(
                controllerPath,
                value,
                this,
                theEvent,
                null,
                parentPartitionKeys,
                value);
            int subpathIdOrCPId = result.SubpathOrCPId;
            hashSvc.HashAddPartition(controllerPath, value, subpathIdOrCPId);

            // update the filter version for this handle
            long filterVersion = realization.AgentInstanceContextCreate.FilterService.FiltersVersion;
            realization.AgentInstanceContextCreate.EpStatementAgentInstanceHandle.StatementFilterVersion
                .StmtFilterVersion = filterVersion;
        }
        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;
        }