Ref parameter was not covered by ParameterInfo.IsOut. Fixed bug #696784.
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.Configuration / ServiceEndpointElement.cs
1 //
2 // ServiceEndpointElement.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2006 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.Security.Cryptography.X509Certificates;
39 using System.Security.Principal;
40 using System.IdentityModel.Claims;
41 using System.IdentityModel.Policy;
42 using System.IdentityModel.Tokens;
43 using System.ServiceModel;
44 using System.ServiceModel.Channels;
45 using System.ServiceModel.Description;
46 using System.ServiceModel.Diagnostics;
47 using System.ServiceModel.Dispatcher;
48 using System.ServiceModel.MsmqIntegration;
49 using System.ServiceModel.PeerResolvers;
50 using System.ServiceModel.Security;
51 using System.Runtime.Serialization;
52 using System.Text;
53 using System.Xml;
54
55 namespace System.ServiceModel.Configuration
56 {
57         public sealed class ServiceEndpointElement
58                  : ConfigurationElement
59         {
60                 // Static Fields
61                 static ConfigurationPropertyCollection properties;
62                 static ConfigurationProperty address;
63                 static ConfigurationProperty behavior_configuration;
64                 static ConfigurationProperty binding;
65                 static ConfigurationProperty binding_configuration;
66                 static ConfigurationProperty binding_name;
67                 static ConfigurationProperty binding_namespace;
68                 static ConfigurationProperty contract;
69                 static ConfigurationProperty headers;
70                 static ConfigurationProperty identity;
71                 static ConfigurationProperty listen_uri;
72                 static ConfigurationProperty listen_uri_mode;
73                 static ConfigurationProperty name;
74 #if NET_4_0
75                 static ConfigurationProperty endpoint_configuration;
76                 static ConfigurationProperty is_system_endpoint;
77                 static ConfigurationProperty kind;
78 #endif
79
80                 static ServiceEndpointElement ()
81                 {
82                         properties = new ConfigurationPropertyCollection ();
83                         address = new ConfigurationProperty ("address",
84                                 typeof (Uri), "", new UriTypeConverter (), null,
85                                 ConfigurationPropertyOptions.IsKey);
86
87                         behavior_configuration = new ConfigurationProperty ("behaviorConfiguration",
88                                 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
89                                 ConfigurationPropertyOptions.None);
90
91                         binding = new ConfigurationProperty ("binding",
92                                 typeof (string), null, new StringConverter (), new StringValidator (1, int.MaxValue, null),
93                                 ConfigurationPropertyOptions.IsRequired| ConfigurationPropertyOptions.IsKey);
94
95                         binding_configuration = new ConfigurationProperty ("bindingConfiguration",
96                                 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
97                                 ConfigurationPropertyOptions.IsKey);
98
99                         binding_name = new ConfigurationProperty ("bindingName",
100                                 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
101                                 ConfigurationPropertyOptions.IsKey);
102
103                         binding_namespace = new ConfigurationProperty ("bindingNamespace",
104                                 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
105                                 ConfigurationPropertyOptions.IsKey);
106
107                         contract = new ConfigurationProperty ("contract",
108                                 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
109                                 ConfigurationPropertyOptions.IsKey);
110
111                         headers = new ConfigurationProperty ("headers",
112                                 typeof (AddressHeaderCollectionElement), null, null, null,
113                                 ConfigurationPropertyOptions.None);
114
115                         identity = new ConfigurationProperty ("identity",
116                                 typeof (IdentityElement), null, null, null,
117                                 ConfigurationPropertyOptions.None);
118
119                         listen_uri = new ConfigurationProperty ("listenUri",
120                                 typeof (Uri), null, new UriTypeConverter (), null,
121                                 ConfigurationPropertyOptions.None);
122
123                         listen_uri_mode = new ConfigurationProperty ("listenUriMode",
124                                 typeof (ListenUriMode), "Explicit", null, null,
125                                 ConfigurationPropertyOptions.None);
126
127                         name = new ConfigurationProperty ("name",
128                                 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
129                                 ConfigurationPropertyOptions.None);
130
131 #if NET_4_0
132                         endpoint_configuration = new ConfigurationProperty ("endpointConfiguration", typeof (string), "", null, new StringValidator (0), ConfigurationPropertyOptions.IsKey);
133                         is_system_endpoint = new ConfigurationProperty ("isSystemEndpoint", typeof (bool), false, null, null, ConfigurationPropertyOptions.None);
134                         kind = new ConfigurationProperty ("kind", typeof (string), "", null, new StringValidator (0), ConfigurationPropertyOptions.IsKey);
135 #endif
136
137                         properties.Add (address);
138                         properties.Add (behavior_configuration);
139                         properties.Add (binding);
140                         properties.Add (binding_configuration);
141                         properties.Add (binding_name);
142                         properties.Add (binding_namespace);
143                         properties.Add (contract);
144                         properties.Add (headers);
145                         properties.Add (identity);
146                         properties.Add (listen_uri);
147                         properties.Add (listen_uri_mode);
148                         properties.Add (name);
149
150 #if NET_4_0
151                         properties.Add (endpoint_configuration);
152                         properties.Add (is_system_endpoint);
153                         properties.Add (kind);
154 #endif
155                 }
156
157                 public ServiceEndpointElement ()
158                 {
159                 }
160
161
162                 // Properties
163
164                 [ConfigurationProperty ("address",
165                          Options = ConfigurationPropertyOptions.IsKey,
166                          DefaultValue = "",
167                         IsKey = true)]
168                 public Uri Address {
169                         get { return (Uri) base [address]; }
170                         set { base [address] = value; }
171                 }
172
173                 [StringValidator ( MinLength = 0,
174                         MaxLength = int.MaxValue,
175                          InvalidCharacters = null)]
176                 [ConfigurationProperty ("behaviorConfiguration",
177                          Options = ConfigurationPropertyOptions.None,
178                          DefaultValue = "")]
179                 public string BehaviorConfiguration {
180                         get { return (string) base [behavior_configuration]; }
181                         set { base [behavior_configuration] = value; }
182                 }
183
184                 [StringValidator ( MinLength = 1,
185                         MaxLength = int.MaxValue,
186                          InvalidCharacters = null)]
187                 [ConfigurationProperty ("binding",
188                          Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey,
189                         IsRequired = true,
190                         IsKey = true)]
191                 public string Binding {
192                         get { return (string) base [binding]; }
193                         set { base [binding] = value; }
194                 }
195
196                 [ConfigurationProperty ("bindingConfiguration",
197                          Options = ConfigurationPropertyOptions.IsKey,
198                          DefaultValue = "",
199                         IsKey = true)]
200                 [StringValidator ( MinLength = 0,
201                         MaxLength = int.MaxValue,
202                          InvalidCharacters = null)]
203                 public string BindingConfiguration {
204                         get { return (string) base [binding_configuration]; }
205                         set { base [binding_configuration] = value; }
206                 }
207
208                 [ConfigurationProperty ("bindingName",
209                          Options = ConfigurationPropertyOptions.IsKey,
210                          DefaultValue = "",
211                         IsKey = true)]
212                 [StringValidator ( MinLength = 0,
213                         MaxLength = int.MaxValue,
214                          InvalidCharacters = null)]
215                 public string BindingName {
216                         get { return (string) base [binding_name]; }
217                         set { base [binding_name] = value; }
218                 }
219
220                 [ConfigurationProperty ("bindingNamespace",
221                          Options = ConfigurationPropertyOptions.IsKey,
222                          DefaultValue = "",
223                         IsKey = true)]
224                 [StringValidator ( MinLength = 0,
225                         MaxLength = int.MaxValue,
226                          InvalidCharacters = null)]
227                 public string BindingNamespace {
228                         get { return (string) base [binding_namespace]; }
229                         set { base [binding_namespace] = value; }
230                 }
231
232                 [StringValidator ( MinLength = 0,
233                         MaxLength = int.MaxValue,
234                          InvalidCharacters = null)]
235                 [ConfigurationProperty ("contract",
236                          Options = ConfigurationPropertyOptions.IsKey,
237                          DefaultValue = "",
238                         IsKey = true)]
239                 public string Contract {
240                         get { return (string) base [contract]; }
241                         set { base [contract] = value; }
242                 }
243
244                 [ConfigurationProperty ("headers",
245                          Options = ConfigurationPropertyOptions.None)]
246                 public AddressHeaderCollectionElement Headers {
247                         get { return (AddressHeaderCollectionElement) base [headers]; }
248                 }
249
250                 [ConfigurationProperty ("identity",
251                          Options = ConfigurationPropertyOptions.None)]
252                 public IdentityElement Identity {
253                         get { return (IdentityElement) base [identity]; }
254                 }
255
256 #if NET_4_0
257                 [StringValidator (MinLength = 0)]
258                 [ConfigurationProperty ("endpointConfiguration", DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
259                 public string EndpointConfiguration {
260                         get { return (string) base [endpoint_configuration]; }
261                         set { base [endpoint_configuration] = value; }
262                 }
263
264                 [ConfigurationProperty ("isSystemEndpoint", DefaultValue = false)]
265                 public bool IsSystemEndpoint {
266                         get { return (bool) base [is_system_endpoint]; }
267                         set { base [is_system_endpoint] = value; }
268                 }
269
270                 [ConfigurationProperty ("kind", DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
271                 [StringValidator (MinLength = 0)]
272                 public string Kind {
273                         get { return (string) base [kind]; }
274                         set { base [kind] = value; }
275                 }
276 #endif
277
278                 [ConfigurationProperty ("listenUri",
279                          Options = ConfigurationPropertyOptions.None,
280                          DefaultValue = null)]
281                 public Uri ListenUri {
282                         get { return (Uri) base [listen_uri]; }
283                         set { base [listen_uri] = value; }
284                 }
285
286                 [ConfigurationProperty ("listenUriMode",
287                          Options = ConfigurationPropertyOptions.None,
288                          DefaultValue = "Explicit")]
289                 public ListenUriMode ListenUriMode {
290                         get { return (ListenUriMode) base [listen_uri_mode]; }
291                         set { base [listen_uri_mode] = value; }
292                 }
293
294                 [StringValidator ( MinLength = 0,
295                         MaxLength = int.MaxValue,
296                          InvalidCharacters = null)]
297                 [ConfigurationProperty ("name",
298                          Options = ConfigurationPropertyOptions.None,
299                          DefaultValue = "")]
300                 public string Name {
301                         get { return (string) base [name]; }
302                         set { base [name] = value; }
303                 }
304
305                 protected override ConfigurationPropertyCollection Properties {
306                         get { return properties; }
307                 }
308
309
310         }
311
312 }