2 // MsmqBindingElementBase.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
58 public abstract partial class MsmqBindingElementBase
59 : StandardBindingElement, IBindingConfigurationElement
62 static ConfigurationPropertyCollection properties;
63 static ConfigurationProperty custom_dead_letter_queue;
64 static ConfigurationProperty dead_letter_queue;
65 static ConfigurationProperty durable;
66 static ConfigurationProperty exactly_once;
67 static ConfigurationProperty max_received_message_size;
68 static ConfigurationProperty max_retry_cycles;
69 static ConfigurationProperty receive_error_handling;
70 static ConfigurationProperty receive_retry_count;
71 static ConfigurationProperty retry_cycle_delay;
72 static ConfigurationProperty time_to_live;
73 static ConfigurationProperty use_msmq_tracing;
74 static ConfigurationProperty use_source_journal;
76 static MsmqBindingElementBase ()
78 properties = new ConfigurationPropertyCollection ();
79 custom_dead_letter_queue = new ConfigurationProperty ("customDeadLetterQueue",
80 typeof (Uri), null, new UriTypeConverter (), null,
81 ConfigurationPropertyOptions.None);
83 dead_letter_queue = new ConfigurationProperty ("deadLetterQueue",
84 typeof (DeadLetterQueue), "System", null/* FIXME: get converter for DeadLetterQueue*/, null,
85 ConfigurationPropertyOptions.None);
87 durable = new ConfigurationProperty ("durable",
88 typeof (bool), "true", new BooleanConverter (), null,
89 ConfigurationPropertyOptions.None);
91 exactly_once = new ConfigurationProperty ("exactlyOnce",
92 typeof (bool), "true", new BooleanConverter (), null,
93 ConfigurationPropertyOptions.None);
95 max_received_message_size = new ConfigurationProperty ("maxReceivedMessageSize",
96 typeof (long), "65536", null/* FIXME: get converter for long*/, null,
97 ConfigurationPropertyOptions.None);
99 max_retry_cycles = new ConfigurationProperty ("maxRetryCycles",
100 typeof (int), "2", null/* FIXME: get converter for int*/, null,
101 ConfigurationPropertyOptions.None);
103 receive_error_handling = new ConfigurationProperty ("receiveErrorHandling",
104 typeof (ReceiveErrorHandling), "Fault", null/* FIXME: get converter for ReceiveErrorHandling*/, null,
105 ConfigurationPropertyOptions.None);
107 receive_retry_count = new ConfigurationProperty ("receiveRetryCount",
108 typeof (int), "5", null/* FIXME: get converter for int*/, null,
109 ConfigurationPropertyOptions.None);
111 retry_cycle_delay = new ConfigurationProperty ("retryCycleDelay",
112 typeof (TimeSpan), "00:30:00", new TimeSpanConverter (), null,
113 ConfigurationPropertyOptions.None);
115 time_to_live = new ConfigurationProperty ("timeToLive",
116 typeof (TimeSpan), "1.00:00:00", new TimeSpanConverter (), null,
117 ConfigurationPropertyOptions.None);
119 use_msmq_tracing = new ConfigurationProperty ("useMsmqTracing",
120 typeof (bool), "false", new BooleanConverter (), null,
121 ConfigurationPropertyOptions.None);
123 use_source_journal = new ConfigurationProperty ("useSourceJournal",
124 typeof (bool), "false", new BooleanConverter (), null,
125 ConfigurationPropertyOptions.None);
127 properties.Add (custom_dead_letter_queue);
128 properties.Add (dead_letter_queue);
129 properties.Add (durable);
130 properties.Add (exactly_once);
131 properties.Add (max_received_message_size);
132 properties.Add (max_retry_cycles);
133 properties.Add (receive_error_handling);
134 properties.Add (receive_retry_count);
135 properties.Add (retry_cycle_delay);
136 properties.Add (time_to_live);
137 properties.Add (use_msmq_tracing);
138 properties.Add (use_source_journal);
141 protected MsmqBindingElementBase ()
148 [ConfigurationProperty ("customDeadLetterQueue",
149 Options = ConfigurationPropertyOptions.None,
150 DefaultValue = null)]
151 public Uri CustomDeadLetterQueue {
152 get { return (Uri) base [custom_dead_letter_queue]; }
153 set { base [custom_dead_letter_queue] = value; }
156 [ConfigurationProperty ("deadLetterQueue",
157 Options = ConfigurationPropertyOptions.None,
158 DefaultValue = "System")]
159 public DeadLetterQueue DeadLetterQueue {
160 get { return (DeadLetterQueue) base [dead_letter_queue]; }
161 set { base [dead_letter_queue] = value; }
164 [ConfigurationProperty ("durable",
165 Options = ConfigurationPropertyOptions.None,
166 DefaultValue = true)]
167 public bool Durable {
168 get { return (bool) base [durable]; }
169 set { base [durable] = value; }
172 [ConfigurationProperty ("exactlyOnce",
173 Options = ConfigurationPropertyOptions.None,
174 DefaultValue = true)]
175 public bool ExactlyOnce {
176 get { return (bool) base [exactly_once]; }
177 set { base [exactly_once] = value; }
180 [LongValidator ( MinValue = 0,
181 MaxValue = 9223372036854775807,
182 ExcludeRange = false)]
183 [ConfigurationProperty ("maxReceivedMessageSize",
184 Options = ConfigurationPropertyOptions.None,
185 DefaultValue = "65536")]
186 public long MaxReceivedMessageSize {
187 get { return (long) base [max_received_message_size]; }
188 set { base [max_received_message_size] = value; }
191 [ConfigurationProperty ("maxRetryCycles",
192 Options = ConfigurationPropertyOptions.None,
194 [IntegerValidator ( MinValue = 0,
195 MaxValue = int.MaxValue,
196 ExcludeRange = false)]
197 public int MaxRetryCycles {
198 get { return (int) base [max_retry_cycles]; }
199 set { base [max_retry_cycles] = value; }
202 protected override ConfigurationPropertyCollection Properties {
203 get { return properties; }
206 [ConfigurationProperty ("receiveErrorHandling",
207 Options = ConfigurationPropertyOptions.None,
208 DefaultValue = "Fault")]
209 public ReceiveErrorHandling ReceiveErrorHandling {
210 get { return (ReceiveErrorHandling) base [receive_error_handling]; }
211 set { base [receive_error_handling] = value; }
214 [ConfigurationProperty ("receiveRetryCount",
215 Options = ConfigurationPropertyOptions.None,
217 [IntegerValidator ( MinValue = 0,
218 MaxValue = int.MaxValue,
219 ExcludeRange = false)]
220 public int ReceiveRetryCount {
221 get { return (int) base [receive_retry_count]; }
222 set { base [receive_retry_count] = value; }
225 [ConfigurationProperty ("retryCycleDelay",
226 Options = ConfigurationPropertyOptions.None,
227 DefaultValue = "00:30:00")]
228 [TypeConverter (typeof (TimeSpanConverter))]
229 public TimeSpan RetryCycleDelay {
230 get { return (TimeSpan) base [retry_cycle_delay]; }
231 set { base [retry_cycle_delay] = value; }
234 [ConfigurationProperty ("timeToLive",
235 Options = ConfigurationPropertyOptions.None,
236 DefaultValue = "1.00:00:00")]
237 [TypeConverter (typeof (TimeSpanConverter))]
238 public TimeSpan TimeToLive {
239 get { return (TimeSpan) base [time_to_live]; }
240 set { base [time_to_live] = value; }
243 [ConfigurationProperty ("useMsmqTracing",
244 Options = ConfigurationPropertyOptions.None,
245 DefaultValue = false)]
246 public bool UseMsmqTracing {
247 get { return (bool) base [use_msmq_tracing]; }
248 set { base [use_msmq_tracing] = value; }
251 [ConfigurationProperty ("useSourceJournal",
252 Options = ConfigurationPropertyOptions.None,
253 DefaultValue = false)]
254 public bool UseSourceJournal {
255 get { return (bool) base [use_source_journal]; }
256 set { base [use_source_journal] = value; }