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 ServiceEndpointElement ()
77 properties
= new ConfigurationPropertyCollection ();
78 address
= new ConfigurationProperty ("address",
79 typeof (Uri
), "", new UriTypeConverter (), null,
80 ConfigurationPropertyOptions
.IsKey
);
82 behavior_configuration
= new ConfigurationProperty ("behaviorConfiguration",
83 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue
, null),
84 ConfigurationPropertyOptions
.None
);
86 binding
= new ConfigurationProperty ("binding",
87 typeof (string), null, new StringConverter (), new StringValidator (1, int.MaxValue
, null),
88 ConfigurationPropertyOptions
.IsRequired
| ConfigurationPropertyOptions
.IsKey
);
90 binding_configuration
= new ConfigurationProperty ("bindingConfiguration",
91 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue
, null),
92 ConfigurationPropertyOptions
.IsKey
);
94 binding_name
= new ConfigurationProperty ("bindingName",
95 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue
, null),
96 ConfigurationPropertyOptions
.IsKey
);
98 binding_namespace
= new ConfigurationProperty ("bindingNamespace",
99 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue
, null),
100 ConfigurationPropertyOptions
.IsKey
);
102 contract
= new ConfigurationProperty ("contract",
103 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue
, null),
104 ConfigurationPropertyOptions
.IsKey
);
106 headers
= new ConfigurationProperty ("headers",
107 typeof (AddressHeaderCollectionElement
), null, null, null,
108 ConfigurationPropertyOptions
.None
);
110 identity
= new ConfigurationProperty ("identity",
111 typeof (IdentityElement
), null, null, null,
112 ConfigurationPropertyOptions
.None
);
114 listen_uri
= new ConfigurationProperty ("listenUri",
115 typeof (Uri
), null, new UriTypeConverter (), null,
116 ConfigurationPropertyOptions
.None
);
118 listen_uri_mode
= new ConfigurationProperty ("listenUriMode",
119 typeof (ListenUriMode
), "Explicit", null, null,
120 ConfigurationPropertyOptions
.None
);
122 name
= new ConfigurationProperty ("name",
123 typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue
, null),
124 ConfigurationPropertyOptions
.None
);
126 properties
.Add (address
);
127 properties
.Add (behavior_configuration
);
128 properties
.Add (binding
);
129 properties
.Add (binding_configuration
);
130 properties
.Add (binding_name
);
131 properties
.Add (binding_namespace
);
132 properties
.Add (contract
);
133 properties
.Add (headers
);
134 properties
.Add (identity
);
135 properties
.Add (listen_uri
);
136 properties
.Add (listen_uri_mode
);
137 properties
.Add (name
);
140 public ServiceEndpointElement ()
147 [ConfigurationProperty ("address",
148 Options
= ConfigurationPropertyOptions
.IsKey
,
152 get { return (Uri) base [address]; }
153 set { base [address] = value; }
156 [StringValidator ( MinLength
= 0,
157 MaxLength
= int.MaxValue
,
158 InvalidCharacters
= null)]
159 [ConfigurationProperty ("behaviorConfiguration",
160 Options
= ConfigurationPropertyOptions
.None
,
162 public string BehaviorConfiguration
{
163 get { return (string) base [behavior_configuration]; }
164 set { base [behavior_configuration] = value; }
167 [StringValidator ( MinLength
= 1,
168 MaxLength
= int.MaxValue
,
169 InvalidCharacters
= null)]
170 [ConfigurationProperty ("binding",
171 Options
= ConfigurationPropertyOptions
.IsRequired
| ConfigurationPropertyOptions
.IsKey
,
174 public string Binding
{
175 get { return (string) base [binding]; }
176 set { base [binding] = value; }
179 [ConfigurationProperty ("bindingConfiguration",
180 Options
= ConfigurationPropertyOptions
.IsKey
,
183 [StringValidator ( MinLength
= 0,
184 MaxLength
= int.MaxValue
,
185 InvalidCharacters
= null)]
186 public string BindingConfiguration
{
187 get { return (string) base [binding_configuration]; }
188 set { base [binding_configuration] = value; }
191 [ConfigurationProperty ("bindingName",
192 Options
= ConfigurationPropertyOptions
.IsKey
,
195 [StringValidator ( MinLength
= 0,
196 MaxLength
= int.MaxValue
,
197 InvalidCharacters
= null)]
198 public string BindingName
{
199 get { return (string) base [binding_name]; }
200 set { base [binding_name] = value; }
203 [ConfigurationProperty ("bindingNamespace",
204 Options
= ConfigurationPropertyOptions
.IsKey
,
207 [StringValidator ( MinLength
= 0,
208 MaxLength
= int.MaxValue
,
209 InvalidCharacters
= null)]
210 public string BindingNamespace
{
211 get { return (string) base [binding_namespace]; }
212 set { base [binding_namespace] = value; }
215 [StringValidator ( MinLength
= 0,
216 MaxLength
= int.MaxValue
,
217 InvalidCharacters
= null)]
218 [ConfigurationProperty ("contract",
219 Options
= ConfigurationPropertyOptions
.IsKey
,
222 public string Contract
{
223 get { return (string) base [contract]; }
224 set { base [contract] = value; }
227 [ConfigurationProperty ("headers",
228 Options
= ConfigurationPropertyOptions
.None
)]
229 public AddressHeaderCollectionElement Headers
{
230 get { return (AddressHeaderCollectionElement) base [headers]; }
233 [ConfigurationProperty ("identity",
234 Options
= ConfigurationPropertyOptions
.None
)]
235 public IdentityElement Identity
{
236 get { return (IdentityElement) base [identity]; }
239 [ConfigurationProperty ("listenUri",
240 Options
= ConfigurationPropertyOptions
.None
,
241 DefaultValue
= null)]
242 public Uri ListenUri
{
243 get { return (Uri) base [listen_uri]; }
244 set { base [listen_uri] = value; }
247 [ConfigurationProperty ("listenUriMode",
248 Options
= ConfigurationPropertyOptions
.None
,
249 DefaultValue
= "Explicit")]
250 public ListenUriMode ListenUriMode
{
251 get { return (ListenUriMode) base [listen_uri_mode]; }
252 set { base [listen_uri_mode] = value; }
255 [StringValidator ( MinLength
= 0,
256 MaxLength
= int.MaxValue
,
257 InvalidCharacters
= null)]
258 [ConfigurationProperty ("name",
259 Options
= ConfigurationPropertyOptions
.None
,
262 get { return (string) base [name]; }
263 set { base [name] = value; }
266 protected override ConfigurationPropertyCollection Properties
{
267 get { return properties; }