Added initial documentation tree using doxygen. More tweaks on the license text ensur...
[lwes-dotnet/github-mirror.git] / Org.Lwes / Config / LwesConfigurationSection.cs
blobe7596417c0d4e85582a2ca5f9e5d61fd54e3c07f
1 //
2 // This file is part of the LWES .NET Binding (LWES.net)
3 //
4 // COPYRIGHT© 2009, Phillip Clark (cerebralkungfu[at*g mail[dot*com)
5 // original .NET implementation
6 //
7 // LWES.net is free software: you can redistribute it and/or modify
8 // it under the terms of the Lesser GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
12 // LWES.net is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // Lesser GNU General Public License for more details.
17 // You should have received a copy of the Lesser GNU General Public License
18 // along with LWES.net. If not, see <http://www.gnu.org/licenses/>.
20 namespace Org.Lwes.Config
22 using System.Configuration;
24 /// <summary>
25 /// Configuration for the light weight event system.
26 /// </summary>
27 public class LwesConfigurationSection : ConfigurationSection
29 #region Fields
31 /// <summary>
32 /// Property name for buffer allocation length.
33 /// </summary>
34 public const string PropertyName_bufferAllocationLength = "bufferAllocationLength";
36 /// <summary>
37 /// Property name for the diagnostics section.
38 /// </summary>
39 public const string PropertyName_diagnostics = "diagnostics";
41 /// <summary>
42 /// Property name for the emitters section.
43 /// </summary>
44 public const string PropertyName_emitters = "emitters";
46 /// <summary>
47 /// Property name ofr the listeners section.
48 /// </summary>
49 public const string PropertyName_listeners = "listeners";
51 /// <summary>
52 /// Property name for maximum buffer memory.
53 /// </summary>
54 public const string PropertyName_maximumBufferMemory = "maximumBufferMemory";
56 /// <summary>
57 /// Property name for the event template DBs section.
58 /// </summary>
59 public const string PropertyName_templateDBs = "templateDBs";
61 /// <summary>
62 /// Section name used for configuring the Light Weight Event System.
63 /// </summary>
64 public const string SectionName = "lwes";
66 #endregion Fields
68 #region Properties
70 /// <summary>
71 /// Indicates the length of buffers used for event buffering.
72 /// </summary>
73 [ConfigurationProperty(PropertyName_bufferAllocationLength
74 , IsRequired = false
75 , DefaultValue = Constants.CAllocationBufferLength)]
76 public int BufferAllocationLength
78 get { return (int)this[PropertyName_bufferAllocationLength]; }
79 set { this[PropertyName_bufferAllocationLength] = value; }
82 /// <summary>
83 /// Configuration section containing diagnostics settings.
84 /// </summary>
85 [ConfigurationProperty(PropertyName_diagnostics, IsRequired = false)]
86 public DiagnosticsConfigurationElement Diagnostics
88 get { return (DiagnosticsConfigurationElement)this[PropertyName_diagnostics]; }
89 private set { this[PropertyName_diagnostics] = value; }
92 /// <summary>
93 /// Collection of configured emitters.
94 /// </summary>
95 [ConfigurationProperty(PropertyName_emitters, IsDefaultCollection = false
96 , IsRequired = false)]
97 public EmitterConfigurationElementCollection Emitters
99 get { return (EmitterConfigurationElementCollection)this[PropertyName_emitters]; }
100 private set { this[PropertyName_emitters] = value; }
103 /// <summary>
104 /// Collection of configured listeners.
105 /// </summary>
106 [ConfigurationProperty(PropertyName_listeners, IsDefaultCollection = false
107 , IsRequired = false)]
108 public ListenerConfigurationElementCollection Listeners
110 get { return (ListenerConfigurationElementCollection)this[PropertyName_listeners]; }
111 private set { this[PropertyName_listeners] = value; }
114 /// <summary>
115 /// Indicates the maximum amount of memory used for buffering events.
116 /// Note that this setting will throttle event IO if the limit is
117 /// reached.
118 /// </summary>
119 [ConfigurationProperty(PropertyName_maximumBufferMemory
120 , IsRequired = false
121 , DefaultValue = Constants.CMaximumBufferMemory)]
122 public int MaximumBufferMemory
124 get { return (int)this[PropertyName_maximumBufferMemory]; }
125 set { this[PropertyName_maximumBufferMemory] = value; }
128 /// <summary>
129 /// Collection of configured template DBs.
130 /// </summary>
131 [ConfigurationProperty(PropertyName_templateDBs, IsDefaultCollection = false
132 , IsRequired = false)]
133 public TemplateDBConfigurationElementCollection TemplateDBs
135 get { return (TemplateDBConfigurationElementCollection)this[PropertyName_templateDBs]; }
136 private set { this[PropertyName_templateDBs] = value; }
139 internal static LwesConfigurationSection Current
143 LwesConfigurationSection config = ConfigurationManager.GetSection(
144 LwesConfigurationSection.SectionName) as LwesConfigurationSection;
145 if (config == null)
147 config = new LwesConfigurationSection();
148 //config.Diagnostics = new DiagnosticsConfigurationElement();
149 //config.Emitters = new EmitterConfigurationElementCollection();
150 //config.TemplateDBs = new TemplateDBConfigurationElementCollection();
151 //config.Listeners = new ListenerConfigurationElementCollection();
153 return config;
157 #endregion Properties