MsmqBindingElementBase.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. //
  2. // MsmqBindingElementBase.cs
  3. //
  4. // Author:
  5. // Atsushi Enomoto <[email protected]>
  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. using System;
  29. using System.Collections;
  30. using System.Collections.Generic;
  31. using System.Collections.ObjectModel;
  32. using System.ComponentModel;
  33. using System.Configuration;
  34. using System.Net;
  35. using System.Net.Security;
  36. using System.Reflection;
  37. using System.Security.Cryptography.X509Certificates;
  38. using System.Security.Principal;
  39. using System.IdentityModel.Claims;
  40. using System.IdentityModel.Policy;
  41. using System.IdentityModel.Tokens;
  42. using System.ServiceModel;
  43. using System.ServiceModel.Channels;
  44. using System.ServiceModel.Description;
  45. using System.ServiceModel.Diagnostics;
  46. using System.ServiceModel.Dispatcher;
  47. using System.ServiceModel.MsmqIntegration;
  48. using System.ServiceModel.PeerResolvers;
  49. using System.ServiceModel.Security;
  50. using System.Runtime.Serialization;
  51. using System.Text;
  52. using System.Xml;
  53. namespace System.ServiceModel.Configuration
  54. {
  55. [MonoTODO]
  56. public abstract partial class MsmqBindingElementBase
  57. : StandardBindingElement, IBindingConfigurationElement
  58. {
  59. // Static Fields
  60. static ConfigurationPropertyCollection properties;
  61. static ConfigurationProperty custom_dead_letter_queue;
  62. static ConfigurationProperty dead_letter_queue;
  63. static ConfigurationProperty durable;
  64. static ConfigurationProperty exactly_once;
  65. static ConfigurationProperty max_received_message_size;
  66. static ConfigurationProperty max_retry_cycles;
  67. static ConfigurationProperty receive_error_handling;
  68. static ConfigurationProperty receive_retry_count;
  69. static ConfigurationProperty retry_cycle_delay;
  70. static ConfigurationProperty time_to_live;
  71. static ConfigurationProperty use_msmq_tracing;
  72. static ConfigurationProperty use_source_journal;
  73. static MsmqBindingElementBase ()
  74. {
  75. properties = new ConfigurationPropertyCollection ();
  76. custom_dead_letter_queue = new ConfigurationProperty ("customDeadLetterQueue",
  77. typeof (Uri), null, new UriTypeConverter (), null,
  78. ConfigurationPropertyOptions.None);
  79. dead_letter_queue = new ConfigurationProperty ("deadLetterQueue",
  80. typeof (DeadLetterQueue), "System", null/* FIXME: get converter for DeadLetterQueue*/, null,
  81. ConfigurationPropertyOptions.None);
  82. durable = new ConfigurationProperty ("durable",
  83. typeof (bool), "true", new BooleanConverter (), null,
  84. ConfigurationPropertyOptions.None);
  85. exactly_once = new ConfigurationProperty ("exactlyOnce",
  86. typeof (bool), "true", new BooleanConverter (), null,
  87. ConfigurationPropertyOptions.None);
  88. max_received_message_size = new ConfigurationProperty ("maxReceivedMessageSize",
  89. typeof (long), "65536", null/* FIXME: get converter for long*/, null,
  90. ConfigurationPropertyOptions.None);
  91. max_retry_cycles = new ConfigurationProperty ("maxRetryCycles",
  92. typeof (int), "2", null/* FIXME: get converter for int*/, null,
  93. ConfigurationPropertyOptions.None);
  94. receive_error_handling = new ConfigurationProperty ("receiveErrorHandling",
  95. typeof (ReceiveErrorHandling), "Fault", null/* FIXME: get converter for ReceiveErrorHandling*/, null,
  96. ConfigurationPropertyOptions.None);
  97. receive_retry_count = new ConfigurationProperty ("receiveRetryCount",
  98. typeof (int), "5", null/* FIXME: get converter for int*/, null,
  99. ConfigurationPropertyOptions.None);
  100. retry_cycle_delay = new ConfigurationProperty ("retryCycleDelay",
  101. typeof (TimeSpan), "00:30:00", null/* FIXME: get converter for TimeSpan*/, null,
  102. ConfigurationPropertyOptions.None);
  103. time_to_live = new ConfigurationProperty ("timeToLive",
  104. typeof (TimeSpan), "1.00:00:00", null/* FIXME: get converter for TimeSpan*/, null,
  105. ConfigurationPropertyOptions.None);
  106. use_msmq_tracing = new ConfigurationProperty ("useMsmqTracing",
  107. typeof (bool), "false", new BooleanConverter (), null,
  108. ConfigurationPropertyOptions.None);
  109. use_source_journal = new ConfigurationProperty ("useSourceJournal",
  110. typeof (bool), "false", new BooleanConverter (), null,
  111. ConfigurationPropertyOptions.None);
  112. properties.Add (custom_dead_letter_queue);
  113. properties.Add (dead_letter_queue);
  114. properties.Add (durable);
  115. properties.Add (exactly_once);
  116. properties.Add (max_received_message_size);
  117. properties.Add (max_retry_cycles);
  118. properties.Add (receive_error_handling);
  119. properties.Add (receive_retry_count);
  120. properties.Add (retry_cycle_delay);
  121. properties.Add (time_to_live);
  122. properties.Add (use_msmq_tracing);
  123. properties.Add (use_source_journal);
  124. }
  125. protected MsmqBindingElementBase ()
  126. {
  127. }
  128. // Properties
  129. [ConfigurationProperty ("customDeadLetterQueue",
  130. Options = ConfigurationPropertyOptions.None,
  131. DefaultValue = null)]
  132. public Uri CustomDeadLetterQueue {
  133. get { return (Uri) base [custom_dead_letter_queue]; }
  134. set { base [custom_dead_letter_queue] = value; }
  135. }
  136. [ConfigurationProperty ("deadLetterQueue",
  137. Options = ConfigurationPropertyOptions.None,
  138. DefaultValue = "System")]
  139. public DeadLetterQueue DeadLetterQueue {
  140. get { return (DeadLetterQueue) base [dead_letter_queue]; }
  141. set { base [dead_letter_queue] = value; }
  142. }
  143. [ConfigurationProperty ("durable",
  144. Options = ConfigurationPropertyOptions.None,
  145. DefaultValue = true)]
  146. public bool Durable {
  147. get { return (bool) base [durable]; }
  148. set { base [durable] = value; }
  149. }
  150. [ConfigurationProperty ("exactlyOnce",
  151. Options = ConfigurationPropertyOptions.None,
  152. DefaultValue = true)]
  153. public bool ExactlyOnce {
  154. get { return (bool) base [exactly_once]; }
  155. set { base [exactly_once] = value; }
  156. }
  157. [LongValidator ( MinValue = 0,
  158. MaxValue = 9223372036854775807,
  159. ExcludeRange = false)]
  160. [ConfigurationProperty ("maxReceivedMessageSize",
  161. Options = ConfigurationPropertyOptions.None,
  162. DefaultValue = "65536")]
  163. public long MaxReceivedMessageSize {
  164. get { return (long) base [max_received_message_size]; }
  165. set { base [max_received_message_size] = value; }
  166. }
  167. [ConfigurationProperty ("maxRetryCycles",
  168. Options = ConfigurationPropertyOptions.None,
  169. DefaultValue = "2")]
  170. [IntegerValidator ( MinValue = 0,
  171. MaxValue = int.MaxValue,
  172. ExcludeRange = false)]
  173. public int MaxRetryCycles {
  174. get { return (int) base [max_retry_cycles]; }
  175. set { base [max_retry_cycles] = value; }
  176. }
  177. protected override ConfigurationPropertyCollection Properties {
  178. get { return properties; }
  179. }
  180. [ConfigurationProperty ("receiveErrorHandling",
  181. Options = ConfigurationPropertyOptions.None,
  182. DefaultValue = "Fault")]
  183. public ReceiveErrorHandling ReceiveErrorHandling {
  184. get { return (ReceiveErrorHandling) base [receive_error_handling]; }
  185. set { base [receive_error_handling] = value; }
  186. }
  187. [ConfigurationProperty ("receiveRetryCount",
  188. Options = ConfigurationPropertyOptions.None,
  189. DefaultValue = "5")]
  190. [IntegerValidator ( MinValue = 0,
  191. MaxValue = int.MaxValue,
  192. ExcludeRange = false)]
  193. public int ReceiveRetryCount {
  194. get { return (int) base [receive_retry_count]; }
  195. set { base [receive_retry_count] = value; }
  196. }
  197. [ConfigurationProperty ("retryCycleDelay",
  198. Options = ConfigurationPropertyOptions.None,
  199. DefaultValue = "00:30:00")]
  200. public TimeSpan RetryCycleDelay {
  201. get { return (TimeSpan) base [retry_cycle_delay]; }
  202. set { base [retry_cycle_delay] = value; }
  203. }
  204. [ConfigurationProperty ("timeToLive",
  205. Options = ConfigurationPropertyOptions.None,
  206. DefaultValue = "1.00:00:00")]
  207. public TimeSpan TimeToLive {
  208. get { return (TimeSpan) base [time_to_live]; }
  209. set { base [time_to_live] = value; }
  210. }
  211. [ConfigurationProperty ("useMsmqTracing",
  212. Options = ConfigurationPropertyOptions.None,
  213. DefaultValue = false)]
  214. public bool UseMsmqTracing {
  215. get { return (bool) base [use_msmq_tracing]; }
  216. set { base [use_msmq_tracing] = value; }
  217. }
  218. [ConfigurationProperty ("useSourceJournal",
  219. Options = ConfigurationPropertyOptions.None,
  220. DefaultValue = false)]
  221. public bool UseSourceJournal {
  222. get { return (bool) base [use_source_journal]; }
  223. set { base [use_source_journal] = value; }
  224. }
  225. }
  226. }