//--------------------------------------------------------------------- private void AddOverridesToXmlDocument( MPWorkflow mpWorkflow, XmlElement workflowElement, XmlDocument document ) { foreach (ManagementPackOverride mpOverride in mpWorkflow.Overrides) { XmlElement overrideElement = document.CreateElement("Override"); string parameter; string newValue; Common.RetrieveParameterInfo(mpOverride, out parameter, out newValue); overrideElement.SetAttribute("Parameter", parameter); overrideElement.SetAttribute("NewValue", newValue); overrideElement.SetAttribute("TimeAdded", mpOverride.TimeAdded.ToLocalTime().ToString()); overrideElement.SetAttribute("Context", Common.RetrieveContext(mpOverride, m_managementGroup)); overrideElement.SetAttribute("IsEnforced", mpOverride.Enforced.ToString()); overrideElement.SetAttribute("ManagementPack", mpOverride.GetManagementPack().Name); overrideElement.SetAttribute("IsSealed", Common.GetManagementPackSealedFlag(mpOverride.GetManagementPack())); workflowElement.AppendChild(overrideElement); } }
internal MPOverride( ManagementPackOverride mpOverride, MPWorkflow workflow, MPClass workflowTarget ) { m_override = mpOverride; m_workflow = workflow; m_workflowTarget = workflowTarget; }
//--------------------------------------------------------------------- internal OverrideMover( ManagementPack sourceMp, ManagementPack targetMp, ManagementPackOverride mpOverride, MPWorkflow mpWorkflow ) { m_mpOverride = mpOverride; m_sourceMp = sourceMp; m_targetMp = targetMp; m_mpWorkflow = mpWorkflow; }
//--------------------------------------------------------------------- private static List <MPOverride> GenerateEffectiveOverrrideList( PartialMonitoringObject monitoringObject, ReadOnlyCollection <ManagementPackMonitor> monitors, Dictionary <Guid, MonitoringClass> typeLookupTable ) { List <MPOverride> overrides = new List <MPOverride>(); foreach (ManagementPackMonitor monitor in monitors) { // if we do this check which I commented out, it only works for Windows computer, not for linux ones... // I am not sure why the check was done in the first place... what was it preventing from doing? // was it just an optimization to speed things up, or was it protecting the UI from dealing with some weird monitors? //if (!DoesMonitorHaveNonCategoryOverride(monitor)) //{ // continue; //} MonitorResultantOverrideSet overrideSet = monitoringObject.GetResultantOverrides(monitor); MPWorkflow workflow = new MPWorkflow(monitor); foreach (ResultantOverride <MonitorConfigurationOverride> monitorOverride in overrideSet.ResultantConfigurationOverrides.Values) { MonitoringClass target = typeLookupTable[monitor.Target.Id]; workflow.AddOverride(monitorOverride.EffectiveOverride); MPOverride mpOverride = new MPOverride(monitorOverride.EffectiveOverride, workflow, new MPClass(target)); overrides.Add(mpOverride); } foreach (ResultantOverride <ManagementPackOverride> monitorOverride in overrideSet.ResultantPropertyOverrides.Values) { MonitoringClass target = typeLookupTable[monitor.Target.Id]; workflow.AddOverride(monitorOverride.EffectiveOverride); MPOverride mpOverride = new MPOverride(monitorOverride.EffectiveOverride, workflow, new MPClass(target)); overrides.Add(mpOverride); } } return(overrides); }
//--------------------------------------------------------------------- private static List <MPOverride> GenerateEffectiveOverrrideList( PartialMonitoringObject monitoringObject, ReadOnlyCollection <MonitoringDiscovery> discoveries, Dictionary <Guid, MonitoringClass> typeLookupTable ) { List <MPOverride> overrides = new List <MPOverride>(); foreach (MonitoringDiscovery discovery in discoveries) { MonitoringDiscoveryResultantOverrideSet overrideSet = monitoringObject.GetResultantOverrides(discovery); MPWorkflow workflow = new MPWorkflow(discovery); foreach (ResultantOverride <MonitoringDiscoveryConfigurationOverride> discoveryOverride in overrideSet.ResultantConfigurationOverrides.Values) { MonitoringClass target = typeLookupTable[discovery.Target.Id]; workflow.AddOverride(discoveryOverride.EffectiveOverride); MPOverride mpOverride = new MPOverride(discoveryOverride.EffectiveOverride, workflow, new MPClass(target)); overrides.Add(mpOverride); } foreach (ResultantOverride <ManagementPackOverride> discoveryOverride in overrideSet.ResultantPropertyOverrides.Values) { MonitoringClass target = typeLookupTable[discovery.Target.Id]; workflow.AddOverride(discoveryOverride.EffectiveOverride); MPOverride mpOverride = new MPOverride(discoveryOverride.EffectiveOverride, workflow, new MPClass(target)); overrides.Add(mpOverride); } } return(overrides); }
//--------------------------------------------------------------------- private void DisplayOverridesForMPWorkflow(TreeNode treeNode) { overrideListView.ClearOverrides(); if (!(treeNode.Tag is MPWorkflow)) { return; } MPWorkflow workflow = (MPWorkflow)treeNode.Tag; MPClass workflowTarget = (MPClass)treeNode.Parent.Parent.Tag; List <MPOverride> overrides = new List <MPOverride>(); foreach (ManagementPackOverride mpOverride in workflow.Overrides) { overrides.Add(new MPOverride(mpOverride, workflow, workflowTarget)); } overrideListView.AddOverrides(overrides); }
//--------------------------------------------------------------------- private static List<MPOverride> GenerateEffectiveOverrrideList( PartialMonitoringObject monitoringObject, ReadOnlyCollection<MonitoringDiscovery> discoveries, Dictionary<Guid, MonitoringClass> typeLookupTable ) { List<MPOverride> overrides = new List<MPOverride>(); foreach (MonitoringDiscovery discovery in discoveries) { MonitoringDiscoveryResultantOverrideSet overrideSet = monitoringObject.GetResultantOverrides(discovery); MPWorkflow workflow = new MPWorkflow(discovery); foreach (ResultantOverride<MonitoringDiscoveryConfigurationOverride> discoveryOverride in overrideSet.ResultantConfigurationOverrides.Values) { MonitoringClass target = typeLookupTable[discovery.Target.Id]; workflow.AddOverride(discoveryOverride.EffectiveOverride); MPOverride mpOverride = new MPOverride(discoveryOverride.EffectiveOverride, workflow, new MPClass(target)); overrides.Add(mpOverride); } foreach (ResultantOverride<ManagementPackOverride> discoveryOverride in overrideSet.ResultantPropertyOverrides.Values) { MonitoringClass target = typeLookupTable[discovery.Target.Id]; workflow.AddOverride(discoveryOverride.EffectiveOverride); MPOverride mpOverride = new MPOverride(discoveryOverride.EffectiveOverride, workflow, new MPClass(target)); overrides.Add(mpOverride); } } return (overrides); }
//--------------------------------------------------------------------- private static List<MPOverride> GenerateEffectiveOverrrideList( PartialMonitoringObject monitoringObject, ReadOnlyCollection<ManagementPackMonitor> monitors, Dictionary<Guid, MonitoringClass> typeLookupTable ) { List<MPOverride> overrides = new List<MPOverride>(); foreach (ManagementPackMonitor monitor in monitors) { // if we do this check which I commented out, it only works for Windows computer, not for linux ones... // I am not sure why the check was done in the first place... what was it preventing from doing? // was it just an optimization to speed things up, or was it protecting the UI from dealing with some weird monitors? //if (!DoesMonitorHaveNonCategoryOverride(monitor)) //{ // continue; //} MonitorResultantOverrideSet overrideSet = monitoringObject.GetResultantOverrides(monitor); MPWorkflow workflow = new MPWorkflow(monitor); foreach (ResultantOverride<MonitorConfigurationOverride> monitorOverride in overrideSet.ResultantConfigurationOverrides.Values) { MonitoringClass target = typeLookupTable[monitor.Target.Id]; workflow.AddOverride(monitorOverride.EffectiveOverride); MPOverride mpOverride = new MPOverride(monitorOverride.EffectiveOverride, workflow, new MPClass(target)); overrides.Add(mpOverride); } foreach (ResultantOverride<ManagementPackOverride> monitorOverride in overrideSet.ResultantPropertyOverrides.Values) { MonitoringClass target = typeLookupTable[monitor.Target.Id]; workflow.AddOverride(monitorOverride.EffectiveOverride); MPOverride mpOverride = new MPOverride(monitorOverride.EffectiveOverride, workflow, new MPClass(target)); overrides.Add(mpOverride); } } return (overrides); }