2 // System.Web.Configuration.HealthMonitoringSection
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.ComponentModel;
33 using System.Configuration;
36 namespace System.Web.Configuration {
38 public sealed class HealthMonitoringSection : ConfigurationSection
40 static ConfigurationProperty bufferModesProp;
41 static ConfigurationProperty enabledProp;
42 static ConfigurationProperty eventMappingsProp;
43 static ConfigurationProperty heartbeatIntervalProp;
44 static ConfigurationProperty profilesProp;
45 static ConfigurationProperty providersProp;
46 static ConfigurationProperty rulesProp;
47 static ConfigurationPropertyCollection properties;
49 static HealthMonitoringSection ()
51 bufferModesProp = new ConfigurationProperty ("bufferModes", typeof (BufferModesCollection), null,
52 null, PropertyHelper.DefaultValidator,
53 ConfigurationPropertyOptions.None);
54 enabledProp = new ConfigurationProperty ("enabled", typeof (bool), true);
55 eventMappingsProp = new ConfigurationProperty ("eventMappings", typeof (EventMappingSettingsCollection), null,
56 null, PropertyHelper.DefaultValidator,
57 ConfigurationPropertyOptions.None);
58 heartbeatIntervalProp = new ConfigurationProperty ("heartbeatInterval", typeof (TimeSpan), TimeSpan.FromSeconds (0),
59 PropertyHelper.TimeSpanSecondsConverter,
60 new TimeSpanValidator (TimeSpan.Zero, new TimeSpan (24,30,31,23)),
61 ConfigurationPropertyOptions.None);
62 profilesProp = new ConfigurationProperty ("profiles", typeof (ProfileSettingsCollection), null,
63 null, PropertyHelper.DefaultValidator,
64 ConfigurationPropertyOptions.None);
65 providersProp = new ConfigurationProperty ("providers", typeof (ProviderSettingsCollection), null,
66 null, PropertyHelper.DefaultValidator,
67 ConfigurationPropertyOptions.None);
68 rulesProp = new ConfigurationProperty ("rules", typeof (RuleSettingsCollection), null,
69 null, PropertyHelper.DefaultValidator,
70 ConfigurationPropertyOptions.None);
71 properties = new ConfigurationPropertyCollection ();
73 properties.Add (bufferModesProp);
74 properties.Add (enabledProp);
75 properties.Add (eventMappingsProp);
76 properties.Add (heartbeatIntervalProp);
77 properties.Add (profilesProp);
78 properties.Add (providersProp);
79 properties.Add (rulesProp);
82 [ConfigurationProperty ("bufferModes")]
83 public BufferModesCollection BufferModes {
84 get { return (BufferModesCollection) base [bufferModesProp];}
87 [ConfigurationProperty ("enabled", DefaultValue = "True")]
89 get { return (bool) base [enabledProp];}
90 set { base[enabledProp] = value; }
93 [ConfigurationProperty ("eventMappings")]
94 public EventMappingSettingsCollection EventMappings {
95 get { return (EventMappingSettingsCollection) base [eventMappingsProp];}
98 [TypeConverter (typeof (TimeSpanSecondsConverter))]
99 [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "24.20:31:23")]
100 [ConfigurationProperty ("heartbeatInterval", DefaultValue = "00:00:00")]
101 public TimeSpan HeartbeatInterval {
102 get { return (TimeSpan) base [heartbeatIntervalProp];}
103 set { base[heartbeatIntervalProp] = value; }
106 [ConfigurationProperty ("profiles")]
107 public ProfileSettingsCollection Profiles {
108 get { return (ProfileSettingsCollection) base [profilesProp];}
111 [ConfigurationProperty ("providers")]
112 public ProviderSettingsCollection Providers {
113 get { return (ProviderSettingsCollection) base [providersProp];}
116 [ConfigurationProperty ("rules")]
117 public RuleSettingsCollection Rules {
118 get { return (RuleSettingsCollection) base [rulesProp];}
121 protected internal override ConfigurationPropertyCollection Properties {
122 get { return properties; }