DispatchOperation.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. //
  2. // DispatchOperation.cs
  3. //
  4. // Author:
  5. // Atsushi Enomoto <[email protected]>
  6. //
  7. // Copyright (C) 2005 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.Generic;
  30. using System.Reflection;
  31. using System.ServiceModel;
  32. using System.ServiceModel.Channels;
  33. using System.ServiceModel.Description;
  34. using System.Text;
  35. namespace System.ServiceModel.Dispatcher
  36. {
  37. [MonoTODO]
  38. public sealed class DispatchOperation
  39. {
  40. internal class DispatchOperationCollection :
  41. SynchronizedKeyedCollection<string, DispatchOperation>
  42. {
  43. protected override string GetKeyForItem (DispatchOperation o)
  44. {
  45. return o.Name;
  46. }
  47. }
  48. DispatchRuntime parent;
  49. string name, action, reply_action;
  50. bool serialize_reply = true, deserialize_request = true,
  51. is_oneway, is_terminating,
  52. release_after_call, release_before_call,
  53. tx_auto_complete, tx_required;
  54. ImpersonationOption impersonation;
  55. IDispatchMessageFormatter formatter, actual_formatter;
  56. IOperationInvoker invoker;
  57. SynchronizedCollection<IParameterInspector> inspectors
  58. = new SynchronizedCollection<IParameterInspector> ();
  59. SynchronizedCollection<FaultContractInfo> fault_contract_infos
  60. = new SynchronizedCollection<FaultContractInfo> ();
  61. SynchronizedCollection<ICallContextInitializer> ctx_initializers
  62. = new SynchronizedCollection<ICallContextInitializer> ();
  63. public DispatchOperation (DispatchRuntime parent,
  64. string name, string action)
  65. {
  66. if (parent == null)
  67. throw new ArgumentNullException ("parent");
  68. if (name == null)
  69. throw new ArgumentNullException ("name");
  70. // action could be null
  71. is_oneway = true;
  72. this.parent = parent;
  73. this.name = name;
  74. this.action = action;
  75. }
  76. public DispatchOperation (DispatchRuntime parent,
  77. string name, string action, string replyAction)
  78. : this (parent, name, action)
  79. {
  80. // replyAction could be null
  81. is_oneway = false;
  82. reply_action = replyAction;
  83. }
  84. public string Action {
  85. get { return action; }
  86. }
  87. public SynchronizedCollection<ICallContextInitializer> CallContextInitializers {
  88. get { return ctx_initializers; }
  89. }
  90. public bool DeserializeRequest {
  91. get { return deserialize_request; }
  92. set { deserialize_request = value; }
  93. }
  94. public SynchronizedCollection<FaultContractInfo> FaultContractInfos {
  95. get { return fault_contract_infos; }
  96. }
  97. public IDispatchMessageFormatter Formatter {
  98. get { return formatter; }
  99. set {
  100. formatter = value;
  101. actual_formatter = null;
  102. }
  103. }
  104. public ImpersonationOption Impersonation {
  105. get { return impersonation; }
  106. set { impersonation = value; }
  107. }
  108. public IOperationInvoker Invoker {
  109. get { return invoker; }
  110. set { invoker = value; }
  111. }
  112. public bool IsOneWay {
  113. get { return is_oneway; }
  114. }
  115. public bool IsTerminating {
  116. get { return is_terminating; }
  117. set { is_terminating = value; }
  118. }
  119. public string Name {
  120. get { return name; }
  121. }
  122. public SynchronizedCollection<IParameterInspector> ParameterInspectors {
  123. get { return inspectors; }
  124. }
  125. public DispatchRuntime Parent {
  126. get { return parent; }
  127. }
  128. public bool ReleaseInstanceAfterCall {
  129. get { return release_after_call; }
  130. set { release_after_call = value; }
  131. }
  132. public bool ReleaseInstanceBeforeCall {
  133. get { return release_before_call; }
  134. set { release_before_call = value; }
  135. }
  136. public string ReplyAction {
  137. get { return reply_action; }
  138. }
  139. public bool SerializeReply {
  140. get { return serialize_reply; }
  141. set { serialize_reply = value; }
  142. }
  143. public bool TransactionAutoComplete {
  144. get { return tx_auto_complete; }
  145. set { tx_auto_complete = value; }
  146. }
  147. public bool TransactionRequired {
  148. get { return tx_required; }
  149. set { tx_required = value; }
  150. }
  151. MessageVersion MessageVersion {
  152. get { return Parent.ChannelDispatcher.MessageVersion; }
  153. }
  154. }
  155. }