19 using System.Collections;
20 using System.Configuration;
24 namespace Lucene.Net.Distributed.Configuration
46 private string _strObjectUri;
48 private DirectoryInfo[] _arIndexADirectories;
49 private DirectoryInfo[] _arIndexBDirectories;
50 private DirectoryInfo[] _arRefreshDirectories;
61 XmlAttributeCollection attributeCollection = xSection.Attributes;
64 this._strObjectUri = attributeCollection[
"ObjectUri"].Value;
68 throw new ConfigurationErrorsException(
"ObjectUri invalid: "+Environment.NewLine + xSection.OuterXml);
73 this._intPort = (attributeCollection[
"port"] != null ? Convert.ToInt32(attributeCollection[
"port"].Value) : defaultPort);
77 throw new ConfigurationErrorsException(
"port invalid: " + Environment.NewLine + xSection.OuterXml);
80 if (xSection.ChildNodes.Count == 0)
81 throw new ConfigurationErrorsException(
"LuceneServerIndex configuration missing: " + Environment.NewLine + xSection.OuterXml);
83 _arIndexADirectories =
new DirectoryInfo[xSection.ChildNodes.Count];
84 _arIndexBDirectories =
new DirectoryInfo[xSection.ChildNodes.Count];
89 foreach (XmlNode c
in xSection.ChildNodes)
91 if (c.Name.ToLower()==
"directory")
95 diA =
new DirectoryInfo(c.Attributes[
"indexA"].Value);
96 _arIndexADirectories[x] = diA;
98 throw new DirectoryNotFoundException(
"Directory not found: indexA=" + c.Attributes[
"indexA"].Value + Environment.NewLine + xSection.OuterXml);
102 throw new ConfigurationErrorsException(
"LuceneServerIndex configuration Directory error: indexA=" + c.Attributes[
"indexA"].Value + Environment.NewLine + xSection.OuterXml);
107 diB =
new DirectoryInfo(c.Attributes[
"indexB"].Value);
108 _arIndexBDirectories[x] = diB;
110 throw new DirectoryNotFoundException(
"Directory not found: indexA=" + c.Attributes[
"indexA"].Value + Environment.NewLine + xSection.OuterXml);
114 throw new ConfigurationErrorsException(
"LuceneServerIndex configuration Directory error: indexA=" + c.Attributes[
"indexB"].Value + Environment.NewLine + xSection.OuterXml);
128 public string ObjectUri
130 get {
return this._strObjectUri;}
140 get {
return this._intPort;}
146 public DirectoryInfo[] IndexADirectories
148 get {
return this._arIndexADirectories;}
154 public DirectoryInfo[] IndexBDirectories
156 get {
return this._arIndexBDirectories;}
165 public DirectoryInfo[] RefreshDirectories(
IndexSetting oIndexSettingRefresh)
167 this._arRefreshDirectories=null;
169 this._arRefreshDirectories = this._arIndexADirectories;
171 this._arRefreshDirectories = this._arIndexBDirectories;
172 return this._arRefreshDirectories;