Exemple #1
0
 public ContextControllerKeyedImpl(
     ContextControllerKeyedFactory factory,
     ContextManagerRealization realization)
     : base(realization, factory)
 {
     keyedSvc = ContextControllerKeyedUtil.GetService(factory, realization);
 }
Exemple #2
0
        public override void ValidateGetContextProps(
            LinkedHashMap<string, object> props,
            string contextName,
            StatementRawInfo statementRawInfo,
            StatementCompileTimeServices services)
        {
            var propertyTypes = ContextControllerKeyedUtil.ValidateContextDesc(contextName, detail);

            for (var i = 0; i < detail.Items[0].PropertyNames.Count; i++) {
                var propertyName = ContextPropertyEventType.PROP_CTX_KEY_PREFIX + (i + 1);
                props.Put(propertyName, propertyTypes[i]);
            }

            var allTags = new LinkedHashSet<string>();
            foreach (var item in detail.Items) {
                if (item.AliasName != null) {
                    allTags.Add(item.AliasName);
                }
            }

            if (detail.OptionalInit != null) {
                foreach (var filter in detail.OptionalInit) {
                    ContextPropertyEventType.AddEndpointTypes(filter, props, allTags);
                }
            }
        }
Exemple #3
0
        private ContextControllerConditionNonHA ActivateTermination(
            EventBean triggeringEvent,
            object[] parentPartitionKeys,
            object partitionKey,
            IntSeqKey conditionPath,
            string optionalInitCondAsName)
        {
            ContextControllerConditionCallback callback = new ProxyContextControllerConditionCallback(
                (
                    conditionPathArg,
                    originEndpoint,
                    optionalTriggeringEvent,
                    optionalTriggeringPattern,
                    optionalTriggeringEventPattern,
                    optionalPatternForInclusiveEval) => {
                    var parentPath = conditionPathArg.RemoveFromEnd();
                    var getterKey = factory.GetGetterKey(partitionKey);
                    var removed = keyedSvc.KeyRemove(parentPath, getterKey);
                    if (removed == null) {
                        return;
                    }

                    // remember the terminating event, we don't want it to initiate a new partition
                    lastTerminatingEvent = optionalTriggeringEvent != null
                        ? optionalTriggeringEvent
                        : optionalTriggeringEventPattern;
                    realization.ContextPartitionTerminate(
                        conditionPathArg.RemoveFromEnd(),
                        removed.SubpathOrCPId,
                        this,
                        null,
                        false,
                        null);
                    removed.TerminationCondition.Deactivate();
                });

            var partitionKeys = CollectionUtil.AddValue(parentPartitionKeys, partitionKey);
            var terminationCondition = ContextControllerConditionFactory.GetEndpoint(
                conditionPath,
                partitionKeys,
                factory.keyedSpec.OptionalTermination,
                callback,
                this,
                false);

            ContextControllerEndConditionMatchEventProvider endConditionMatchEventProvider = null;
            if (optionalInitCondAsName != null) {
                endConditionMatchEventProvider = new ProxyContextControllerEndConditionMatchEventProvider {
                    ProcPopulateEndConditionFromTrigger = (
                        map,
                        triggeringEventArg) => {
                        ContextControllerKeyedUtil.PopulatePriorMatch(optionalInitCondAsName, map, triggeringEventArg);
                    }
                };
            }

            terminationCondition.Activate(triggeringEvent, endConditionMatchEventProvider);

            return terminationCondition;
        }
Exemple #4
0
        private ContextControllerFilterEntry[] ActivateFiltersFromInit(
            EventBean optionalTriggeringEvent,
            IntSeqKey controllerPath,
            object[] parentPartitionKeys)
        {
            var inits = factory.KeyedSpec.OptionalInit;
            var filterEntries = new ContextControllerFilterEntry[inits.Length];
            for (var i = 0; i < inits.Length; i++) {
                var init = inits[i];
                var found = ContextControllerKeyedUtil.FindInitMatchingKey(factory.KeyedSpec.Items, init);
                filterEntries[i] = ActivateFilterWithInit(
                    init,
                    found,
                    optionalTriggeringEvent,
                    controllerPath,
                    parentPartitionKeys);
            }

            return filterEntries;
        }