Пример #1
0
        /// <summary>
        /// Checks the internal validation of the item.
        /// </summary>
        /// <param name="configuration">The entire configuration.</param>
        /// <param name="parent">The parent item for the item being validated.</param>
        /// <param name="errorProcesser"></param>
        public virtual void Validate(IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
        {
            var isInitialised = false;

            try
            {
                Initialise();
                isInitialised = true;
            }
            catch (Exception error)
            {
                errorProcesser.ProcessError(error);
            }

            if (isInitialised)
            {
                foreach (IAuthentication user in this.loadedUsers.Values)
                {
                    var config = user as IConfigurationValidation;
                    if (config != null)
                    {
                        config.Validate(configuration, parent.Wrap(this), errorProcesser);
                    }
                }

                foreach (IPermission permission in this.loadedPermissions.Values)
                {
                    var config = permission as IConfigurationValidation;
                    if (config != null)
                    {
                        config.Validate(configuration, parent.Wrap(this), errorProcesser);
                    }
                }
            }
        }
        /// <summary>
        /// Checks the internal validation of the item.
        /// </summary>
        /// <param name="configuration">The entire configuration.</param>
        /// <param name="parent">The parent item for the item being validated.</param>
        /// <param name="errorProcesser"></param>
        public virtual void Validate(IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
        {
            foreach (IAuthentication user in users)
            {
                var dummy = user as IConfigurationValidation;
                if (dummy != null)
                {
                    dummy.Validate(configuration, parent.Wrap(this), errorProcesser);
                }
            }

            foreach (IPermission permission in permissions)
            {
                var dummy = permission as IConfigurationValidation;
                if (dummy != null)
                {
                    dummy.Validate(configuration, parent.Wrap(this), errorProcesser);
                }
            }
        }
 /// <summary>
 /// Validates this task.
 /// </summary>
 /// <param name="configuration">The entire configuration.</param>
 /// <param name="parent">The parent item for the item being validated.</param>
 /// <param name="errorProcesser">The error processer to use.</param>
 public virtual void Validate(IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
 {
     // Validate all the child tasks
     if (Tasks != null)
     {
         foreach (var task in Tasks)
         {
             var validatorTask = task as IConfigurationValidation;
             if (validatorTask != null)
             {
                 validatorTask.Validate(configuration, parent.Wrap(this), errorProcesser);
             }
         }
     }
 }
 /// <summary>
 /// Validates this task.
 /// </summary>
 /// <param name="configuration">The entire configuration.</param>
 /// <param name="parent">The parent item for the item being validated.</param>
 /// <param name="errorProcesser">The error processer to use.</param>
 public virtual void Validate(IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
 {
     // Validate all the child tasks
     if (Tasks != null)
     {
         foreach (var task in Tasks)
         {
             var validatorTask = task as IConfigurationValidation;
             if (validatorTask != null)
             {
                 validatorTask.Validate(configuration, parent.Wrap(this), errorProcesser);
             }
         }
     }
 }
Пример #5
0
 /// <summary>
 /// Checks the internal validation of the item.
 /// </summary>
 /// <param name="configuration">The entire configuration.</param>
 /// <param name="parent">The parent item for the item being validated.</param>
 /// <param name="errorProcesser">The error processer to use.</param>
 public void Validate(IConfiguration configuration,
                      ConfigurationTrace parent,
                      IConfigurationErrorProcesser errorProcesser)
 {
     if ((this.Conditions == null) || (this.Conditions.Length == 0))
     {
         errorProcesser
         .ProcessError("Validation failed for andCondition - at least one child condition must be supplied");
     }
     else
     {
         foreach (var child in this.Conditions.OfType <IConfigurationValidation>())
         {
             child.Validate(
                 configuration,
                 parent.Wrap(this),
                 errorProcesser);
         }
     }
 }
        /// <summary>
        /// Validates this task.
        /// </summary>
        /// <param name="configuration">The entire configuration.</param>
        /// <param name="parent">The parent item for the item being validated.</param>
        /// <param name="errorProcesser">The error processer to use.</param>
        public virtual void Validate(IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
        {
            // Validate the conditions
            var trace = parent.Wrap(this);

            foreach (var condition in this.TaskConditions ?? new ITaskCondition[0])
            {
                var validation = condition as IConfigurationValidation;
                if (validation != null)
                {
                    validation.Validate(
                        configuration,
                        trace,
                        errorProcesser);
                }
            }

            // Validate the tasks
            this.ValidateTasks(this.Tasks, configuration, trace, errorProcesser);
            this.ValidateTasks(this.ElseTasks, configuration, trace, errorProcesser);
        }
 /// <summary>
 /// Checks the internal validation of the item.
 /// </summary>
 /// <param name="configuration">The entire configuration.</param>
 /// <param name="parent">The parent item for the item being validated.</param>
 /// <param name="errorProcesser">The error processer to use.</param>
 public void Validate(IConfiguration configuration,
     ConfigurationTrace parent,
     IConfigurationErrorProcesser errorProcesser)
 {
     if ((this.Conditions == null) || (this.Conditions.Length == 0))
     {
         errorProcesser
             .ProcessError("Validation failed for andCondition - at least one child condition must be supplied");
     }
     else
     {
         foreach (var child in this.Conditions.OfType<IConfigurationValidation>())
         {
             child.Validate(
                 configuration,
                 parent.Wrap(this),
                 errorProcesser);
         }
     }
 }
 /// <summary>
 /// Checks the internal validation of the item.
 /// </summary>
 /// <param name="configuration">The entire configuration.</param>
 /// <param name="parent">The parent item for the item being validated.</param>
 /// <param name="errorProcesser"></param>
 public virtual void Validate(IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
 {
     foreach (IPermission permission in permissions)
     {
         var dummy = permission as IConfigurationValidation;
         if (dummy != null)
         {
             dummy.Validate(configuration, parent.Wrap(this), errorProcesser);
         }
     }
 }
Пример #9
0
        /// <summary>
        /// Validates the configuration of an item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="errorProcesser">The error processer.</param>
        private void ValidateItem(object item, IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
        {
            if (item == null) return;

            var dummy = item as IConfigurationValidation;
            if (dummy != null)
            {
                dummy.Validate(configuration, parent.Wrap(this), errorProcesser);
            }
        }
        /// <summary>
        /// Checks the internal validation of the item.
        /// </summary>
        /// <param name="configuration">The entire configuration.</param>
        /// <param name="parent">The parent item for the item being validated.</param>
        /// <param name="errorProcesser"></param>
        public virtual void Validate(IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
        {
            foreach (IAuthentication user in users)
            {
                if (user is IConfigurationValidation)
                {
                    (user as IConfigurationValidation).Validate(configuration, parent.Wrap(this), errorProcesser);
                }
            }

            foreach (IPermission permission in permissions)
            {
                if (permission is IConfigurationValidation)
                {
                    (permission as IConfigurationValidation).Validate(configuration, parent.Wrap(this), errorProcesser);
                }
            }
        }
        /// <summary>
        /// Validates this task.
        /// </summary>
        /// <param name="configuration">The entire configuration.</param>
        /// <param name="parent">The parent item for the item being validated.</param>
        /// <param name="errorProcesser">The error processer to use.</param>
        public virtual void Validate(IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
        {
            // Validate the conditions
            var trace = parent.Wrap(this);
            foreach (var condition in this.TaskConditions ?? new ITaskCondition[0])
            {
                var validation = condition as IConfigurationValidation;
                if (validation != null)
                {
                    validation.Validate(
                        configuration,
                        trace,
                        errorProcesser);
                }
            }

            // Validate the tasks
            this.ValidateTasks(this.Tasks, configuration, trace, errorProcesser);
            this.ValidateTasks(this.ElseTasks, configuration, trace, errorProcesser);
        }
        /// <summary>
        /// Checks the internal validation of the item.
        /// </summary>
        /// <param name="configuration">The entire configuration.</param>
        /// <param name="parent">The parent item for the item being validated.</param>
        /// <param name="errorProcesser"></param>
        public virtual void Validate(IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
        {
            var isInitialised = false;
            try
            {
                Initialise();
                isInitialised = true;
            }
            catch (Exception error)
            {
                errorProcesser.ProcessError(error);
            }

            if (isInitialised)
            {
                foreach (IAuthentication user in this.loadedUsers.Values)
                {
                    if (user is IConfigurationValidation)
                    {
                        (user as IConfigurationValidation).Validate(configuration, parent.Wrap(this), errorProcesser);
                    }
                }

                foreach (IPermission permission in this.loadedPermissions.Values)
                {
                    if (permission is IConfigurationValidation)
                    {
                        (permission as IConfigurationValidation).Validate(configuration, parent.Wrap(this), errorProcesser);
                    }
                }
            }
        }
Пример #13
0
 /// <summary>
 /// Validates the configuration of an item.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="configuration"></param>
 /// <param name="errorProcesser"></param>
 private void ValidateItem(object item, IConfiguration configuration, ConfigurationTrace parent, IConfigurationErrorProcesser errorProcesser)
 {
     if ((item != null) && (item is IConfigurationValidation))
     {
         (item as IConfigurationValidation).Validate(configuration, parent.Wrap(this), errorProcesser);
     }
 }