コード例 #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());
        }
コード例 #2
0
 public ContextControllerConditionPattern(
     IntSeqKey conditionPath,
     object[] partitionKeys,
     ContextConditionDescriptorPattern pattern,
     ContextControllerConditionCallback callback,
     ContextController controller)
 {
     this.conditionPath = conditionPath;
     this.partitionKeys = partitionKeys;
     this.pattern = pattern;
     this.callback = callback;
     this.controller = controller;
 }