Merge pull request #439 from mono-soc-2012/garyb/iconfix
[mono.git] / mcs / class / System / System.Net.Configuration / RequestCachingSection.cs
1 //
2 // System.Net.Configuration.RequestCachingSection.cs
3 //
4 // Authors:
5 //      Tim Coleman (tim@timcoleman.com)
6 //      Chris Toshok (toshok@ximian.com)
7 //
8 // Copyright (C) Tim Coleman, 2004
9 // (C) 2004,2005 Novell, Inc. (http://www.novell.com)
10 //
11
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
20 // 
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 // 
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 //
32
33 #if CONFIGURATION_DEP
34
35 using System;
36 using System.Configuration;
37 using System.Net.Cache;
38 using System.Xml;
39
40 namespace System.Net.Configuration 
41 {
42         public sealed class RequestCachingSection : ConfigurationSection
43         {
44                 #region Fields
45
46                 static ConfigurationPropertyCollection properties;
47                 static ConfigurationProperty defaultFtpCachePolicyProp;
48                 static ConfigurationProperty defaultHttpCachePolicyProp;
49                 static ConfigurationProperty defaultPolicyLevelProp;
50                 static ConfigurationProperty disableAllCachingProp;
51                 static ConfigurationProperty isPrivateCacheProp;
52                 static ConfigurationProperty unspecifiedMaximumAgeProp;
53
54                 #endregion // Fields
55
56                 #region Constructors
57
58                 static RequestCachingSection ()
59                 {
60                         defaultFtpCachePolicyProp = new ConfigurationProperty ("defaultFtpCachePolicy", typeof (FtpCachePolicyElement));
61                         defaultHttpCachePolicyProp = new ConfigurationProperty ("defaultHttpCachePolicy", typeof (HttpCachePolicyElement));
62                         defaultPolicyLevelProp = new ConfigurationProperty ("defaultPolicyLevel", typeof (RequestCacheLevel), RequestCacheLevel.BypassCache);
63                         disableAllCachingProp = new ConfigurationProperty ("disableAllCaching", typeof (bool), false);
64                         isPrivateCacheProp = new ConfigurationProperty ("isPrivateCache", typeof (bool), true);
65                         unspecifiedMaximumAgeProp = new ConfigurationProperty ("unspecifiedMaximumAge", typeof (TimeSpan), new TimeSpan (1, 0, 0, 0));
66                         properties = new ConfigurationPropertyCollection ();
67
68                         properties.Add (defaultFtpCachePolicyProp);
69                         properties.Add (defaultHttpCachePolicyProp);
70                         properties.Add (defaultPolicyLevelProp);
71                         properties.Add (disableAllCachingProp);
72                         properties.Add (isPrivateCacheProp);
73                         properties.Add (unspecifiedMaximumAgeProp);
74                 }
75
76                 public RequestCachingSection ()
77                 {
78                 }
79
80                 #endregion // Constructors
81
82                 #region Properties
83
84                 [ConfigurationProperty ("defaultFtpCachePolicy")]
85                 public FtpCachePolicyElement DefaultFtpCachePolicy {
86                         get { return (FtpCachePolicyElement) base [defaultFtpCachePolicyProp]; }
87                 }
88
89                 [ConfigurationProperty ("defaultHttpCachePolicy")]
90                 public HttpCachePolicyElement DefaultHttpCachePolicy {
91                         get { return (HttpCachePolicyElement) base [defaultHttpCachePolicyProp]; }
92                 }
93
94                 [ConfigurationProperty ("defaultPolicyLevel", DefaultValue = "BypassCache")]
95                 public RequestCacheLevel DefaultPolicyLevel {
96                         get { return (RequestCacheLevel) base [defaultPolicyLevelProp]; }
97                         set { base [defaultPolicyLevelProp] = value; }
98                 }
99
100                 [ConfigurationProperty ("disableAllCaching", DefaultValue = "False")]
101                 public bool DisableAllCaching {
102                         get { return (bool) base [disableAllCachingProp]; }
103                         set { base [disableAllCachingProp] = value; }
104                 }
105
106                 [ConfigurationProperty ("isPrivateCache", DefaultValue = "True")]
107                 public bool IsPrivateCache {
108                         get { return (bool) base [isPrivateCacheProp]; }
109                         set { base [isPrivateCacheProp] = value; }
110                 }
111
112                 [ConfigurationProperty ("unspecifiedMaximumAge", DefaultValue = "1.00:00:00")]
113                 public TimeSpan UnspecifiedMaximumAge {
114                         get { return (TimeSpan) base [unspecifiedMaximumAgeProp]; }
115                         set { base [unspecifiedMaximumAgeProp] = value; }
116                 }
117
118                 protected override ConfigurationPropertyCollection Properties {
119                         get { return properties; }
120                 }
121
122                 #endregion // Properties
123
124                 #region Methods
125
126                 [MonoTODO]
127                 protected override void PostDeserialize ()
128                 {
129                         base.PostDeserialize ();
130                 }
131
132                 [MonoTODO]
133                 protected override void DeserializeElement (XmlReader reader, bool serializeCollectionKey)
134                 {
135                         base.DeserializeElement (reader, serializeCollectionKey);
136                 }
137
138                 #endregion // Methods
139         }
140 }
141
142 #endif