예제 #1
0
        /// <summary>
        /// Instantiates an AFSDB Resource Record based on the data in the method's
        /// input parameters: the record's DNS Server Name, Container Name, Owner/Cell
        /// Name, class (default = IN), time-to-live value, and host AFS server subtype
        /// and name. Returns a reference to the new object as an output parameter.
        /// </summary>
        /// <param name="server">Server object</param>
        /// <param name="dnsServerName">FQDN or IP address of the DNS Server that contains this RR.</param>
        /// <param name="containerName">Name of the Container for the Zone, Cache, or RootHints instance which contains this RR.</param>
        /// <param name="ownerName">Owner name for the RR.</param>
        /// <param name="recordClass">Class of the RR.</param>
        /// <param name="ttl">Time, in seconds, that the RR can be cached by a DNS resolver.</param>
        /// <param name="subtype">Subtype of the host AFS server.</param>
        /// <param name="serverName">FQDN specifying a host that has a server for the AFS cell specified in the owner name.</param>
        /// <returns>the new object.</returns>
        public static AFSDBType CreateInstanceFromPropertyData(
            Server server,
            string dnsServerName,
            string containerName,
            string ownerName,
            RecordClassEnum?recordClass,
            TimeSpan?ttl,
            SubtypeEnum subtype,
            string serverName)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server is required");
            }

            ManagementClass      dnsClass = new ManagementClass(server.m_scope, new ManagementPath("MicrosoftDNS_AFSDBType"), null);
            ManagementBaseObject inParams = dnsClass.GetMethodParameters("CreateInstanceFromPropertyData");

            inParams["DnsServerName"] = dnsServerName;
            inParams["ContainerName"] = containerName;
            inParams["OwnerName"]     = ownerName;
            if (recordClass != null)
            {
                inParams["RecordClass"] = (UInt32)recordClass.Value;
            }
            if (ttl != null)
            {
                inParams["TTL"] = ttl.Value.TotalSeconds;
            }
            inParams["Subtype"]    = (UInt16)subtype;
            inParams["ServerName"] = IPHelper.FixHostnames(serverName);

            try
            {
                return(new AFSDBType(new ManagementObject(server.m_scope, new ManagementPath(dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null)["RR"].ToString()), null)));
            }
            catch (ManagementException me)
            {
                throw new WMIException(me);
            }
        }
예제 #2
0
        /// <summary>
        /// updates the TTL, Subtype and Server Name to the values specified
        /// as the input parameters of this method. If a new value for a 
        /// parameter is not specified, then the current value for the 
        /// parameter is not changed. The method returns a reference to
        /// the modified object as an output parameter. 
        /// </summary>
        /// <param name="ttl">Time, in seconds, that the RR can be cached by a DNS resolver.</param>
        /// <param name="subType">Subtype of the host AFS server. </param>
        /// <param name="serverName">FQDN specifying a host that has a server for the AFS cell specified in the owner name.</param>
        /// <returns>the modified object.</returns>
        public AFSDBType Modify(TimeSpan? ttl, SubtypeEnum? subType, string serverName)
        {
            ManagementBaseObject inParams = m_mo.GetMethodParameters("Modify");
            if ((ttl != null) && (ttl != this.TTL))
                inParams["TTL"] = ttl.Value.TotalSeconds;
            if ((subType != null) && (subType != this.Subtype))
                inParams["Subtype"] = (UInt16)subType;
            if ((!string.IsNullOrEmpty(serverName)) && (serverName != this.ServerName))
                //workaround for MS bug.
                inParams["ServerName"] = IPHelper.FixHostnames( serverName);

            return new AFSDBType(new ManagementObject(m_mo.Scope, new ManagementPath(m_mo.InvokeMethod("Modify", inParams, null)["RR"].ToString()), null));
        }
예제 #3
0
        /// <summary>
        /// Instantiates an AFSDB Resource Record based on the data in the method's
        /// input parameters: the record's DNS Server Name, Container Name, Owner/Cell
        /// Name, class (default = IN), time-to-live value, and host AFS server subtype
        /// and name. Returns a reference to the new object as an output parameter. 
        /// </summary>
        /// <param name="server">Server object</param>
        /// <param name="dnsServerName">FQDN or IP address of the DNS Server that contains this RR.</param>
        /// <param name="containerName">Name of the Container for the Zone, Cache, or RootHints instance which contains this RR.</param>
        /// <param name="ownerName">Owner name for the RR.</param>
        /// <param name="recordClass">Class of the RR.</param>
        /// <param name="ttl">Time, in seconds, that the RR can be cached by a DNS resolver.</param>
        /// <param name="subtype">Subtype of the host AFS server.</param>
        /// <param name="serverName">FQDN specifying a host that has a server for the AFS cell specified in the owner name.</param>
        /// <returns>the new object.</returns>
        public static AFSDBType CreateInstanceFromPropertyData(
            Server server,
            string dnsServerName,
            string containerName,
            string ownerName,
            RecordClassEnum? recordClass,
            TimeSpan? ttl,
            SubtypeEnum subtype,
            string serverName )
        {
            if (server == null)
                throw new ArgumentNullException("server is required");

            ManagementClass dnsClass = new ManagementClass(server.m_scope, new ManagementPath("MicrosoftDNS_AFSDBType"), null);
            ManagementBaseObject inParams = dnsClass.GetMethodParameters("CreateInstanceFromPropertyData");
            inParams["DnsServerName"] = dnsServerName;
            inParams["ContainerName"] = containerName;
            inParams["OwnerName"] = ownerName;
            if (recordClass != null)
                inParams["RecordClass"] = (UInt32)recordClass.Value;
            if (ttl != null)
                inParams["TTL"] = ttl.Value.TotalSeconds;
            inParams["Subtype"] = (UInt16)subtype;
            inParams["ServerName"] = IPHelper.FixHostnames(serverName);

            try
            {
                return new AFSDBType(new ManagementObject(server.m_scope, new ManagementPath(dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null)["RR"].ToString()), null));
            }
            catch (ManagementException me)
            {
                throw new WMIException(me);
            }
        }
예제 #4
0
        protected override void ParseAttribute(XmlNode attr)
        {
            base.ParseAttribute(attr);
            switch (attr.Name.ToLower())
            {
            case "type":
                _type = (TypeEnum)Enum.Parse(typeof(TypeEnum), attr.InnerText, true);
                break;

            case "subtype":
                _subType = (SubtypeEnum)Enum.Parse(typeof(SubtypeEnum), attr.InnerText, true);
                break;

            case "seriesgroupings":
            {
                SeriesGrouping lastGrouping = null;

                foreach (XmlNode child in attr.ChildNodes)
                {
                    SeriesGrouping seriesGrouping = SeriesGrouping.GetSeriesGrouping(child, this);
                    if (_seriesGrouping == null)
                    {
                        _seriesGrouping = seriesGrouping;
                    }
                    else
                    {
                        lastGrouping.NextGrouping = seriesGrouping;
                    }
                    lastGrouping = seriesGrouping;
                }
            }
            break;

            case "categorygroupings":
            {
                CategoryGrouping lastGrouping = null;

                foreach (XmlNode child in attr.ChildNodes)
                {
                    CategoryGrouping categoryGrouping = CategoryGrouping.GetCategoryGrouping(child, this);
                    if (_categoryGrouping == null)
                    {
                        _categoryGrouping = categoryGrouping;
                    }
                    else
                    {
                        lastGrouping.NextGrouping = categoryGrouping;
                    }
                    lastGrouping = categoryGrouping;
                }
            }
            break;

            case "chartdata":
                foreach (XmlNode child in attr.ChildNodes)
                {
                    _chartData.Add(new ChartSeries(child, this));
                }
                break;

            case "legend":
                _legend = new Legend(attr, this);
                break;

            case "categoryaxis":
                _categoryAxis = new CategoryAxis(attr.FirstChild, this);
                break;

            case "valueaxis":
                _valueAxis = new ValueAxis(attr.FirstChild, this);
                break;

            case "title":
                _title = new Title(attr, this);
                break;

            case "pointwidth":
                _pointWidth = int.Parse(attr.InnerText);
                break;

            case "pallette":
                _palette = (Palette.PaletteEnum)Enum.Parse(typeof(Palette.PaletteEnum), attr.InnerText, true);
                break;

            case "threedproperties":
                _threeDProperties = new ThreeDProperties(attr, this);
                break;

            case "plotarea":
                _plotAreaStyle = new Style(attr.FirstChild, this);
                break;

            case "chartelementoutput":
                _chartElementOutput = (Enums.DataElementOutputEnum)Enum.Parse(typeof(Enums.DataElementOutputEnum), attr.InnerText, true);
                break;

            default:
                break;
            }
        }