コード例 #1
0
        /// <summary>
        /// Public constructor for LuceneServerIndexes. A LuceneServerIndex is defined
        /// in XML configuration and is loaded via a custom configuration handler.
        /// </summary>
        /// <param name="xSection">The Xml definition in the configuration file</param>
        public LuceneServerIndexes(XmlNode xSection)
		{
			XmlAttributeCollection attributeCollection = xSection.Attributes;

            try
            {
                this._intPort = Convert.ToInt32(attributeCollection["Port"].Value);
            }
            catch (Exception)
            {
                throw new ConfigurationErrorsException("LuceneServerIndexes port definition invalid: "+Environment.NewLine+xSection.OuterXml);
            }

            if (xSection.ChildNodes.Count==0)
                throw new ConfigurationErrorsException("LuceneServerIndexes configuration missing: " + Environment.NewLine + xSection.OuterXml);

			this._arLuceneServerIndexArray = new LuceneServerIndex[xSection.ChildNodes.Count];
			int x=0;

			foreach (XmlNode c in xSection.ChildNodes)
			{
				if (c.Name.ToLower()=="luceneserverindex")
				{
					LuceneServerIndex rs = new LuceneServerIndex(c, _intPort);
					this._arLuceneServerIndexArray[x] = rs;
					x++;
				}

			}
		}
コード例 #2
0
        /// <summary>
        /// Public constructor for LuceneServerIndexes. A LuceneServerIndex is defined
        /// in XML configuration and is loaded via a custom configuration handler.
        /// </summary>
        /// <param name="xSection">The Xml definition in the configuration file</param>
        public LuceneServerIndexes(XmlNode xSection)
        {
            XmlAttributeCollection attributeCollection = xSection.Attributes;

            try
            {
                this._intPort = Convert.ToInt32(attributeCollection["Port"].Value);
            }
            catch (Exception)
            {
                throw new ConfigurationErrorsException("LuceneServerIndexes port definition invalid: " + Environment.NewLine + xSection.OuterXml);
            }

            if (xSection.ChildNodes.Count == 0)
            {
                throw new ConfigurationErrorsException("LuceneServerIndexes configuration missing: " + Environment.NewLine + xSection.OuterXml);
            }

            this._arLuceneServerIndexArray = new LuceneServerIndex[xSection.ChildNodes.Count];
            int x = 0;

            foreach (XmlNode c in xSection.ChildNodes)
            {
                if (c.Name.ToLower() == "luceneserverindex")
                {
                    LuceneServerIndex rs = new LuceneServerIndex(c, _intPort);
                    this._arLuceneServerIndexArray[x] = rs;
                    x++;
                }
            }
        }