2 // ServiceEndpointElement.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2006 Novell, Inc. http://www.novell.com
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:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
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.
30 using System.Collections;
31 using System.Collections.Generic;
32 using System.Collections.ObjectModel;
33 using System.ComponentModel;
34 using System.Configuration;
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;
55 namespace System.ServiceModel.Configuration
57 public sealed class ServiceEndpointElement
58 : ConfigurationElement
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;
75 static ConfigurationProperty endpoint_configuration;
76 static ConfigurationProperty is_system_endpoint;
77 static ConfigurationProperty kind;
80 static ServiceEndpointElement ()
82 properties = new ConfigurationPropertyCollection ();
83 address = new ConfigurationProperty ("address",
84 typeof (Uri), "", new UriTypeConverter (), null,
85 ConfigurationPropertyOptions.IsKey);
87 behavior_configuration = new ConfigurationProperty ("behaviorConfiguration",
88 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
89 ConfigurationPropertyOptions.None);
91 binding = new ConfigurationProperty ("binding",
92 typeof (string), null, new StringConverter (), new StringValidator (1, int.MaxValue, null),
93 ConfigurationPropertyOptions.IsRequired| ConfigurationPropertyOptions.IsKey);
95 binding_configuration = new ConfigurationProperty ("bindingConfiguration",
96 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
97 ConfigurationPropertyOptions.IsKey);
99 binding_name = new ConfigurationProperty ("bindingName",
100 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
101 ConfigurationPropertyOptions.IsKey);
103 binding_namespace = new ConfigurationProperty ("bindingNamespace",
104 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
105 ConfigurationPropertyOptions.IsKey);
107 contract = new ConfigurationProperty ("contract",
108 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
109 ConfigurationPropertyOptions.IsKey);
111 headers = new ConfigurationProperty ("headers",
112 typeof (AddressHeaderCollectionElement), null, null, null,
113 ConfigurationPropertyOptions.None);
115 identity = new ConfigurationProperty ("identity",
116 typeof (IdentityElement), null, null, null,
117 ConfigurationPropertyOptions.None);
119 listen_uri = new ConfigurationProperty ("listenUri",
120 typeof (Uri), null, new UriTypeConverter (), null,
121 ConfigurationPropertyOptions.None);
123 listen_uri_mode = new ConfigurationProperty ("listenUriMode",
124 typeof (ListenUriMode), "Explicit", null, null,
125 ConfigurationPropertyOptions.None);
127 name = new ConfigurationProperty ("name",
128 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
129 ConfigurationPropertyOptions.None);
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);
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);
151 properties.Add (endpoint_configuration);
152 properties.Add (is_system_endpoint);
153 properties.Add (kind);
157 public ServiceEndpointElement ()
164 [ConfigurationProperty ("address",
165 Options = ConfigurationPropertyOptions.IsKey,
169 get { return (Uri) base [address]; }
170 set { base [address] = value; }
173 [StringValidator ( MinLength = 0,
174 MaxLength = int.MaxValue,
175 InvalidCharacters = null)]
176 [ConfigurationProperty ("behaviorConfiguration",
177 Options = ConfigurationPropertyOptions.None,
179 public string BehaviorConfiguration {
180 get { return (string) base [behavior_configuration]; }
181 set { base [behavior_configuration] = value; }
184 [StringValidator ( MinLength = 1,
185 MaxLength = int.MaxValue,
186 InvalidCharacters = null)]
187 [ConfigurationProperty ("binding",
188 Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey,
191 public string Binding {
192 get { return (string) base [binding]; }
193 set { base [binding] = value; }
196 [ConfigurationProperty ("bindingConfiguration",
197 Options = ConfigurationPropertyOptions.IsKey,
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; }
208 [ConfigurationProperty ("bindingName",
209 Options = ConfigurationPropertyOptions.IsKey,
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; }
220 [ConfigurationProperty ("bindingNamespace",
221 Options = ConfigurationPropertyOptions.IsKey,
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; }
232 [StringValidator ( MinLength = 0,
233 MaxLength = int.MaxValue,
234 InvalidCharacters = null)]
235 [ConfigurationProperty ("contract",
236 Options = ConfigurationPropertyOptions.IsKey,
239 public string Contract {
240 get { return (string) base [contract]; }
241 set { base [contract] = value; }
244 [ConfigurationProperty ("headers",
245 Options = ConfigurationPropertyOptions.None)]
246 public AddressHeaderCollectionElement Headers {
247 get { return (AddressHeaderCollectionElement) base [headers]; }
250 [ConfigurationProperty ("identity",
251 Options = ConfigurationPropertyOptions.None)]
252 public IdentityElement Identity {
253 get { return (IdentityElement) base [identity]; }
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; }
264 [ConfigurationProperty ("isSystemEndpoint", DefaultValue = false)]
265 public bool IsSystemEndpoint {
266 get { return (bool) base [is_system_endpoint]; }
267 set { base [is_system_endpoint] = value; }
270 [ConfigurationProperty ("kind", DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
271 [StringValidator (MinLength = 0)]
273 get { return (string) base [kind]; }
274 set { base [kind] = value; }
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; }
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; }
294 [StringValidator ( MinLength = 0,
295 MaxLength = int.MaxValue,
296 InvalidCharacters = null)]
297 [ConfigurationProperty ("name",
298 Options = ConfigurationPropertyOptions.None,
301 get { return (string) base [name]; }
302 set { base [name] = value; }
305 protected override ConfigurationPropertyCollection Properties {
306 get { return properties; }