Exemplo n.º 1
0
        internal IYodiiEngineResult OnConfigurationItemChanging(ConfigurationItem item, FinalConfigurationItem data)
        {
            Debug.Assert(item != null && _finalConfiguration != null && _configurationLayerCollection.Count != 0);
            if (_currentEventArgs != null)
            {
                throw new InvalidOperationException("Another change is in progress");
            }

            Dictionary <string, FinalConfigurationItem> final = new Dictionary <string, FinalConfigurationItem>();

            final.Add(item.ServiceOrPluginFullName, data);

            ConfigurationFailureResult internalResult = FillFromConfiguration("Item changing", final, c => c != item);

            if (!internalResult.Success)
            {
                return(new YodiiEngineResult(internalResult, Engine));
            }

            if (item.Status != data.Status)
            {
                return(OnConfigurationChanging(final, finalConf => new ConfigurationChangingEventArgs(finalConf, FinalConfigurationChange.StatusChanged, item)));
            }
            return(OnConfigurationChanging(final, finalConf => new ConfigurationChangingEventArgs(finalConf, FinalConfigurationChange.ImpactChanged, item)));
        }
Exemplo n.º 2
0
        internal IYodiiEngineResult OnConfigurationLayerRemoving(ConfigurationLayer layer)
        {
            Dictionary <string, FinalConfigurationItem> final = new Dictionary <string, FinalConfigurationItem>();

            ConfigurationFailureResult internalResult = FillFromConfiguration(null, final, c => c.Layer != layer);

            Debug.Assert(internalResult.Success, "Removing a configuration layer can not lead to an impossibility.");

            return(OnConfigurationChanging(final, finalConf => new ConfigurationChangingEventArgs(finalConf, FinalConfigurationChange.LayerRemoved, layer)));
        }
Exemplo n.º 3
0
        internal IYodiiEngineResult OnConfigurationItemAdding(ConfigurationItem newItem)
        {
            Dictionary <string, FinalConfigurationItem> final = new Dictionary <string, FinalConfigurationItem>();

            final.Add(newItem.ServiceOrPluginFullName, new FinalConfigurationItem(newItem.ServiceOrPluginFullName, newItem.Status, newItem.Impact));

            ConfigurationFailureResult internalResult = FillFromConfiguration("Adding configuration item", final);

            if (!internalResult.Success)
            {
                return(new YodiiEngineResult(internalResult, Engine));
            }

            return(OnConfigurationChanging(final, finalConf => new ConfigurationChangingEventArgs(finalConf, FinalConfigurationChange.ItemAdded, newItem)));
        }