Пример #1
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="maxAgeSec">is the maximum age in seconds</param>
        /// <param name="purgeIntervalSec">is the purge interval in seconds</param>
        /// <param name="cacheReferenceType">indicates whether hard, soft or weak references are used in the cache</param>
        /// <param name="schedulingService">is a service for call backs at a scheduled time, for purging</param>
        /// <param name="scheduleSlot">slot for scheduling callbacks for this cache</param>
        /// <param name="epStatementAgentInstanceHandle">is the statements-own handle for use in registering callbacks with services</param>
        /// <param name="timeAbacus">time abacus</param>
        public DataCacheExpiringImpl(
            double maxAgeSec,
            double purgeIntervalSec,
            ConfigurationCacheReferenceType cacheReferenceType,
            SchedulingService schedulingService,
            long scheduleSlot,
            EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
            TimeAbacus timeAbacus)
        {
            _maxAgeSec         = maxAgeSec;
            _purgeIntervalSec  = purgeIntervalSec;
            _schedulingService = schedulingService;
            _scheduleSlot      = scheduleSlot;
            _timeAbacus        = timeAbacus;

            if (cacheReferenceType == ConfigurationCacheReferenceType.HARD)
            {
                _cache = new Dictionary <Object, Item>();
            }
            else if (cacheReferenceType == ConfigurationCacheReferenceType.SOFT)
            {
                _cache = new ReferenceMap <Object, Item>(ReferenceType.SOFT, ReferenceType.SOFT);
            }
            else
            {
                _cache = new WeakDictionary <Object, Item>();
            }

            _epStatementAgentInstanceHandle = epStatementAgentInstanceHandle;
        }
Пример #2
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="timeZone">The time zone.</param>
 /// <param name="hasYear">if set to <c>true</c> [has year].</param>
 /// <param name="hasMonth">if set to <c>true</c> [has month].</param>
 /// <param name="hasWeek">if set to <c>true</c> [has week].</param>
 /// <param name="hasDay">true if the expression has that part, false if not</param>
 /// <param name="hasHour">true if the expression has that part, false if not</param>
 /// <param name="hasMinute">true if the expression has that part, false if not</param>
 /// <param name="hasSecond">true if the expression has that part, false if not</param>
 /// <param name="hasMillisecond">true if the expression has that part, false if not</param>
 /// <param name="hasMicrosecond">if set to <c>true</c> [has microsecond].</param>
 /// <param name="timeAbacus">The time abacus.</param>
 public ExprTimePeriodImpl(
     TimeZoneInfo timeZone,
     bool hasYear,
     bool hasMonth,
     bool hasWeek,
     bool hasDay,
     bool hasHour,
     bool hasMinute,
     bool hasSecond,
     bool hasMillisecond,
     bool hasMicrosecond,
     TimeAbacus timeAbacus)
 {
     _timeZone       = timeZone;
     _hasYear        = hasYear;
     _hasMonth       = hasMonth;
     _hasWeek        = hasWeek;
     _hasDay         = hasDay;
     _hasHour        = hasHour;
     _hasMinute      = hasMinute;
     _hasSecond      = hasSecond;
     _hasMillisecond = hasMillisecond;
     _hasMicrosecond = hasMicrosecond;
     _timeAbacus     = timeAbacus;
 }
Пример #3
0
 public ReformatGetFieldForge(
     DateTimeFieldEnum fieldNum,
     TimeAbacus timeAbacus)
 {
     this._fieldNum = fieldNum;
     this._timeAbacus = timeAbacus;
 }
Пример #4
0
 public EngineImportServiceImpl(
     bool allowExtendedAggregationFunc,
     bool isUdfCache,
     bool isDuckType,
     bool sortUsingCollator,
     MathContext optionalDefaultMathContext,
     TimeZoneInfo timeZone,
     TimeAbacus timeAbacus,
     ConfigurationEngineDefaults.ThreadingProfile threadingProfile,
     IDictionary <string, Object> transientConfiguration,
     AggregationFactoryFactory aggregationFactoryFactory)
 {
     _imports                      = new List <AutoImportDesc>();
     _annotationImports            = new List <AutoImportDesc>(2);
     _aggregationFunctions         = new Dictionary <string, ConfigurationPlugInAggregationFunction>();
     _aggregationAccess            = new List <Pair <ISet <string>, ConfigurationPlugInAggregationMultiFunction> >();
     _singleRowFunctions           = new Dictionary <string, EngineImportSingleRowDesc>();
     _methodInvocationRef          = new Dictionary <string, ConfigurationMethodRef>();
     _allowExtendedAggregationFunc = allowExtendedAggregationFunc;
     _isUdfCache                   = isUdfCache;
     _isDuckType                   = isDuckType;
     _sortUsingCollator            = sortUsingCollator;
     _optionalDefaultMathContext   = optionalDefaultMathContext;
     _timeZone                     = timeZone;
     _timeAbacus                   = timeAbacus;
     _threadingProfile             = threadingProfile;
     _transientConfiguration       = transientConfiguration;
     _aggregationFactoryFactory    = aggregationFactoryFactory;
 }
 public IntervalDeltaExprTimePeriodNonConstForge(
     ExprTimePeriod timePeriod,
     TimeAbacus timeAbacus)
 {
     this.timePeriod = timePeriod;
     this.timeAbacus = timeAbacus;
 }
 public AggregationServiceGroupByForge(
     AggGroupByDesc aggGroupByDesc,
     TimeAbacus timeAbacus)
 {
     this.aggGroupByDesc = aggGroupByDesc;
     this.timeAbacus = timeAbacus;
 }
Пример #7
0
        private long AddSubtract(
            long currentTime,
            int factor,
            EventBean[] eventsPerStream,
            bool newData,
            ExprEvaluatorContext context)
        {
            var dtx = DateTimeEx.GetInstance(TimeZone);
            var remainder = TimeAbacus.DateTimeSet(currentTime, dtx);

            var usec = 0;
            for (var i = 0; i < Adders.Length; i++) {
                var value = Evaluators[i].Evaluate(eventsPerStream, newData, context).AsInt32();
                if (i == IndexMicroseconds) {
                    usec = value;
                }
                else {
                    Adders[i].Add(dtx, factor * value);
                }
            }

            var result = TimeAbacus.DateTimeGet(dtx, remainder);
            if (IndexMicroseconds != -1) {
                result += factor * usec;
            }

            return result - currentTime;
        }
Пример #8
0
        public ImportServiceRuntime(
            IContainer container,
            IDictionary<string, object> transientConfiguration,
            TimeAbacus timeAbacus,
            ISet<string> eventTypeAutoNames,
            TimeZoneInfo timeZone,
            IDictionary<string, ConfigurationCommonMethodRef> methodInvocationRef,
            IList<Import> imports,
            IList<Import> annotationImports)
            : base(container, transientConfiguration, timeAbacus, eventTypeAutoNames)
        {
            TimeZone = timeZone;
            this.methodInvocationRef = methodInvocationRef;

            try {
                foreach (var import in imports) {
                    AddImport(import);
                }

                foreach (var import in annotationImports) {
                    AddAnnotationImport(import);
                }
            }
            catch (ImportException ex) {
                throw new ConfigurationException("Failed to process imports: " + ex.Message, ex);
            }
        }
 public TimePeriodComputeNCGivenExprForge(
     ExprForge secondsEvaluator,
     TimeAbacus timeAbacus)
 {
     _secondsEvaluator = secondsEvaluator;
     _timeAbacus = timeAbacus;
 }
Пример #10
0
 public DTLocalDtxOpsLongForge(
     IList<CalendarForge> calendarForges,
     TimeAbacus timeAbacus)
     : base(calendarForges)
 {
     this.timeAbacus = timeAbacus;
 }
        public void SetGuardParameters(
            IList<ExprNode> parameters,
            MatchedEventConvertorForge convertor,
            StatementCompileTimeServices services)
        {
            var message = "Timer-within-or-max-count guard requires two parameters: " +
                          "numeric or time period parameter and an integer-value expression parameter";

            if (parameters.Count != 2) {
                throw new GuardParameterException(message);
            }

            if (!parameters[0].Forge.EvaluationType.IsNumeric()) {
                throw new GuardParameterException(message);
            }

            var paramOneType = parameters[1].Forge.EvaluationType;
            if (paramOneType != typeof(int) && paramOneType != typeof(int)) {
                throw new GuardParameterException(message);
            }

            timeExpr = parameters[0];
            numCountToExpr = parameters[1];
            this.convertor = convertor;
            timeAbacus = services.ImportServiceCompileTime.TimeAbacus;
        }
Пример #12
0
        public ExprDotEvalDT(
            IList <CalendarOp> calendarOps,
            TimeZoneInfo timeZone,
            TimeAbacus timeAbacus,
            ReformatOp reformatOp,
            IntervalOp intervalOp,
            Type inputType,
            EventType inputEventType)
        {
            this._evaluator = GetEvaluator(
                calendarOps, timeZone, timeAbacus, inputType, inputEventType, reformatOp, intervalOp);

            if (intervalOp != null)
            {
                _returnType = EPTypeHelper.SingleValue(typeof(bool?));
            }
            else if (reformatOp != null)
            {
                _returnType = EPTypeHelper.SingleValue(reformatOp.ReturnType);
            }
            else
            {
                // only calendar ops
                if (inputEventType != null)
                {
                    _returnType = EPTypeHelper.SingleValue(
                        inputEventType.GetPropertyType(inputEventType.StartTimestampPropertyName));
                }
                else
                {
                    _returnType = EPTypeHelper.SingleValue(inputType);
                }
            }
        }
Пример #13
0
        /// <summary>
        /// Computes the next lowest date in milliseconds based on a specification and the
        /// from-time passed in.
        /// </summary>
        /// <param name="spec">defines the schedule</param>
        /// <param name="afterTimeInMillis">defines the start time</param>
        /// <param name="timeZone">The time zone.</param>
        /// <param name="timeAbacus">The time abacus.</param>
        /// <returns>
        /// a long date tick value for the next schedule occurance matching the spec
        /// </returns>

        public static long ComputeNextOccurance(
            ScheduleSpec spec,
            long afterTimeInMillis,
            TimeZoneInfo timeZone,
            TimeAbacus timeAbacus)
        {
            if (ExecutionPathDebugLog.IsEnabled && Log.IsDebugEnabled)
            {
                Log.Debug(
                    ".computeNextOccurance Computing next occurance," +
                    "  afterTimeInTicks=" + afterTimeInMillis.TimeFromMillis(timeZone) +
                    "  as long=" + afterTimeInMillis +
                    "  spec=" + spec);
            }

            // Add the minimum resolution to the Start time to ensure we don't get the same exact time
            if (spec.UnitValues.ContainsKey(ScheduleUnit.SECONDS))
            {
                afterTimeInMillis += timeAbacus.GetOneSecond();
            }
            else
            {
                afterTimeInMillis += 60 * timeAbacus.GetOneSecond();
            }

            return(Compute(spec, afterTimeInMillis, timeZone, timeAbacus));
        }
Пример #14
0
        public ExprDotDTForge(
            IList<CalendarForge> calendarForges,
            TimeAbacus timeAbacus,
            ReformatForge reformatForge,
            IntervalForge intervalForge,
            Type inputType,
            EventType inputEventType)
        {
            if (intervalForge != null) {
                TypeInfo = EPTypeHelper.SingleValue(typeof(bool?));
            }
            else if (reformatForge != null) {
                TypeInfo = EPTypeHelper.SingleValue(reformatForge.ReturnType);
            }
            else { // only calendar op
                if (inputEventType != null) {
                    TypeInfo = EPTypeHelper.SingleValue(
                        inputEventType.GetPropertyType(inputEventType.StartTimestampPropertyName));
                }
                else {
                    TypeInfo = EPTypeHelper.SingleValue(inputType);
                }
            }

            forge = GetForge(calendarForges, timeAbacus, inputType, inputEventType, reformatForge, intervalForge);
        }
Пример #15
0
 public ReformatEvalForge(
     DateTimeExEval dateTimeExEval,
     TimeAbacus timeAbacus)
 {
     this._dateTimeExEval = dateTimeExEval;
     this._timeAbacus = timeAbacus;
 }
Пример #16
0
 public AggregationForgeFactoryRate(ExprRateAggNode parent, bool isEver, long intervalTime, TimeAbacus timeAbacus)
 {
     this.parent       = parent;
     this.isEver       = isEver;
     this.intervalTime = intervalTime;
     this.timeAbacus   = timeAbacus;
 }
 public TimePeriodComputeNCGivenExprEval(
     ExprEvaluator secondsEvaluator,
     TimeAbacus timeAbacus)
 {
     this.secondsEvaluator = secondsEvaluator;
     this.timeAbacus = timeAbacus;
 }
Пример #18
0
        private static long GetTime(
            ScheduleCalendar result,
            int year,
            string optionalTimeZone,
            TimeZoneInfo timeZone,
            TimeAbacus timeAbacus,
            long remainder)
        {
            // Here again we have a case of 1-based vs. 0-based indexing.
            //      Java months are 0-based.
            //      CLR  months are 1-based.

            if (optionalTimeZone != null)
            {
                try
                {
                    timeZone = TimeZoneHelper.GetTimeZoneInfo(optionalTimeZone);
                }
                catch (TimeZoneNotFoundException)
                {
                    // this behavior ensures we are consistent with Java, but IMO, it's bad behavior...
                    // basically, if the timezone is not found, we default to UTC.
                    timeZone = TimeZoneInfo.Utc;
                }
            }

            if (timeZone == null)
            {
                timeZone = TimeZoneInfo.Local;
            }

            var baseDateTime = new DateTime(
                year,
                result.Month,
                result.DayOfMonth,
                result.Hour,
                result.Minute,
                result.Second,
                result.Milliseconds,
                new GregorianCalendar()
                );

            var baseDateTimeOffset = timeZone.GetUtcOffset(baseDateTime);

            var dateTime = new DateTimeOffset(
                year,
                result.Month,
                result.DayOfMonth,
                result.Hour,
                result.Minute,
                result.Second,
                result.Milliseconds,
                new GregorianCalendar(),
                baseDateTimeOffset);

            var dateTimeEx = new DateTimeEx(dateTime, timeZone);

            return(timeAbacus.CalendarGet(dateTimeEx, remainder));
        }
Пример #19
0
 public DTLocalLongOpsReformatForge(
     IList<CalendarForge> calendarForges,
     ReformatForge reformatForge,
     TimeAbacus timeAbacus)
     : base(calendarForges, reformatForge)
 {
     this.timeAbacus = timeAbacus;
 }
Пример #20
0
 /// <summary>
 /// Computes the next lowest date in milliseconds based on a specification and the
 /// from-time passed in and returns the delta from the current time.
 /// </summary>
 /// <param name="spec">The schedule.</param>
 /// <param name="afterTimeInMillis">defines the start time.</param>
 /// <param name="timeZone">The time zone.</param>
 /// <param name="timeAbacus">The time abacus.</param>
 /// <returns>
 /// a long millisecond value representing the delta between current time and the next schedule occurance matching the spec
 /// </returns>
 public static long ComputeDeltaNextOccurance(
     ScheduleSpec spec,
     long afterTimeInMillis,
     TimeZoneInfo timeZone,
     TimeAbacus timeAbacus)
 {
     return(ComputeNextOccurance(spec, afterTimeInMillis, timeZone, timeAbacus) - afterTimeInMillis);
 }
Пример #21
0
 public DTLocalDtxOpsLongEval(
     IList<CalendarOp> calendarOps,
     TimeZoneInfo timeZone,
     TimeAbacus timeAbacus)
     : base(calendarOps)
 {
     this.timeZone = timeZone;
     this.timeAbacus = timeAbacus;
 }
Пример #22
0
 public AggregationMethodFactoryRate(ExprRateAggNode parent, bool isEver, long intervalTime,
     TimeProvider timeProvider, TimeAbacus timeAbacus)
 {
     _parent = parent;
     _isEver = isEver;
     _intervalTime = intervalTime;
     _timeProvider = timeProvider;
     _timeAbacus = timeAbacus;
 }
Пример #23
0
 public ReformatOpEval(
     Func <DateTimeEx, TValue> dtxEval,
     TimeZoneInfo timeZone,
     TimeAbacus timeAbacus)
 {
     _dtxEval    = dtxEval;
     _timeZone   = timeZone;
     _timeAbacus = timeAbacus;
 }
 public TimePeriodComputeNCGivenTPNonCalEval(
     ExprEvaluator[] evaluators,
     TimePeriodAdder[] adders,
     TimeAbacus timeAbacus)
 {
     Evaluators = evaluators;
     Adders = adders;
     TimeAbacus = timeAbacus;
 }
Пример #25
0
 public ReformatFormatForge(
     ReformatFormatForgeDesc formatterType,
     ExprForge formatter,
     TimeAbacus timeAbacus)
 {
     this._formatterType = formatterType;
     this._formatter = formatter;
     this._timeAbacus = timeAbacus;
 }
Пример #26
0
 public static ExprTimePeriod TimePeriodGetExprJustSeconds(
     EsperEPL2GrammarParser.ExpressionContext expression,
     IDictionary<ITree, ExprNode> astExprNodeMap,
     TimeAbacus timeAbacus)
 {
     ExprNode node = ExprCollectSubNodes(expression, 0, astExprNodeMap)[0];
     ExprTimePeriod timeNode = new ExprTimePeriodImpl(false, false, false, false, false, false, true, false, false, timeAbacus);
     timeNode.AddChildNode(node);
     return timeNode;
 }
Пример #27
0
 public DTLocalLongOpsIntervalForge(
     IList<CalendarForge> calendarForges,
     IntervalForge intervalForge,
     TimeAbacus timeAbacus)
     : base(
         calendarForges,
         intervalForge)
 {
     this.timeAbacus = timeAbacus;
 }
Пример #28
0
 public DTLocalLongOpsIntervalEval(
     IList<CalendarOp> calendarOps,
     IntervalOp intervalOp,
     TimeZoneInfo timeZone,
     TimeAbacus timeAbacus)
     : base(calendarOps, intervalOp)
 {
     this.timeZone = timeZone;
     this.timeAbacus = timeAbacus;
 }
Пример #29
0
 public AggregationMethodFactory MakeRate(
     StatementExtensionSvcContext statementExtensionSvcContext,
     ExprRateAggNode exprRateAggNode,
     bool isEver,
     long intervalTime,
     TimeProvider timeProvider,
     TimeAbacus timeAbacus)
 {
     return(new AggregationMethodFactoryRate(exprRateAggNode, isEver, intervalTime, timeProvider, timeAbacus));
 }
Пример #30
0
 internal DTLocalEvaluatorLongOpsInterval(
     IList <CalendarOp> calendarOps,
     IntervalOp intervalOp,
     TimeZoneInfo timeZone,
     TimeAbacus timeAbacus)
     : base(calendarOps, intervalOp)
 {
     _timeZone   = timeZone;
     _timeAbacus = timeAbacus;
 }