PageRenderTime 15ms CodeModel.GetById 2ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/tags/stable-1.1.1/Server/FastCgi/ApplicationElement.cs

#
C# | 250 lines | 214 code | 20 blank | 16 comment | 2 complexity | c836e12aa43a7bdde1774a4f38bfe320 MD5 | raw file
  1//-----------------------------------------------------------------------
  2// <copyright>
  3// Copyright (C) Ruslan Yakushev for the PHP Manager for IIS project.
  4//
  5// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
  6// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
  7// </copyright>
  8//----------------------------------------------------------------------- 
  9
 10using Microsoft.Web.Administration;
 11
 12namespace Web.Management.PHP.FastCgi
 13{
 14
 15    internal class ApplicationElement : ConfigurationElement
 16    {
 17        private EnvironmentVariablesCollection _environmentVars;
 18
 19        public int ActivityTimeout
 20        {
 21            get
 22            {
 23                return (int)base["activityTimeout"];
 24            }
 25            set
 26            {
 27                base["activityTimeout"] = value;
 28            }
 29        }
 30
 31        public string Arguments
 32        {
 33            get
 34            {
 35                return (string)base["arguments"];
 36            }
 37            set
 38            {
 39                base["arguments"] = value;
 40            }
 41        }
 42
 43        public EnvironmentVariablesCollection EnvironmentVariables
 44        {
 45            get
 46            {
 47                if (this._environmentVars == null)
 48                {
 49                    ConfigurationElement environmentVars = base.GetChildElement("environmentVariables");
 50                    this._environmentVars = (EnvironmentVariablesCollection)environmentVars.GetCollection(typeof(EnvironmentVariablesCollection));
 51                }
 52                return this._environmentVars;
 53            }
 54        }
 55
 56        public bool FlushNamedPipe
 57        {
 58            get
 59            {
 60                return (bool)base["flushNamedPipe"];
 61            }
 62            set
 63            {
 64                base["flushNamedPipe"] = value;
 65            }
 66        }
 67
 68        public string FullPath
 69        {
 70            get
 71            {
 72                return (string)base["fullPath"];
 73            }
 74            set
 75            {
 76                base["fullPath"] = value;
 77            }
 78        }
 79
 80        public int IdleTimeout
 81        {
 82            get
 83            {
 84                return (int)base["idleTimeout"];
 85            }
 86            set
 87            {
 88                base["idleTimeout"] = value;
 89            }
 90        }
 91
 92        public long InstanceMaxRequests
 93        {
 94            get
 95            {
 96                return (long)base["instanceMaxRequests"];
 97            }
 98            set
 99            {
100                base["instanceMaxRequests"] = value;
101            }
102        }
103
104        public int MaxInstances
105        {
106            get
107            {
108                return (int)base["maxInstances"];
109            }
110            set
111            {
112                base["maxInstances"] = value;
113            }
114        }
115
116        public string MonitorChangesTo
117        {
118            get
119            {
120                return (string)base["monitorChangesTo"];
121            }
122            set
123            {
124                base["monitorChangesTo"] = value;
125            }
126        }
127
128        public Protocol Protocol
129        {
130            get
131            {
132                return ((Protocol)base["protocol"]);
133            }
134            set
135            {
136                base["protocol"] = (int)value;
137            }
138        }
139
140        public int QueueLength
141        {
142            get
143            {
144                return (int)base["queueLength"];
145            }
146            set
147            {
148                base["queueLength"] = value;
149            }
150        }
151
152        public int RapidFailsPerMinute
153        {
154            get
155            {
156                return (int)base["rapidFailsPerMinute"];
157            }
158            set
159            {
160                base["rapidFailsPerMinute"] = value;
161            }
162        }
163
164        public int RequestTimeout
165        {
166            get
167            {
168                return (int)base["requestTimeout"];
169            }
170            set
171            {
172                base["requestTimeout"] = value;
173            }
174        }
175
176        // When FastCGI update is not installed then this property does not exist
177        // We need to handle this case and eat the exception
178        public int SignalBeforeTerminateSeconds
179        {
180            get
181            {
182                int result = 0;
183                try
184                {
185                    result = (int)base["signalBeforeTerminateSeconds"];
186                }
187                catch
188                {
189                    // Do nothing here
190                }
191                return result;
192            }
193            set
194            {
195                try
196                {
197                    base["signalBeforeTerminateSeconds"] = value;
198                }
199                catch
200                {
201                    // Do nothing here
202                }
203            }
204        }
205
206        // When FastCGI update is not installed then this property does not exist
207        // We need to handle this case and eat the exception
208        public StderrMode StderrMode
209        {
210            get
211            {
212                StderrMode result = StderrMode.IgnoreAndReturn200;
213                try
214                {
215                    result = ((StderrMode)base["stderrMode"]);
216                }
217                catch
218                {
219                    // Do nothing here
220                }
221                return result;
222            }
223            set
224            {
225                try
226                {
227                    base["stderrMode"] = (int)value;
228                }
229                catch
230                {
231                    // Do nothing here
232                }
233            }
234        }
235
236        public bool MonitorChangesToExists()
237        {
238            try
239            {
240                object o = base["monitorChangesTo"];
241                return true;
242            }
243            catch
244            {
245                return false;
246            }
247        }
248
249    }
250}