MsmqTransportBindingElement.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // ITransactedBindingElement.cs
  3. //
  4. // Author: Atsushi Enomoto <[email protected]>
  5. //
  6. // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
  7. //
  8. // Permission is hereby granted, free of charge, to any person obtaining
  9. // a copy of this software and associated documentation files (the
  10. // "Software"), to deal in the Software without restriction, including
  11. // without limitation the rights to use, copy, modify, merge, publish,
  12. // distribute, sublicense, and/or sell copies of the Software, and to
  13. // permit persons to whom the Software is furnished to do so, subject to
  14. // the following conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be
  17. // included in all copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  23. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  24. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  25. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. //
  27. using System;
  28. using System.ServiceModel;
  29. namespace System.ServiceModel.Channels
  30. {
  31. public sealed class MsmqTransportBindingElement : MsmqBindingElementBase
  32. {
  33. int max_pool_size = 8;
  34. QueueTransferProtocol queue_tr_protocol;
  35. bool use_ad;
  36. public MsmqTransportBindingElement ()
  37. {
  38. }
  39. public int MaxPoolSize {
  40. get { return max_pool_size; }
  41. set { max_pool_size = value; }
  42. }
  43. public QueueTransferProtocol QueueTransferProtocol {
  44. get { return queue_tr_protocol; }
  45. set { queue_tr_protocol = value; }
  46. }
  47. public override string Scheme {
  48. get { return "net.msmq"; }
  49. }
  50. [MonoLimitation ("ActiveDirectory is windows-only solution")]
  51. public bool UseActiveDirectory {
  52. get { return use_ad; }
  53. set { use_ad = value; }
  54. }
  55. public override BindingElement Clone ()
  56. {
  57. return (MsmqTransportBindingElement) MemberwiseClone ();
  58. }
  59. public override bool CanBuildChannelFactory<TChannel> (BindingContext context)
  60. {
  61. if (context == null)
  62. throw new ArgumentNullException ("context");
  63. return typeof (TChannel) == typeof (IOutputChannel) ||
  64. typeof (TChannel) == typeof (IOutputSessionChannel);
  65. }
  66. [MonoTODO]
  67. public override IChannelFactory<TChannel> BuildChannelFactory<TChannel> (BindingContext context)
  68. {
  69. if (context == null)
  70. throw new ArgumentNullException ("context");
  71. if (typeof (TChannel) == typeof (IOutputChannel))
  72. return (IChannelFactory<TChannel>) new MsmqChannelFactory<IOutputChannel> (this, context);
  73. if (typeof (TChannel) == typeof (IOutputSessionChannel))
  74. return (IChannelFactory<TChannel>) new MsmqChannelFactory<IOutputChannel> (this, context);
  75. return base.BuildChannelFactory<TChannel> (context);
  76. }
  77. public override bool CanBuildChannelListener<TChannel> (BindingContext context)
  78. {
  79. if (context == null)
  80. throw new ArgumentNullException ("context");
  81. return typeof (TChannel) == typeof (IInputChannel) ||
  82. typeof (TChannel) == typeof (IInputSessionChannel);
  83. }
  84. [MonoTODO]
  85. public override IChannelListener<TChannel> BuildChannelListener<TChannel> (BindingContext context)
  86. {
  87. throw new NotImplementedException ();
  88. }
  89. }
  90. }