merge -r 53370:58178
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / ProcessModelSection.cs
1 //
2 // System.Web.Configuration.ProcessModelSection
3 //
4 // Authors:
5 //      Chris Toshok (toshok@ximian.com)
6 //
7 // (C) 2005 Novell, Inc (http://www.novell.com)
8 //
9
10 //
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:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
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.
29 //
30
31 using System;
32 using System.ComponentModel;
33 using System.Configuration;
34
35 #if NET_2_0
36
37 namespace System.Web.Configuration {
38
39         public sealed class ProcessModelSection : ConfigurationSection
40         {
41                 static ConfigurationProperty autoConfigProp;
42                 static ConfigurationProperty clientConnectedCheckProp;
43                 static ConfigurationProperty comAuthenticationLevelProp;
44                 static ConfigurationProperty comImpersonationLevelProp;
45                 static ConfigurationProperty cpuMaskProp;
46                 static ConfigurationProperty enableProp;
47                 static ConfigurationProperty idleTimeoutProp;
48                 static ConfigurationProperty logLevelProp;
49                 static ConfigurationProperty maxAppDomainsProp;
50                 static ConfigurationProperty maxIoThreadsProp;
51                 static ConfigurationProperty maxWorkerThreadsProp;
52                 static ConfigurationProperty memoryLimitProp;
53                 static ConfigurationProperty minIoThreadsProp;
54                 static ConfigurationProperty minWorkerThreadsProp;
55                 static ConfigurationProperty passwordProp;
56                 static ConfigurationProperty pingFrequencyProp;
57                 static ConfigurationProperty pingTimeoutProp;
58                 static ConfigurationProperty requestLimitProp;
59                 static ConfigurationProperty requestQueueLimitProp;
60                 static ConfigurationProperty responseDeadlockIntervalProp;
61                 static ConfigurationProperty responseRestartDeadlockIntervalProp;
62                 static ConfigurationProperty restartQueueLimitProp;
63                 static ConfigurationProperty serverErrorMessageFileProp;
64                 static ConfigurationProperty shutdownTimeoutProp;
65                 static ConfigurationProperty timeoutProp;
66                 static ConfigurationProperty userNameProp;
67                 static ConfigurationProperty webGardenProp;
68                 static ConfigurationPropertyCollection properties;
69
70                 static ProcessModelSection ()
71                 {
72                         autoConfigProp = new ConfigurationProperty ("autoConfig", typeof (bool), false);
73                         clientConnectedCheckProp = new ConfigurationProperty ("clientConnectedCheck", typeof (TimeSpan), TimeSpan.FromSeconds (5));
74                         comAuthenticationLevelProp = new ConfigurationProperty ("comAuthenticationLevel", typeof (ProcessModelComAuthenticationLevel), ProcessModelComAuthenticationLevel.Connect);
75                         comImpersonationLevelProp = new ConfigurationProperty ("comImpersonationLevel", typeof (ProcessModelComImpersonationLevel), ProcessModelComImpersonationLevel.Impersonate);
76                         cpuMaskProp = new ConfigurationProperty ("cpuMask", typeof (int), 0xffffffff);
77                         enableProp = new ConfigurationProperty ("enable", typeof (bool), true);
78                         idleTimeoutProp = new ConfigurationProperty ("idleTimeout", typeof (TimeSpan), TimeSpan.MaxValue);
79                         logLevelProp = new ConfigurationProperty ("logLevel", typeof (ProcessModelLogLevel), ProcessModelLogLevel.Errors);
80                         maxAppDomainsProp = new ConfigurationProperty ("maxAppDomains", typeof (int), 2000);
81                         maxIoThreadsProp = new ConfigurationProperty ("maxIoThreads", typeof (int), 20);
82                         maxWorkerThreadsProp = new ConfigurationProperty ("maxWorkerThreads", typeof (int), 20);
83                         memoryLimitProp = new ConfigurationProperty ("memoryLimit", typeof (int), 60);
84                         minIoThreadsProp = new ConfigurationProperty ("minIoThreads", typeof (int), 1);
85                         minWorkerThreadsProp = new ConfigurationProperty ("minWorkerThreads", typeof (int), 1);
86                         passwordProp = new ConfigurationProperty ("password", typeof (string), "AutoGenerate");
87                         pingFrequencyProp = new ConfigurationProperty ("pingFrequency", typeof (TimeSpan), TimeSpan.MaxValue);
88                         pingTimeoutProp = new ConfigurationProperty ("pingTimeout", typeof (TimeSpan), TimeSpan.MaxValue);
89                         requestLimitProp = new ConfigurationProperty ("requestLimit", typeof (int), Int32.MaxValue);
90                         requestQueueLimitProp = new ConfigurationProperty ("requestQueueLimit", typeof (int), 5000);
91                         responseDeadlockIntervalProp = new ConfigurationProperty ("responseDeadlockInterval", typeof (TimeSpan), TimeSpan.FromMinutes (3));
92                         responseRestartDeadlockIntervalProp = new ConfigurationProperty ("responseRestartDeadlockInterval", typeof (TimeSpan), TimeSpan.FromMinutes (3));
93                         restartQueueLimitProp = new ConfigurationProperty ("restartQueueLimit", typeof (int), 10);
94                         serverErrorMessageFileProp = new ConfigurationProperty ("serverErrorMessageFile", typeof (string), "");
95                         shutdownTimeoutProp = new ConfigurationProperty ("shutdownTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (5));
96                         timeoutProp = new ConfigurationProperty ("timeout", typeof (TimeSpan), TimeSpan.MaxValue);
97                         userNameProp = new ConfigurationProperty ("userName", typeof (string), "machine");
98                         webGardenProp = new ConfigurationProperty ("webGarden", typeof (bool), false);
99                         properties = new ConfigurationPropertyCollection ();
100
101                         properties.Add (autoConfigProp);
102                         properties.Add (clientConnectedCheckProp);
103                         properties.Add (comAuthenticationLevelProp);
104                         properties.Add (comImpersonationLevelProp);
105                         properties.Add (cpuMaskProp);
106                         properties.Add (enableProp);
107                         properties.Add (idleTimeoutProp);
108                         properties.Add (logLevelProp);
109                         properties.Add (maxAppDomainsProp);
110                         properties.Add (maxIoThreadsProp);
111                         properties.Add (maxWorkerThreadsProp);
112                         properties.Add (memoryLimitProp);
113                         properties.Add (minIoThreadsProp);
114                         properties.Add (minWorkerThreadsProp);
115                         properties.Add (passwordProp);
116                         properties.Add (pingFrequencyProp);
117                         properties.Add (pingTimeoutProp);
118                         properties.Add (requestLimitProp);
119                         properties.Add (requestQueueLimitProp);
120                         properties.Add (responseDeadlockIntervalProp);
121                         properties.Add (responseRestartDeadlockIntervalProp);
122                         properties.Add (restartQueueLimitProp);
123                         properties.Add (serverErrorMessageFileProp);
124                         properties.Add (shutdownTimeoutProp);
125                         properties.Add (timeoutProp);
126                         properties.Add (userNameProp);
127                         properties.Add (webGardenProp);
128                 }
129
130                 [ConfigurationProperty ("autoConfig", DefaultValue = "False")]
131                 public bool AutoConfig {
132                         get { return (bool) base [autoConfigProp];}
133                         set { base[autoConfigProp] = value; }
134                 }
135
136                 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
137                 [ConfigurationProperty ("clientConnectedCheck", DefaultValue = "00:00:05")]
138                 public TimeSpan ClientConnectedCheck {
139                         get { return (TimeSpan) base [clientConnectedCheckProp];}
140                         set { base[clientConnectedCheckProp] = value; }
141                 }
142
143                 [ConfigurationProperty ("comAuthenticationLevel", DefaultValue = "Connect")]
144                 public ProcessModelComAuthenticationLevel ComAuthenticationLevel {
145                         get { return (ProcessModelComAuthenticationLevel) base [comAuthenticationLevelProp];}
146                         set { base[comAuthenticationLevelProp] = value; }
147                 }
148
149                 [ConfigurationProperty ("comImpersonationLevel", DefaultValue = "Impersonate")]
150                 public ProcessModelComImpersonationLevel ComImpersonationLevel {
151                         get { return (ProcessModelComImpersonationLevel) base [comImpersonationLevelProp];}
152                         set { base[comImpersonationLevelProp] = value; }
153                 }
154
155                 [ConfigurationProperty ("cpuMask", DefaultValue = "0xffffffff")]
156                 public int CpuMask {
157                         get { return (int) base [cpuMaskProp];}
158                         set { base[cpuMaskProp] = value; }
159                 }
160
161                 [ConfigurationProperty ("enable", DefaultValue = "True")]
162                 public bool Enable {
163                         get { return (bool) base [enableProp];}
164                         set { base[enableProp] = value; }
165                 }
166
167                 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
168                 [ConfigurationProperty ("idleTimeout", DefaultValue = "10675199.02:48:05.4775807")]
169                 public TimeSpan IdleTimeout {
170                         get { return (TimeSpan) base [idleTimeoutProp];}
171                         set { base[idleTimeoutProp] = value; }
172                 }
173
174                 [ConfigurationProperty ("logLevel", DefaultValue = "Errors")]
175                 public ProcessModelLogLevel LogLevel {
176                         get { return (ProcessModelLogLevel) base [logLevelProp];}
177                         set { base[logLevelProp] = value; }
178                 }
179
180                 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
181                 [ConfigurationProperty ("maxAppDomains", DefaultValue = "2000")]
182                 public int MaxAppDomains {
183                         get { return (int) base [maxAppDomainsProp];}
184                         set { base[maxAppDomainsProp] = value; }
185                 }
186
187                 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
188                 [ConfigurationProperty ("maxIoThreads", DefaultValue = "20")]
189                 public int MaxIOThreads {
190                         get { return (int) base [maxIoThreadsProp];}
191                         set { base[maxIoThreadsProp] = value; }
192                 }
193
194                 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
195                 [ConfigurationProperty ("maxWorkerThreads", DefaultValue = "20")]
196                 public int MaxWorkerThreads {
197                         get { return (int) base [maxWorkerThreadsProp];}
198                         set { base[maxWorkerThreadsProp] = value; }
199                 }
200
201                 [ConfigurationProperty ("memoryLimit", DefaultValue = "60")]
202                 public int MemoryLimit {
203                         get { return (int) base [memoryLimitProp];}
204                         set { base[memoryLimitProp] = value; }
205                 }
206
207                 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
208                 [ConfigurationProperty ("minIoThreads", DefaultValue = "1")]
209                 public int MinIOThreads {
210                         get { return (int) base [minIoThreadsProp];}
211                         set { base[minIoThreadsProp] = value; }
212                 }
213
214                 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue- 1)]
215                 [ConfigurationProperty ("minWorkerThreads", DefaultValue = "1")]
216                 public int MinWorkerThreads {
217                         get { return (int) base [minWorkerThreadsProp];}
218                         set { base[minWorkerThreadsProp] = value; }
219                 }
220
221                 [ConfigurationProperty ("password", DefaultValue = "AutoGenerate")]
222                 public string Password {
223                         get { return (string) base [passwordProp];}
224                         set { base[passwordProp] = value; }
225                 }
226
227                 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
228                 [ConfigurationProperty ("pingFrequency", DefaultValue = "10675199.02:48:05.4775807")]
229                 public TimeSpan PingFrequency {
230                         get { return (TimeSpan) base [pingFrequencyProp];}
231                         set { base[pingFrequencyProp] = value; }
232                 }
233
234                 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
235                 [ConfigurationProperty ("pingTimeout", DefaultValue = "10675199.02:48:05.4775807")]
236                 public TimeSpan PingTimeout {
237                         get { return (TimeSpan) base [pingTimeoutProp];}
238                         set { base[pingTimeoutProp] = value; }
239                 }
240
241                 [TypeConverter (typeof (InfiniteIntConverter))]
242                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
243                 [ConfigurationProperty ("requestLimit", DefaultValue = "2147483647")]
244                 public int RequestLimit {
245                         get { return (int) base [requestLimitProp];}
246                         set { base[requestLimitProp] = value; }
247                 }
248
249                 [TypeConverter (typeof (InfiniteIntConverter))]
250                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
251                 [ConfigurationProperty ("requestQueueLimit", DefaultValue = "5000")]
252                 public int RequestQueueLimit {
253                         get { return (int) base [requestQueueLimitProp];}
254                         set { base[requestQueueLimitProp] = value; }
255                 }
256
257                 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
258                 [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
259                 [ConfigurationProperty ("responseDeadlockInterval", DefaultValue = "00:03:00")]
260                 public TimeSpan ResponseDeadlockInterval {
261                         get { return (TimeSpan) base [responseDeadlockIntervalProp];}
262                         set { base[responseDeadlockIntervalProp] = value; }
263                 }
264
265                 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
266                 [ConfigurationProperty ("responseRestartDeadlockInterval", DefaultValue = "00:03:00")]
267                 public TimeSpan ResponseRestartDeadlockInterval {
268                         get { return (TimeSpan) base [responseRestartDeadlockIntervalProp];}
269                         set { base[responseRestartDeadlockIntervalProp] = value; }
270                 }
271
272                 [TypeConverter (typeof (InfiniteIntConverter))]
273                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
274                 [ConfigurationProperty ("restartQueueLimit", DefaultValue = "10")]
275                 public int RestartQueueLimit {
276                         get { return (int) base [restartQueueLimitProp];}
277                         set { base[restartQueueLimitProp] = value; }
278                 }
279
280                 [ConfigurationProperty ("serverErrorMessageFile", DefaultValue = "")]
281                 public string ServerErrorMessageFile {
282                         get { return (string) base [serverErrorMessageFileProp];}
283                         set { base[serverErrorMessageFileProp] = value; }
284                 }
285
286                 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
287                 [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
288                 [ConfigurationProperty ("shutdownTimeout", DefaultValue = "00:00:05")]
289                 public TimeSpan ShutdownTimeout {
290                         get { return (TimeSpan) base [shutdownTimeoutProp];}
291                         set { base[shutdownTimeoutProp] = value; }
292                 }
293
294                 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
295                 [ConfigurationProperty ("timeout", DefaultValue = "10675199.02:48:05.4775807")]
296                 public TimeSpan Timeout {
297                         get { return (TimeSpan) base [timeoutProp];}
298                         set { base[timeoutProp] = value; }
299                 }
300
301                 [ConfigurationProperty ("userName", DefaultValue = "machine")]
302                 public string UserName {
303                         get { return (string) base [userNameProp];}
304                         set { base[userNameProp] = value; }
305                 }
306
307                 [ConfigurationProperty ("webGarden", DefaultValue = "False")]
308                 public bool WebGarden {
309                         get { return (bool) base [webGardenProp];}
310                         set { base[webGardenProp] = value; }
311                 }
312
313 #if notyet
314                 [MonoTODO]
315                 public ConfigurationElementProperty ElementProperty {
316                         get { throw new NotImplementedException (); }
317                 }
318 #endif
319
320                 protected override ConfigurationPropertyCollection Properties {
321                         get { return properties; }
322                 }
323
324         }
325
326 }
327
328 #endif
329