2 // This file is part of the LWES .NET Binding (LWES.net)
4 // COPYRIGHT© 2009, Phillip Clark (cerebralkungfu[at*g mail[dot*com)
5 // original .NET implementation
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
;
25 /// Configuration for the light weight event system.
27 public class LwesConfigurationSection
: ConfigurationSection
32 /// Property name for buffer allocation length.
34 public const string PropertyName_bufferAllocationLength
= "bufferAllocationLength";
37 /// Property name for the diagnostics section.
39 public const string PropertyName_diagnostics
= "diagnostics";
42 /// Property name for the emitters section.
44 public const string PropertyName_emitters
= "emitters";
47 /// Property name ofr the listeners section.
49 public const string PropertyName_listeners
= "listeners";
52 /// Property name for maximum buffer memory.
54 public const string PropertyName_maximumBufferMemory
= "maximumBufferMemory";
57 /// Property name for the event template DBs section.
59 public const string PropertyName_templateDBs
= "templateDBs";
62 /// Section name used for configuring the Light Weight Event System.
64 public const string SectionName
= "lwes";
71 /// Indicates the length of buffers used for event buffering.
73 [ConfigurationProperty(PropertyName_bufferAllocationLength
75 , DefaultValue
= Constants
.CAllocationBufferLength
)]
76 public int BufferAllocationLength
78 get { return (int)this[PropertyName_bufferAllocationLength]; }
79 set { this[PropertyName_bufferAllocationLength] = value; }
83 /// Configuration section containing diagnostics settings.
85 [ConfigurationProperty(PropertyName_diagnostics
, IsRequired
= false)]
86 public DiagnosticsConfigurationElement Diagnostics
88 get { return (DiagnosticsConfigurationElement)this[PropertyName_diagnostics]; }
89 private set { this[PropertyName_diagnostics] = value; }
93 /// Collection of configured emitters.
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; }
104 /// Collection of configured listeners.
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; }
115 /// Indicates the maximum amount of memory used for buffering events.
116 /// Note that this setting will throttle event IO if the limit is
119 [ConfigurationProperty(PropertyName_maximumBufferMemory
121 , DefaultValue
= Constants
.CMaximumBufferMemory
)]
122 public int MaximumBufferMemory
124 get { return (int)this[PropertyName_maximumBufferMemory]; }
125 set { this[PropertyName_maximumBufferMemory] = value; }
129 /// Collection of configured template DBs.
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
;
147 config
= new LwesConfigurationSection();
148 //config.Diagnostics = new DiagnosticsConfigurationElement();
149 //config.Emitters = new EmitterConfigurationElementCollection();
150 //config.TemplateDBs = new TemplateDBConfigurationElementCollection();
151 //config.Listeners = new ListenerConfigurationElementCollection();
157 #endregion Properties