示例#1
0
        //---------------------------------------------------------------------
        internal static void RetrieveParameterInfo(
            ManagementPackOverride mpOverrride,
            out string parameter,
            out string newValue
            )
        {
            parameter = string.Empty;
            newValue  = string.Empty;

            if (mpOverrride is ManagementPackMonitorConfigurationOverride)
            {
                ManagementPackMonitorConfigurationOverride monitorConfigOverride = (ManagementPackMonitorConfigurationOverride)mpOverrride;

                parameter = monitorConfigOverride.Parameter;
                newValue  = monitorConfigOverride.Value;
            }
            else if (mpOverrride is ManagementPackMonitorPropertyOverride)
            {
                ManagementPackMonitorPropertyOverride monitorPropertyOverride = (ManagementPackMonitorPropertyOverride)mpOverrride;

                parameter = monitorPropertyOverride.Property.ToString();
                newValue  = monitorPropertyOverride.Value;
            }
            else if (mpOverrride is ManagementPackRuleConfigurationOverride)
            {
                ManagementPackRuleConfigurationOverride ruleConfigOverride = (ManagementPackRuleConfigurationOverride)mpOverrride;

                parameter = ruleConfigOverride.Parameter;
                newValue  = ruleConfigOverride.Value;
            }
            else if (mpOverrride is ManagementPackRulePropertyOverride)
            {
                ManagementPackRulePropertyOverride rulePropertyOverride = (ManagementPackRulePropertyOverride)mpOverrride;

                parameter = rulePropertyOverride.Property.ToString();
                newValue  = rulePropertyOverride.Value;
            }
            else if (mpOverrride is ManagementPackDiscoveryConfigurationOverride)
            {
                ManagementPackDiscoveryConfigurationOverride discoveryConfigurationOverride = (ManagementPackDiscoveryConfigurationOverride)mpOverrride;

                parameter = discoveryConfigurationOverride.Parameter;
                newValue  = discoveryConfigurationOverride.Value;
            }
            else if (mpOverrride is ManagementPackDiscoveryPropertyOverride)
            {
                ManagementPackDiscoveryPropertyOverride discoveryPropertyOverride = (ManagementPackDiscoveryPropertyOverride)mpOverrride;

                parameter = discoveryPropertyOverride.Property.ToString();
                newValue  = discoveryPropertyOverride.Value;
            }
            else
            {
                throw new ApplicationException("Unknown override type");
            }
        }
示例#2
0
        //---------------------------------------------------------------------
        private void CreateTargetOverride(
            out ManagementPackOverride  targetOverride
            )
        {
            targetOverride = null;

            if (m_mpOverride is ManagementPackMonitorConfigurationOverride)
            {
                ManagementPackMonitorConfigurationOverride sourceMonitorConfigOverride = (ManagementPackMonitorConfigurationOverride)m_mpOverride;
                ManagementPackMonitorConfigurationOverride targetMonitorConfigOverride = new ManagementPackMonitorConfigurationOverride(m_targetMp, m_mpOverride.Name);

                targetMonitorConfigOverride.Monitor     = sourceMonitorConfigOverride.Monitor;
                targetMonitorConfigOverride.Parameter   = sourceMonitorConfigOverride.Parameter;
                targetOverride                          = targetMonitorConfigOverride;

            }
            else if (m_mpOverride is ManagementPackMonitorPropertyOverride)
            {
                ManagementPackMonitorPropertyOverride sourceMonitorPropertyOverride = (ManagementPackMonitorPropertyOverride)m_mpOverride;
                ManagementPackMonitorPropertyOverride targetMonitorPropertyOverride = new ManagementPackMonitorPropertyOverride(m_targetMp, m_mpOverride.Name);

                targetMonitorPropertyOverride.Monitor   = sourceMonitorPropertyOverride.Monitor;
                targetMonitorPropertyOverride.Property  = sourceMonitorPropertyOverride.Property;
                targetOverride                          = targetMonitorPropertyOverride;

            }
            else if (m_mpOverride is ManagementPackRuleConfigurationOverride)
            {
                ManagementPackRuleConfigurationOverride sourceRuleConfigOverride = (ManagementPackRuleConfigurationOverride)m_mpOverride;
                ManagementPackRuleConfigurationOverride targetRuleConfigOverride = new ManagementPackRuleConfigurationOverride(m_targetMp, m_mpOverride.Name);

                targetRuleConfigOverride.Module     = sourceRuleConfigOverride.Module;
                targetRuleConfigOverride.Parameter  = sourceRuleConfigOverride.Parameter;
                targetRuleConfigOverride.Rule       = sourceRuleConfigOverride.Rule;
                targetOverride                      = targetRuleConfigOverride;
            }
            else if (m_mpOverride is ManagementPackRulePropertyOverride)
            {
                ManagementPackRulePropertyOverride sourceRulePropertyOverride = (ManagementPackRulePropertyOverride)m_mpOverride;
                ManagementPackRulePropertyOverride targetRulePropertyOverride = new ManagementPackRulePropertyOverride(m_targetMp, m_mpOverride.Name);

                targetRulePropertyOverride.Property = sourceRulePropertyOverride.Property;
                targetRulePropertyOverride.Rule     = sourceRulePropertyOverride.Rule;
                targetOverride                      = targetRulePropertyOverride;

            }
            else if (m_mpOverride is ManagementPackDiscoveryConfigurationOverride)
            {
                ManagementPackDiscoveryConfigurationOverride sourceDiscoveryConfigurationOverride = (ManagementPackDiscoveryConfigurationOverride)m_mpOverride;
                ManagementPackDiscoveryConfigurationOverride targetDiscoveryConfigurationOverride = new ManagementPackDiscoveryConfigurationOverride(m_targetMp, m_mpOverride.Name);

                targetDiscoveryConfigurationOverride.Discovery  = sourceDiscoveryConfigurationOverride.Discovery;
                targetDiscoveryConfigurationOverride.Module     = sourceDiscoveryConfigurationOverride.Module;
                targetDiscoveryConfigurationOverride.Parameter  = sourceDiscoveryConfigurationOverride.Parameter;
                targetOverride                                  = targetDiscoveryConfigurationOverride;

            }
            else if (m_mpOverride is ManagementPackDiscoveryPropertyOverride)
            {
                ManagementPackDiscoveryPropertyOverride sourceDiscoveryPropertyOverride = (ManagementPackDiscoveryPropertyOverride)m_mpOverride;
                ManagementPackDiscoveryPropertyOverride targetDiscoveryPropertyOverride = new ManagementPackDiscoveryPropertyOverride(m_targetMp, m_mpOverride.Name);

                targetDiscoveryPropertyOverride.Discovery   = sourceDiscoveryPropertyOverride.Discovery;
                targetDiscoveryPropertyOverride.Property    = sourceDiscoveryPropertyOverride.Property;
                targetOverride                              = targetDiscoveryPropertyOverride;
            }
            else
            {
                throw new ApplicationException("Unknown override type");
            }

            targetOverride.Comment          = m_mpOverride.Comment;
            targetOverride.Context          = m_mpOverride.Context;
            targetOverride.ContextInstance  = m_mpOverride.ContextInstance;
            targetOverride.Description      = m_mpOverride.Description;

            // dmuscett 2012-03-02 in 2012 this has become mandatory, apparently....
            if (!String.IsNullOrEmpty(m_mpOverride.DisplayName))
                targetOverride.DisplayName      = m_mpOverride.DisplayName;
            else
                targetOverride.DisplayName = "";

            targetOverride.Enforced         = m_mpOverride.Enforced;

            targetOverride.LanguageCode     = m_mpOverride.LanguageCode;
            targetOverride.LastModified     = m_mpOverride.LastModified;

            targetOverride.TimeAdded        = m_mpOverride.TimeAdded;
            targetOverride.Value            = m_mpOverride.Value;

            targetOverride.Status           = ManagementPackElementStatus.PendingAdd;

            if (targetOverride.DisplayName == null)
            {
                targetOverride.DisplayName = m_mpOverride.Name;
            }
        }
示例#3
0
        //---------------------------------------------------------------------
        private void CreateTargetOverride(
            out ManagementPackOverride targetOverride
            )
        {
            targetOverride = null;

            if (m_mpOverride is ManagementPackMonitorConfigurationOverride)
            {
                ManagementPackMonitorConfigurationOverride sourceMonitorConfigOverride = (ManagementPackMonitorConfigurationOverride)m_mpOverride;
                ManagementPackMonitorConfigurationOverride targetMonitorConfigOverride = new ManagementPackMonitorConfigurationOverride(m_targetMp, m_mpOverride.Name);

                targetMonitorConfigOverride.Monitor   = sourceMonitorConfigOverride.Monitor;
                targetMonitorConfigOverride.Parameter = sourceMonitorConfigOverride.Parameter;
                targetOverride = targetMonitorConfigOverride;
            }
            else if (m_mpOverride is ManagementPackMonitorPropertyOverride)
            {
                ManagementPackMonitorPropertyOverride sourceMonitorPropertyOverride = (ManagementPackMonitorPropertyOverride)m_mpOverride;
                ManagementPackMonitorPropertyOverride targetMonitorPropertyOverride = new ManagementPackMonitorPropertyOverride(m_targetMp, m_mpOverride.Name);

                targetMonitorPropertyOverride.Monitor  = sourceMonitorPropertyOverride.Monitor;
                targetMonitorPropertyOverride.Property = sourceMonitorPropertyOverride.Property;
                targetOverride = targetMonitorPropertyOverride;
            }
            else if (m_mpOverride is ManagementPackRuleConfigurationOverride)
            {
                ManagementPackRuleConfigurationOverride sourceRuleConfigOverride = (ManagementPackRuleConfigurationOverride)m_mpOverride;
                ManagementPackRuleConfigurationOverride targetRuleConfigOverride = new ManagementPackRuleConfigurationOverride(m_targetMp, m_mpOverride.Name);

                targetRuleConfigOverride.Module    = sourceRuleConfigOverride.Module;
                targetRuleConfigOverride.Parameter = sourceRuleConfigOverride.Parameter;
                targetRuleConfigOverride.Rule      = sourceRuleConfigOverride.Rule;
                targetOverride = targetRuleConfigOverride;
            }
            else if (m_mpOverride is ManagementPackRulePropertyOverride)
            {
                ManagementPackRulePropertyOverride sourceRulePropertyOverride = (ManagementPackRulePropertyOverride)m_mpOverride;
                ManagementPackRulePropertyOverride targetRulePropertyOverride = new ManagementPackRulePropertyOverride(m_targetMp, m_mpOverride.Name);

                targetRulePropertyOverride.Property = sourceRulePropertyOverride.Property;
                targetRulePropertyOverride.Rule     = sourceRulePropertyOverride.Rule;
                targetOverride = targetRulePropertyOverride;
            }
            else if (m_mpOverride is ManagementPackDiscoveryConfigurationOverride)
            {
                ManagementPackDiscoveryConfigurationOverride sourceDiscoveryConfigurationOverride = (ManagementPackDiscoveryConfigurationOverride)m_mpOverride;
                ManagementPackDiscoveryConfigurationOverride targetDiscoveryConfigurationOverride = new ManagementPackDiscoveryConfigurationOverride(m_targetMp, m_mpOverride.Name);

                targetDiscoveryConfigurationOverride.Discovery = sourceDiscoveryConfigurationOverride.Discovery;
                targetDiscoveryConfigurationOverride.Module    = sourceDiscoveryConfigurationOverride.Module;
                targetDiscoveryConfigurationOverride.Parameter = sourceDiscoveryConfigurationOverride.Parameter;
                targetOverride = targetDiscoveryConfigurationOverride;
            }
            else if (m_mpOverride is ManagementPackDiscoveryPropertyOverride)
            {
                ManagementPackDiscoveryPropertyOverride sourceDiscoveryPropertyOverride = (ManagementPackDiscoveryPropertyOverride)m_mpOverride;
                ManagementPackDiscoveryPropertyOverride targetDiscoveryPropertyOverride = new ManagementPackDiscoveryPropertyOverride(m_targetMp, m_mpOverride.Name);

                targetDiscoveryPropertyOverride.Discovery = sourceDiscoveryPropertyOverride.Discovery;
                targetDiscoveryPropertyOverride.Property  = sourceDiscoveryPropertyOverride.Property;
                targetOverride = targetDiscoveryPropertyOverride;
            }
            else
            {
                throw new ApplicationException("Unknown override type");
            }

            targetOverride.Comment         = m_mpOverride.Comment;
            targetOverride.Context         = m_mpOverride.Context;
            targetOverride.ContextInstance = m_mpOverride.ContextInstance;
            targetOverride.Description     = m_mpOverride.Description;

            // dmuscett 2012-03-02 in 2012 this has become mandatory, apparently....
            if (!String.IsNullOrEmpty(m_mpOverride.DisplayName))
            {
                targetOverride.DisplayName = m_mpOverride.DisplayName;
            }
            else
            {
                targetOverride.DisplayName = "";
            }

            targetOverride.Enforced = m_mpOverride.Enforced;

            targetOverride.LanguageCode = m_mpOverride.LanguageCode;
            targetOverride.LastModified = m_mpOverride.LastModified;

            targetOverride.TimeAdded = m_mpOverride.TimeAdded;
            targetOverride.Value     = m_mpOverride.Value;

            targetOverride.Status = ManagementPackElementStatus.PendingAdd;

            if (targetOverride.DisplayName == null)
            {
                targetOverride.DisplayName = m_mpOverride.Name;
            }
        }