Normalize line endings.
[mono.git] / mcs / class / System.ServiceModel.Web / System.ServiceModel.Configuration / WebMessageEncodingElement.cs
1 //
2 // WebMessageEncodingElement.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2008 Novell, Inc.  http://www.novell.com
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using System;
30 using System.Collections;
31 using System.Collections.Generic;
32 using System.Collections.ObjectModel;
33 using System.ComponentModel;
34 using System.Configuration;
35 using System.Net;
36 using System.Net.Security;
37 using System.Reflection;
38 using System.ServiceModel;
39 using System.ServiceModel.Channels;
40 using System.ServiceModel.Description;
41 using System.ServiceModel.Diagnostics;
42 using System.ServiceModel.Dispatcher;
43 using System.Runtime.Serialization;
44 using System.Text;
45 using System.Xml;
46
47 namespace System.ServiceModel.Configuration
48 {
49         [MonoTODO]
50         public sealed partial class WebMessageEncodingElement
51                  : BindingElementExtensionElement
52         {
53                 // Static Fields
54                 static ConfigurationPropertyCollection properties;
55                 static ConfigurationProperty binding_element_type;
56                 static ConfigurationProperty max_read_pool_size;
57                 static ConfigurationProperty max_write_pool_size;
58                 static ConfigurationProperty reader_quotas;
59                 static ConfigurationProperty write_encoding;
60                 static ConfigurationProperty web_content_type_mapper_type;
61
62                 static WebMessageEncodingElement ()
63                 {
64                         properties = new ConfigurationPropertyCollection ();
65                         binding_element_type = new ConfigurationProperty ("",
66                                 typeof (Type), null, new TypeConverter (), null,
67                                 ConfigurationPropertyOptions.None);
68
69                         max_read_pool_size = new ConfigurationProperty ("maxReadPoolSize",
70                                 typeof (int), "64", null/* FIXME: get converter for int*/, null,
71                                 ConfigurationPropertyOptions.None);
72
73                         max_write_pool_size = new ConfigurationProperty ("maxWritePoolSize",
74                                 typeof (int), "16", null/* FIXME: get converter for int*/, null,
75                                 ConfigurationPropertyOptions.None);
76
77                         reader_quotas = new ConfigurationProperty ("readerQuotas",
78                                 typeof (XmlDictionaryReaderQuotasElement), null, null/* FIXME: get converter for XmlDictionaryReaderQuotasElement*/, null,
79                                 ConfigurationPropertyOptions.None);
80
81                         write_encoding = new ConfigurationProperty ("writeEncoding",
82                                 typeof (Encoding), "utf-8", null/* FIXME: get converter for Encoding*/, null,
83                                 ConfigurationPropertyOptions.None);
84
85                         web_content_type_mapper_type = new ConfigurationProperty ("",
86                                 typeof (string), null, null /* FIXME: supply */, null,
87                                 ConfigurationPropertyOptions.None);
88
89                         properties.Add (binding_element_type);
90                         properties.Add (max_read_pool_size);
91                         properties.Add (max_write_pool_size);
92                         properties.Add (reader_quotas);
93                         properties.Add (write_encoding);
94                         properties.Add (web_content_type_mapper_type);
95                 }
96
97                 public WebMessageEncodingElement ()
98                 {
99                 }
100
101
102                 // Properties
103
104                 public override Type BindingElementType {
105                         get { return (Type) base [binding_element_type]; }
106                 }
107
108                 [ConfigurationProperty ("maxReadPoolSize",
109                          Options = ConfigurationPropertyOptions.None,
110                          DefaultValue = "64")]
111                 [IntegerValidator ( MinValue = 1,
112                         MaxValue = int.MaxValue,
113                         ExcludeRange = false)]
114                 public int MaxReadPoolSize {
115                         get { return (int) base [max_read_pool_size]; }
116                         set { base [max_read_pool_size] = value; }
117                 }
118
119                 [ConfigurationProperty ("maxWritePoolSize",
120                          Options = ConfigurationPropertyOptions.None,
121                          DefaultValue = "16")]
122                 [IntegerValidator ( MinValue = 1,
123                         MaxValue = int.MaxValue,
124                         ExcludeRange = false)]
125                 public int MaxWritePoolSize {
126                         get { return (int) base [max_write_pool_size]; }
127                         set { base [max_write_pool_size] = value; }
128                 }
129
130                 [ConfigurationProperty ("readerQuotas",
131                          Options = ConfigurationPropertyOptions.None)]
132                 public XmlDictionaryReaderQuotasElement ReaderQuotas {
133                         get { return (XmlDictionaryReaderQuotasElement) base [reader_quotas]; }
134                 }
135
136                 [ConfigurationProperty ("writeEncoding",
137                          Options = ConfigurationPropertyOptions.None,
138                          DefaultValue = "utf-8")]
139                 [TypeConverter ()]
140                 public Encoding WriteEncoding {
141                         get { return (Encoding) base [write_encoding]; }
142                         set { base [write_encoding] = value; }
143                 }
144
145                 [ConfigurationProperty ("webContentTypeMapperType",
146                          Options = ConfigurationPropertyOptions.None,
147                          DefaultValue = "")]
148                 [StringValidator ( MinLength = 0,
149                         MaxLength = int.MaxValue)]
150                 public string WebContentTypeMapperType {
151                         get { return (string) base [web_content_type_mapper_type]; }
152                         set { base [web_content_type_mapper_type] = value; }
153                 }
154
155                 [MonoTODO]
156                 protected internal override BindingElement CreateBindingElement ()
157                 {
158                         throw new NotImplementedException ();
159                 }
160         }
161 }