Example #1
0
        public static ContextControllerConditionNonHA GetEndpoint(
            IntSeqKey conditionPath,
            object[] partitionKeys,
            ContextConditionDescriptor endpoint,
            ContextControllerConditionCallback callback,
            ContextController controller,
            bool isStartEndpoint)
        {
            if (endpoint is ContextConditionDescriptorFilter) {
                ContextConditionDescriptorFilter filter = (ContextConditionDescriptorFilter) endpoint;
                return new ContextControllerConditionFilter(conditionPath, partitionKeys, filter, callback, controller);
            }

            if (endpoint is ContextConditionDescriptorTimePeriod) {
                ContextConditionDescriptorTimePeriod timePeriod = (ContextConditionDescriptorTimePeriod) endpoint;
                long scheduleSlot = controller.Realization.AgentInstanceContextCreate.ScheduleBucket.AllocateSlot();
                return new ContextControllerConditionTimePeriod(
                    scheduleSlot,
                    timePeriod,
                    conditionPath,
                    callback,
                    controller);
            }

            if (endpoint is ContextConditionDescriptorCrontab) {
                ContextConditionDescriptorCrontab crontab = (ContextConditionDescriptorCrontab) endpoint;
                ScheduleSpec schedule = ScheduleExpressionUtil.CrontabScheduleBuild(
                    crontab.Evaluators,
                    controller.Realization.AgentInstanceContextCreate);
                long scheduleSlot = controller.Realization.AgentInstanceContextCreate.ScheduleBucket.AllocateSlot();
                return new ContextControllerConditionCrontabImpl(
                    conditionPath,
                    scheduleSlot,
                    schedule,
                    crontab,
                    callback,
                    controller);
            }

            if (endpoint is ContextConditionDescriptorPattern) {
                ContextConditionDescriptorPattern pattern = (ContextConditionDescriptorPattern) endpoint;
                return new ContextControllerConditionPattern(
                    conditionPath,
                    partitionKeys,
                    pattern,
                    callback,
                    controller);
            }

            if (endpoint is ContextConditionDescriptorNever) {
                return ContextControllerConditionNever.INSTANCE;
            }

            if (endpoint is ContextConditionDescriptorImmediate) {
                return ContextControllerConditionImmediate.INSTANCE;
            }

            throw new IllegalStateException("Unrecognized context range endpoint " + endpoint.GetType());
        }
Example #2
0
 public ContextControllerConditionFilter(
     IntSeqKey conditionPath,
     object[] partitionKeys,
     ContextConditionDescriptorFilter filter,
     ContextControllerConditionCallback callback,
     ContextController controller)
 {
     this.conditionPath = conditionPath;
     this.partitionKeys = partitionKeys;
     this.filter = filter;
     this.callback = callback;
     this.controller = controller;
 }