Example #1
0
 internal LiveInfo(YodiiEngine engine)
 {
     Debug.Assert(engine != null);
     _engine   = engine;
     _plugins  = new CKObservableSortedArrayKeyList <LivePluginInfo, string>(l => l.PluginInfo.PluginFullName);
     _services = new CKObservableSortedArrayKeyList <LiveServiceInfo, string>(l => l.ServiceInfo.ServiceFullName);
 }
Example #2
0
 ConfigurationSolver(YodiiEngine engine, bool revertServices = false, bool revertPlugins = false)
 {
     _engine              = engine;
     _services            = new Dictionary <string, ServiceData>();
     _serviceFamilies     = new List <ServiceData.ServiceFamily>();
     _plugins             = new Dictionary <string, PluginData>();
     _deferedPropagation  = new HashSet <ServiceData>();
     _revertServicesOrder = revertServices;
     _revertPluginsOrder  = revertPlugins;
 }
Example #3
0
        /// <summary>
        /// Static only success resolution constructor.
        /// </summary>
        public YodiiEngineResult(IConfigurationSolver solver, YodiiEngine engine)
        {
            Debug.Assert(solver != null);
            Debug.Assert(engine != null);

            var allP = solver.AllPlugins.Select(p => new SolvedPluginSnapshot(p)).ToDictionary(p => p.PluginInfo);
            var allS = solver.AllServices.Select(s => new SolvedServiceSnapshot(s)).ToDictionary(s => s.ServiceInfo.ServiceFullName);

            _staticOnlyResultConfiguration = new StaticSolvedConfiguration(allP.Values.ToReadOnlyList(), allS.Values.ToReadOnlyList());
            _pluginCulprits  = CKReadOnlyListEmpty <IPluginInfo> .Empty;
            _serviceCulprits = CKReadOnlyListEmpty <IServiceInfo> .Empty;
            _engine          = engine;
        }
Example #4
0
        protected LiveYodiiItemInfo(YodiiEngine engine, IYodiiItemData d, string fullName)
        {
            Debug.Assert(d != null && engine != null && !String.IsNullOrEmpty(fullName));

            _engine     = engine;
            _capability = new LiveRunCapability(d.FinalConfigSolvedStatus, d.FinalStartableStatus);
            _fullName   = fullName;
            Debug.Assert(d.DynamicStatus != null);
            _disabledReason       = d.DisabledReason;
            _runningStatus        = d.DynamicStatus.Value;
            _configOriginalStatus = d.ConfigOriginalStatus;
            _configSolvedStatus   = d.ConfigSolvedStatus;
            _configOriginalImpact = d.ConfigOriginalImpact;
            _configSolvedImpact   = d.RawConfigSolvedImpact;
        }
Example #5
0
 internal LivePluginInfo(PluginData p, YodiiEngine engine)
     : base(engine, p, p.PluginInfo.PluginFullName)
 {
     _pluginInfo = p.PluginInfo;
 }
Example #6
0
 internal ConfigurationManager(YodiiEngine engine)
 {
     Engine = engine;
     _configurationLayerCollection = new ConfigurationLayerCollection(this);
     _finalConfiguration           = new FinalConfiguration();
 }
Example #7
0
        /// <summary>
        /// Configuration failure constructor.
        /// </summary>
        internal YodiiEngineResult(IConfigurationFailureResult configurationFailureResult, YodiiEngine engine)
        {
            Debug.Assert(configurationFailureResult.FailureReasons != null && configurationFailureResult.FailureReasons.Count > 0);

            _engine = engine;
            _configurationFailureResult = configurationFailureResult;
        }
Example #8
0
        /// <summary>
        /// Dynamic failure constructor.
        /// </summary>
        internal YodiiEngineResult(IConfigurationSolver solver, IEnumerable <Tuple <IPluginInfo, Exception> > errorInfo, YodiiEngine engine)
        {
            Debug.Assert(solver != null);
            Debug.Assert(errorInfo != null && errorInfo.Any());
            Debug.Assert(engine != null);

            var allP = solver.AllPlugins.Select(p => new SolvedPluginSnapshot(p)).ToDictionary(ps => ps.PluginInfo);
            var allS = solver.AllServices.Select(s => new SolvedServiceSnapshot(s)).ToReadOnlyList();

            var errors = errorInfo.Select(e => new PluginRuntimeError(allP[e.Item1], e.Item2)).ToReadOnlyList();

            _pluginCulprits  = errors.Select(e => e.Plugin.PluginInfo).ToReadOnlyList();
            _serviceCulprits = _pluginCulprits.Select(p => p.Service).Where(s => s != null).ToReadOnlyList();
            _engine          = engine;

            _hostFailureResult = new DynamicFailureResult(new DynamicSolvedConfiguration(allP.Values.ToReadOnlyList(), allS), errors);
        }
Example #9
0
        /// <summary>
        /// Static failure resolution constructor.
        /// </summary>
        public YodiiEngineResult(IConfigurationSolver solver, List <PluginData> blockingPlugins, List <ServiceData> blockingServices, YodiiEngine engine)
        {
            Debug.Assert(blockingPlugins != null || blockingServices != null, "At least one must not be null.");
            Debug.Assert(solver != null);
            Debug.Assert(engine != null);

            var allP = solver.AllPlugins.Select(p => new SolvedPluginSnapshot(p)).ToDictionary(p => p.PluginInfo);
            var allS = solver.AllServices.Select(s => new SolvedServiceSnapshot(s)).ToDictionary(s => s.ServiceInfo.ServiceFullName);

            _staticOnlyResultConfiguration = new StaticSolvedConfiguration(allP.Values.ToReadOnlyList(), allS.Values.ToReadOnlyList());

            var blkP = blockingPlugins == null
                            ? CKReadOnlyListEmpty <IStaticSolvedPlugin> .Empty
                            : blockingPlugins.Select(p => allP[p.PluginInfo]).ToReadOnlyList();

            _pluginCulprits = blkP.Select(ps => ps.PluginInfo).ToReadOnlyList();

            var blkS = blockingServices == null
                            ? CKReadOnlyListEmpty <IStaticSolvedService> .Empty
                            : blockingServices.Select(s => allS[s.ServiceInfo.ServiceFullName]).ToReadOnlyList();

            _serviceCulprits = blkS.Select(ss => ss.ServiceInfo).ToReadOnlyList();

            _engine = engine;
            _staticFailureResult = new StaticFailureResult(_staticOnlyResultConfiguration, blkP, blkS);
        }
Example #10
0
 public SuccessYodiiEngineResult(YodiiEngine engine)
 {
     _engine = engine;
 }
Example #11
0
        internal static Tuple <IYodiiEngineStaticOnlyResult, ConfigurationSolver> CreateAndApplyStaticResolution(YodiiEngine engine, FinalConfiguration finalConfiguration, IDiscoveredInfo discoveredInfo, bool revertServices, bool revertPlugins, bool createStaticSolvedConfigOnSuccess)
        {
            ConfigurationSolver          temporarySolver = new ConfigurationSolver(engine, revertServices, revertPlugins);
            IYodiiEngineStaticOnlyResult result          = temporarySolver.StaticResolution(finalConfiguration, discoveredInfo, createStaticSolvedConfigOnSuccess);

            // StaticResolution returns null on success.
            // If there is a result, it is either an error or createStaticSolvedConfigOnSuccess is true and this is a StaticResolutionOnly: in both
            // case we do not need to keep the temporary solver.
            if (result != null)
            {
                temporarySolver = null;
            }
            return(Tuple.Create(result, temporarySolver));
        }
Example #12
0
 internal LiveServiceInfo(ServiceData s, YodiiEngine engine)
     : base(engine, s, s.ServiceInfo.ServiceFullName)
 {
     _serviceInfo = s.ServiceInfo;
 }