상속: VMLogBaseElement, ILogServiceConfig
예제 #1
0
        internal VMLogMethodConfig( VMLogServiceConfig holder, string name, string returnType, List<ILogParameterInfo> parameters, bool isBound )
            : base(name, isBound)
        {
            _holder = holder;
            Config = _holder.Config;

            _returnType = returnType;
            _parameters = parameters;
            _parametersEx = new CKReadOnlyListOnIList<ILogParameterInfo>( _parameters );

            _dataPath = _holder.Name + "-" + FullSignature;
            _doLogDataPath = _dataPath + "-MethodDoLog";
            _logOptionsDataPath = _dataPath + "-MethodLogOptions";
        }
예제 #2
0
        public VMLogEventConfig( VMLogServiceConfig holder, string name, List<ILogParameterInfo> parameters, ServiceLogEventOptions logOptions, bool isBound )
            : base(name, isBound)
        {
            _holder = holder;
            Config = _holder.Config;

            _dataPath = _holder.Name + "-" + Name;
            _doLogDataPath = _dataPath + "-EventDoLog";
            _logOptionsDataPath = _dataPath + "-EventLogOptions";

            _parameters = parameters;
            _parametersEx = new CKReadOnlyListOnIList<ILogParameterInfo>( _parameters );

            _doLogErrors = ( ( logOptions & ServiceLogEventOptions.LogErrors ) == ServiceLogEventOptions.LogErrors );
            _doLogStartRaise = ( ( logOptions & ServiceLogEventOptions.StartRaise ) == ServiceLogEventOptions.StartRaise );
            _doLogParameters = ( ( logOptions & ServiceLogEventOptions.LogParameters ) == ServiceLogEventOptions.LogParameters );
            _doLogEndRaise = ( ( logOptions & ServiceLogEventOptions.EndRaise ) == ServiceLogEventOptions.EndRaise );
            _doCatchEventWhenServiceStopped = ( ( logOptions & ServiceLogEventOptions.SilentEventRunningStatusError ) == ServiceLogEventOptions.SilentEventRunningStatusError );
            _doLogCaughtEventWhenServiceStopped = ( ( logOptions & ServiceLogEventOptions.LogSilentEventRunningStatusError ) == ServiceLogEventOptions.LogSilentEventRunningStatusError );
            _doCatchBadEventHandling = ( ( logOptions & ServiceLogEventOptions.SilentEventError ) == ServiceLogEventOptions.SilentEventError );
        }
예제 #3
0
 public VMLogEventConfig( VMLogServiceConfig holder, string name, ServiceLogEventOptions logOptions, bool isBound )
     : this(holder, name, new List<ILogParameterInfo>(), logOptions, isBound)
 {
 }
예제 #4
0
 public static VMLogEventConfig CreateFrom( VMLogServiceConfig holder, ILogEventConfig e )
 {
     VMLogEventConfig result = new VMLogEventConfig( holder, e.Name, e.LogOptions, false );
     result._doLog = e.DoLog;
     foreach( ILogParameterInfo p in e.Parameters )
         result._parameters.Add( new LogParameterInfo( p.ParameterName, p.ParameterType ) );
     return result;
 }
예제 #5
0
        public static VMLogEventConfig CreateFrom( VMLogServiceConfig holder, ISimpleEventInfo e )
        {
            VMLogEventConfig result = new VMLogEventConfig( holder, e.Name, 0, true );
            result._holder = holder;

            //foreach( ISimpleParameterInfo p in e.Parameters )
            //{
            //    result._parameters.Add( new LogParameterInfo( p.ParameterName, p.ParameterType ) );
            //}

            //If there is no config, we set the default one.
            result.DoLog = result.Config.User.GetOrSet( result._doLogDataPath, true );
            result.LogOptions = result.Config.User.GetOrSet( result._logOptionsDataPath, ServiceLogEventOptions.LogErrors );

            return result;
        }
예제 #6
0
 public VMLogMethodConfig( VMLogServiceConfig holder, string name, bool isBound )
     : this(holder, name, "", new List<ILogParameterInfo>(), isBound)
 {
 }
예제 #7
0
        public static VMLogMethodConfig CreateFrom( VMLogServiceConfig holder, ISimpleMethodInfo m )
        {
            VMLogMethodConfig result = new VMLogMethodConfig( holder, m.Name, true );

            result.ReturnType = m.ReturnType.ToString();
            foreach( ISimpleParameterInfo p in m.Parameters )
            {
                result.Parameters.Add( new LogParameterInfo( p.ParameterName, p.ParameterType ) );
            }

            result.LogOptions = result.Config.User.GetOrSet( result._logOptionsDataPath, ServiceLogMethodOptions.LogError );
            result.DoLog = result.Config.User.GetOrSet( result._doLogDataPath, true );

            return result;
        }
예제 #8
0
 public static VMLogMethodConfig CreateFrom( VMLogServiceConfig holder, ILogMethodConfig m )
 {
     VMLogMethodConfig result = new VMLogMethodConfig( holder, m.Name, false );
     result._doLog = m.DoLog;
     result.ReturnType = m.ReturnType.ToString();
     foreach( ILogParameterInfo p in m.Parameters )
         result.Parameters.Add( new LogParameterInfo( p.ParameterName, p.ParameterType ) );
     result.LogOptions = m.LogOptions;
     return result;
 }
예제 #9
0
 /// <summary>
 /// Called when a service wants its log configuration to be applied to the interceptor's configuration
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 internal void ServiceApply( VMLogServiceConfig service )
 {
     if( service != null )
     {
         _hostConfiguration.ApplyConfiguration( service );
         _pluginRunner.ServiceHost.ApplyConfiguration();
         service.IsDirty = false;
     }
 }
예제 #10
0
 /// <summary>
 /// Registers the config to the event from the vmLogServiceConfig it needs to listen to
 /// </summary>
 /// <param name="s"></param>
 internal void EventRegistration( VMLogServiceConfig s )
 {
     s.ServiceCancelModificationsAsked += new EventHandler( OnServiceCancelModificationsAsked );
     s.ServiceDeletionAsked += new EventHandler( OnServiceDeletionAsked );
     s.LogConfigChanged += new EventHandler<PropertyChangedEventArgs>( OnServiceLogConfigChanged );
     s.ServiceModificationAsked += new EventHandler( OnServiceModificationAsked );
 }
예제 #11
0
        /// <summary>
        /// Cancels modifications on a particular service
        /// if the service is bound or is not bound but can be found in the kernel's configuration, clears it and updates it from the kernel's configuration
        /// if the service is not bound, and can't be found in the kernel's configuration, removes it
        /// </summary>
        /// <param name="vmS"></param>
        internal void CancelModifications( VMLogServiceConfig vmS )
        {
            vmS.ClearConfig();

            if( vmS.IsBound )
            {

                foreach( ILogServiceConfig s in _hostConfiguration.LogConfig.Services )
                {
                    if( s.Name == vmS.Name )
                    {
                        vmS.UpdateFrom( s, false );// We update from the kernel, we don't track changes (and therefor set IsDirty to false)
                        break;
                    }
                }
            }
            else
            {
                bool hasBeenFound = false;
                foreach( ILogServiceConfig s in _hostConfiguration.LogConfig.Services )
                {
                    if( s.Name == vmS.Name )
                    {
                        vmS.UpdateFrom( s, false );// We update from the kernel, we don't track changes (and therefor set IsDirty to false)
                        _services.Add( vmS );
                        hasBeenFound = true;
                        break;
                    }
                }
                if( !hasBeenFound )
                    _services.Remove( vmS );
            }
        }
예제 #12
0
        public static VMLogServiceConfig CreateFrom( VMLogConfig holder, ILogServiceConfig s )
        {
            VMLogServiceConfig result = new VMLogServiceConfig( s.Name, false );

            result._holder = holder;
            result.Config = holder.Config;
            result._doLog = s.DoLog;

            foreach( ILogEventConfig e in s.Events )
            {
                VMLogEventConfig evVM = VMLogEventConfig.CreateFrom( result, e );
                evVM.LogConfigChanged += new EventHandler<PropertyChangedEventArgs>(
                    ( sndr, args ) =>
                    { result.IsDirty = true; }
                    );
                result.Events.Add( evVM );
            }

            foreach( ILogPropertyConfig p in s.Properties )
            {
                VMLogPropertyConfig propVM = VMLogPropertyConfig.CreateFrom( p );
                propVM.LogConfigChanged += new EventHandler<PropertyChangedEventArgs>(
                    ( sndr, args ) =>
                    { result.IsDirty = true; }
                    );
                result.Properties.Add( propVM );
            }

            foreach( ILogMethodConfig m in s.Methods )
            {
                VMLogMethodConfig mthdVM = VMLogMethodConfig.CreateFrom( result, m );
                mthdVM.LogConfigChanged += new EventHandler<PropertyChangedEventArgs>(
                ( sndr, args ) =>
                { result.IsDirty = true; }
                );
                result.Methods.Add( mthdVM );
            }

            return result;
        }
예제 #13
0
        public static VMLogServiceConfig CreateFrom( VMLogConfig holder, IServiceInfo s )
        {
            VMLogServiceConfig result = new VMLogServiceConfig( s.ServiceFullName, true );
            result._holder = holder;
            result.Config = result._holder.Config;

            result.DoLog = result.Config.User.GetOrSet( result._doLogDataPath, true );

            foreach( ISimpleEventInfo e in s.EventsInfoCollection )
            {
                VMLogEventConfig evVM = VMLogEventConfig.CreateFrom( result, e );
                evVM.LogConfigChanged += new EventHandler<PropertyChangedEventArgs>(
                    ( sndr, args ) =>
                    { result.IsDirty = true; } //When an event's conf is modified, the service conf is set to dirty
                );
                result.Events.Add( evVM );
            }

            foreach( ISimplePropertyInfo p in s.PropertiesInfoCollection )
            {
                VMLogPropertyConfig propVM = VMLogPropertyConfig.CreateFrom( p );
                propVM.LogConfigChanged += new EventHandler<PropertyChangedEventArgs>(
                    ( sndr, args ) =>
                    { result.IsDirty = true; }//When a property's conf is modified, the service conf is set to dirty
                    );
                result.Properties.Add( propVM );
            }

            foreach( ISimpleMethodInfo m in s.MethodsInfoCollection )
            {
                VMLogMethodConfig mthdVM = VMLogMethodConfig.CreateFrom( result, m );
                mthdVM.LogConfigChanged += new EventHandler<PropertyChangedEventArgs>(
                ( sndr, args ) =>
                { result.IsDirty = true; } //When a method's conf is modified, the service conf is set to dirty
                );
                result.Methods.Add( mthdVM );
            }

            return result;
        }