コード例 #1
0
        public override void Update(EventBean[] newData, EventBean[] oldData)
        {
            if (_audit)
            {
                if (AuditPath.IsAuditEnabled)
                {
                    AuditPath.AuditLog(_exprEvaluatorContext.EngineURI, _exprEvaluatorContext.StatementName, AuditEnum.STREAM, _eventType.Name + " insert {" + EventBeanUtility.Summarize(newData) + "} remove {" + EventBeanUtility.Summarize(oldData) + "}");
                }
            }

            // if we have a filter for the named window,
            if (_filterList.Length != 0)
            {
                var eventPerStream = new EventBean[1];
                newData = PassFilter(newData, true, _exprEvaluatorContext, eventPerStream);
                oldData = PassFilter(oldData, false, _exprEvaluatorContext, eventPerStream);
            }

            if (_optPropertyEvaluator != null)
            {
                newData = GetUnpacked(newData);
                oldData = GetUnpacked(oldData);
            }

            if ((newData != null) || (oldData != null))
            {
                UpdateChildren(newData, oldData);
            }
        }
コード例 #2
0
        public override object Evaluate(EvaluateParams evaluateParams)
        {
            Object result = base.Evaluate(evaluateParams);

            if (AuditPath.IsInfoEnabled)
            {
                AuditPath.AuditLog(_engineURI, _statementName, AuditEnum.PROPERTY, _propertyName + " value " + result);
            }
            return(result);
        }
コード例 #3
0
 public void HandleAudit(Object targetObject, Object[] parameters)
 {
     if (Audit)
     {
         AuditPath.AuditLog(
             EngineURI, StatementName, AuditEnum.DATAFLOW_OP,
             "dataflow " + DataFlowName + " operator " + OperatorName + "(" + OperatorNumber + ") parameters " +
             parameters.Render());
     }
 }
コード例 #4
0
 private void SetState(EPDataFlowState newState)
 {
     if (_audit)
     {
         AuditPath.AuditLog(
             _engineUri, _statementName, AuditEnum.DATAFLOW_TRANSITION,
             "dataflow " + _dataFlowName + " instance " + _instanceId + " from state " + _state + " to state " +
             newState);
     }
     _state = newState;
 }
コード例 #5
0
ファイル: EvalAuditStateNode.cs プロジェクト: ikvm/nesper
        public void EvaluateFalse(EvalStateNode fromNode, bool restartable)
        {
            if (_evalAuditNode.FactoryNode.IsAuditPattern && AuditPath.IsInfoEnabled)
            {
                String message = ToStringEvaluateFalse(this, _evalAuditNode.FactoryNode.PatternExpr, fromNode);
                AuditPath.AuditLog(_evalAuditNode.Context.StatementContext.EngineURI, _evalAuditNode.Context.PatternContext.StatementName, AuditEnum.PATTERN, message);
            }

            _evalAuditNode.FactoryNode.DecreaseRefCount(this, _evalAuditNode.Context.PatternContext);
            ParentEvaluator.EvaluateFalse(this, restartable);
        }
コード例 #6
0
        public void Remove(ScheduleHandle handle, long scheduleSlot)
        {
            if (AuditPath.IsInfoEnabled)
            {
                StringWriter message = new StringWriter();
                message.Write("remove handle ");
                PrintHandle(message, handle);

                AuditPath.AuditLog(_engineUri, _statementName, AuditEnum.SCHEDULE, message.ToString());
            }
            _spi.Remove(handle, scheduleSlot);
        }
コード例 #7
0
ファイル: EvalAuditStateNode.cs プロジェクト: ikvm/nesper
        public void EvaluateTrue(MatchedEventMap matchEvent, EvalStateNode fromNode, bool isQuitted)
        {
            if (_evalAuditNode.FactoryNode.IsAuditPattern && AuditPath.IsInfoEnabled)
            {
                String message = ToStringEvaluateTrue(this, _evalAuditNode.FactoryNode.PatternExpr, matchEvent, fromNode, isQuitted);
                AuditPath.AuditLog(_evalAuditNode.Context.StatementContext.EngineURI, _evalAuditNode.Context.PatternContext.StatementName, AuditEnum.PATTERN, message);
            }

            ParentEvaluator.EvaluateTrue(matchEvent, this, isQuitted);

            if (isQuitted)
            {
                _evalAuditNode.FactoryNode.DecreaseRefCount(this, _evalAuditNode.Context.PatternContext);
            }
        }
コード例 #8
0
        /// <summary>
        /// Intercepts the specified invocation.
        /// </summary>
        /// <param name="invocation">The invocation.</param>
        public void Intercept(IInvocation invocation)
        {
            if (invocation.Method == Target)
            {
                if (AuditPath.IsAuditEnabled)
                {
                    var message = new StringWriter();
                    message.Write("trigger handle ");
                    TypeHelper.WriteInstance(message, _scheduleHandleCallback, true);
                    AuditPath.AuditLog(_engineURI, _statementName, AuditEnum.SCHEDULE, message.ToString());
                }
            }

            invocation.ReturnValue =
                invocation.Method.Invoke(_scheduleHandleCallback, invocation.Arguments);
        }
コード例 #9
0
        public void Add(long afterMSec, ScheduleHandle handle, long slot)
        {
            if (AuditPath.IsInfoEnabled)
            {
                StringWriter message = new StringWriter();
                message.Write("after ");
                message.Write(afterMSec);
                message.Write(" handle ");
                PrintHandle(message, handle);

                AuditPath.AuditLog(_engineUri, _statementName, AuditEnum.SCHEDULE, message.ToString());

                ModifyCreateProxy(handle);
            }
            _spi.Add(afterMSec, handle, slot);
        }
コード例 #10
0
ファイル: ViewProxy.cs プロジェクト: qianqian888/nesper
        /// <summary>
        /// Intercepts the specified invocation.
        /// </summary>
        /// <param name="invocation">The invocation.</param>
        public void Intercept(IInvocation invocation)
        {
            invocation.ReturnValue = invocation.Method.Invoke(_view, invocation.Arguments);

            if (invocation.Method == Target)
            {
                if (AuditPath.IsAuditEnabled)
                {
                    var newData = (EventBean[])invocation.Arguments[0];
                    var oldData = (EventBean[])invocation.Arguments[1];
                    AuditPath.AuditLog(
                        _engineURI, _statementName, AuditEnum.VIEW,
                        _viewName + " insert {" + EventBeanUtility.Summarize(newData) + "} remove {" + EventBeanUtility.Summarize(oldData) + "}");
                }
            }
        }
コード例 #11
0
ファイル: GraphSourceRunnable.cs プロジェクト: ikvm/nesper
        private void RunLoop()
        {
            while (true)
            {
                if (_audit)
                {
                    AuditPath.AuditLog(
                        _engineUri, _statementName, AuditEnum.DATAFLOW_SOURCE,
                        "dataflow " + _dataFlowName + " operator " + _operatorName + "(" + _operatorNumber +
                        ") invoking source.Next()");
                }
                _graphSource.Next();

                if (_shutdown)
                {
                    break;
                }
            }
        }
コード例 #12
0
        /// <summary>
        /// Intercepts the specified invocation.
        /// </summary>
        /// <param name="invocation">The invocation.</param>
        public void Intercept(IInvocation invocation)
        {
            if (invocation.Method.Name == "Insert")
            {
                if (AuditPath.IsInfoEnabled)
                {
                    var arg    = invocation.Arguments[0];
                    var events = "(undefined)";
                    if (arg is EventBean[])
                    {
                        events = EventBeanUtility.Summarize((EventBean[])arg);
                    }
                    else if (arg is EventBean)
                    {
                        events = EventBeanUtility.Summarize((EventBean)arg);
                    }
                    AuditPath.AuditLog(_engineURI, _statementName, AuditEnum.STREAM, _eventTypeAndFilter + " inserted " + events);
                }
            }

            invocation.ReturnValue = invocation.Method.Invoke(_eventStream, invocation.Arguments);
        }
コード例 #13
0
        private static void Print(EvalAuditStateNode current, String patternExpression, String engineURI, String statementName, bool added, int?count)
        {
            if (!AuditPath.IsAuditEnabled)
            {
                return;
            }

            var writer = new StringWriter();

            EvalAuditStateNode.WritePatternExpr(current, patternExpression, writer);

            if (added)
            {
                writer.Write(" increased to " + count);
            }
            else
            {
                writer.Write(" decreased to " + count);
            }

            AuditPath.AuditLog(engineURI, statementName, AuditEnum.PATTERNINSTANCES, writer.ToString());
        }
コード例 #14
0
        /// <summary>
        /// Intercepts the specified invocation.
        /// </summary>
        /// <param name="invocation">The invocation.</param>
        public void Intercept(IInvocation invocation)
        {
            var result = invocation.Method.Invoke(_evaluator, invocation.Arguments);

            invocation.ReturnValue = result;

            if (invocation.Method == TargetEvaluate)
            {
                if (AuditPath.IsAuditEnabled)
                {
                    AuditPath.AuditLog(_engineURI, _statementName, AuditEnum.EXPRESSION,
                                       "expression " + _expressionToString + " result " + result);
                }
            }
            else if (invocation.Method == TargetEvaluateCollEvents)
            {
                if (AuditPath.IsAuditEnabled)
                {
                    var resultBeans = (ICollection <EventBean>)result;
                    var @out        = "null";
                    if (resultBeans != null)
                    {
                        if (resultBeans.IsEmpty())
                        {
                            @out = "{}";
                        }
                        else
                        {
                            var buf   = new StringWriter();
                            var count = 0;
                            foreach (EventBean theEvent in resultBeans)
                            {
                                buf.Write(" Event ");
                                buf.Write(Convert.ToString(count++));
                                buf.Write(":");
                                EventBeanUtility.AppendEvent(buf, theEvent);
                            }
                            @out = buf.ToString();
                        }
                    }

                    AuditPath.AuditLog(_engineURI, _statementName, AuditEnum.EXPRESSION, "expression " + _expressionToString + " result " + @out);
                }
            }
            else if (invocation.Method == TargetEvaluateCollScalar)
            {
                if (AuditPath.IsAuditEnabled)
                {
                    AuditPath.AuditLog(_engineURI, _statementName, AuditEnum.EXPRESSION, "expression " + _expressionToString + " result " + result);
                }
            }
            else if (invocation.Method == TargetEvaluateBean)
            {
                if (AuditPath.IsAuditEnabled)
                {
                    var @out = "null";
                    if (result != null)
                    {
                        var buf = new StringWriter();
                        EventBeanUtility.AppendEvent(buf, (EventBean)result);
                        @out = buf.ToString();
                    }
                    AuditPath.AuditLog(_engineURI, _statementName, AuditEnum.EXPRESSION, "expression " + _expressionToString + " result " + @out);
                }
            }
        }