Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

421 lines
8.5 KiB

  1. using System;
  2. using System.Diagnostics;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Xml.Serialization;
  6. using System.Collections.Specialized;
  7. using Microsoft.Uddi;
  8. using Microsoft.Uddi.ServiceType;
  9. using Microsoft.Uddi.Binding;
  10. namespace Microsoft.Uddi.Binding
  11. {
  12. [XmlRootAttribute("delete_binding", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  13. public class DeleteBinding : UddiSecureMessage
  14. {
  15. private StringCollection bindingKeys;
  16. [XmlElement("bindingKey")]
  17. public StringCollection BindingKeys
  18. {
  19. get
  20. {
  21. if( null == bindingKeys )
  22. {
  23. bindingKeys = new StringCollection();
  24. }
  25. return bindingKeys;
  26. }
  27. set { bindingKeys = value; }
  28. }
  29. }
  30. [XmlRootAttribute("find_binding", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  31. public class FindBinding : UddiQueryMessage
  32. {
  33. private string serviceKey;
  34. private StringCollection tModelKeys;
  35. [XmlAttribute("serviceKey")]
  36. public string ServiceKey
  37. {
  38. get { return serviceKey; }
  39. set { serviceKey = value; }
  40. }
  41. [XmlArray("tModelBag"), XmlArrayItem("tModelKey")]
  42. public StringCollection TModelKeys
  43. {
  44. get
  45. {
  46. if( true == SerializeMode &&
  47. true == Utility.CollectionEmpty( tModelKeys ) )
  48. {
  49. return null;
  50. }
  51. if( null == tModelKeys )
  52. {
  53. tModelKeys = new StringCollection();
  54. }
  55. return tModelKeys;
  56. }
  57. set { tModelKeys = value; }
  58. }
  59. }
  60. [XmlRootAttribute("save_binding", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  61. public class SaveBinding : UddiSecureMessage
  62. {
  63. private BindingTemplateCollection bindingTemplates;
  64. [XmlElement("bindingTemplate")]
  65. public BindingTemplateCollection BindingTemplates
  66. {
  67. get
  68. {
  69. if( null == bindingTemplates )
  70. {
  71. bindingTemplates = new BindingTemplateCollection();
  72. }
  73. return bindingTemplates;
  74. }
  75. set { bindingTemplates = value; }
  76. }
  77. public override bool SerializeMode
  78. {
  79. get { return base.SerializeMode; }
  80. set
  81. {
  82. if( false == Utility.CollectionEmpty( bindingTemplates ) )
  83. {
  84. foreach( BindingTemplate binding in bindingTemplates )
  85. {
  86. binding.SerializeMode = value;
  87. }
  88. }
  89. base.SerializeMode = value;
  90. }
  91. }
  92. }
  93. [XmlRootAttribute("get_bindingDetail", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  94. public class GetBindingDetail : UddiMessage
  95. {
  96. private StringCollection bindingKeys;
  97. [XmlElement("bindingKey")]
  98. public StringCollection BindingKeys
  99. {
  100. get
  101. {
  102. if( null == bindingKeys )
  103. {
  104. bindingKeys = new StringCollection();
  105. }
  106. return bindingKeys;
  107. }
  108. set { bindingKeys = value; }
  109. }
  110. }
  111. [XmlRootAttribute("bindingDetail", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  112. public class BindingDetail : UddiCore
  113. {
  114. private string node;
  115. private bool truncated;
  116. private BindingTemplateCollection bindingTemplates;
  117. [XmlAttribute("operator")]
  118. public string Operator
  119. {
  120. get { return node; }
  121. set { node = value; }
  122. }
  123. [XmlAttribute("truncated")]
  124. public bool Truncated
  125. {
  126. get { return truncated; }
  127. set { truncated = value; }
  128. }
  129. [XmlElement("bindingTemplate")]
  130. public BindingTemplateCollection BindingTemplates
  131. {
  132. get
  133. {
  134. if( null == bindingTemplates )
  135. {
  136. bindingTemplates = new BindingTemplateCollection();
  137. }
  138. return bindingTemplates;
  139. }
  140. set { bindingTemplates = value; }
  141. }
  142. }
  143. public class BindingTemplate : UddiCore
  144. {
  145. private string serviceKey;
  146. private string bindingKey;
  147. private AccessPoint accessPoint;
  148. private HostingRedirector hostingRedirector;
  149. private DescriptionCollection descriptions;
  150. private TModelInstanceDetail tModelInstanceDetail;
  151. public BindingTemplate() : this( "", "" )
  152. {}
  153. public BindingTemplate( string serviceKey ) : this( serviceKey, "" )
  154. {}
  155. public BindingTemplate( string serviceKey, string bindingKey )
  156. {
  157. ServiceKey = serviceKey;
  158. BindingKey = bindingKey;
  159. }
  160. [XmlAttribute("serviceKey")]
  161. public string ServiceKey
  162. {
  163. get { return serviceKey; }
  164. set { serviceKey = value; }
  165. }
  166. [XmlAttribute("bindingKey")]
  167. public string BindingKey
  168. {
  169. get { return bindingKey; }
  170. set { bindingKey = value; }
  171. }
  172. [XmlElement("description")]
  173. public DescriptionCollection Descriptions
  174. {
  175. get
  176. {
  177. if( null == descriptions )
  178. {
  179. descriptions = new DescriptionCollection();
  180. }
  181. return descriptions;
  182. }
  183. set { descriptions = value; }
  184. }
  185. [XmlElement("accessPoint")]
  186. public AccessPoint AccessPoint
  187. {
  188. get
  189. {
  190. if( true == SerializeMode &&
  191. ( null == accessPoint || Utility.StringEmpty( accessPoint.Text ) ) )
  192. {
  193. return null;
  194. }
  195. if( null == accessPoint )
  196. {
  197. accessPoint = new AccessPoint();
  198. }
  199. return accessPoint;
  200. }
  201. set { accessPoint = value; }
  202. }
  203. [XmlElement("hostingRedirector")]
  204. public HostingRedirector HostingRedirector
  205. {
  206. get
  207. {
  208. if( true == SerializeMode &&
  209. ( null == hostingRedirector || Utility.StringEmpty( hostingRedirector.BindingKey ) ) )
  210. {
  211. return null;
  212. }
  213. if( null == hostingRedirector )
  214. {
  215. hostingRedirector = new HostingRedirector();
  216. }
  217. return hostingRedirector;
  218. }
  219. set { hostingRedirector = value; }
  220. }
  221. [XmlElement("tModelInstanceDetails")]
  222. public TModelInstanceDetail TModelInstanceDetail
  223. {
  224. get
  225. {
  226. if( null == tModelInstanceDetail )
  227. {
  228. tModelInstanceDetail = new TModelInstanceDetail();
  229. }
  230. return tModelInstanceDetail;
  231. }
  232. set { tModelInstanceDetail = value; }
  233. }
  234. public override bool SerializeMode
  235. {
  236. get { return base.SerializeMode; }
  237. set
  238. {
  239. if( null != tModelInstanceDetail )
  240. {
  241. tModelInstanceDetail.SerializeMode = value;
  242. }
  243. base.SerializeMode = value;
  244. }
  245. }
  246. }
  247. public class AccessPoint : UddiCore
  248. {
  249. private UrlType urlType;
  250. private string text;
  251. public AccessPoint()
  252. {}
  253. public AccessPoint( UrlType urlType ) : this( urlType, "" )
  254. {}
  255. public AccessPoint( UrlType urlType, string accessPoint )
  256. {
  257. UrlType = urlType;
  258. Text = accessPoint;
  259. }
  260. [XmlAttribute( "urlType" )]
  261. public UrlType UrlType
  262. {
  263. get { return urlType; }
  264. set { urlType = value; }
  265. }
  266. [XmlText]
  267. public string Text
  268. {
  269. get { return text; }
  270. set { text = value; }
  271. }
  272. }
  273. public class HostingRedirector : UddiCore
  274. {
  275. private string bindingKey;
  276. [XmlAttribute("bindingKey")]
  277. public string BindingKey
  278. {
  279. get { return bindingKey; }
  280. set { bindingKey = value; }
  281. }
  282. }
  283. public class BindingTemplateCollection : CollectionBase
  284. {
  285. public BindingTemplate this[ int index ]
  286. {
  287. get { return (BindingTemplate)List[index]; }
  288. set { List[index] = value; }
  289. }
  290. public int Add( BindingTemplate bindingTemplate )
  291. {
  292. return List.Add(bindingTemplate);
  293. }
  294. public int Add( string serviceKey )
  295. {
  296. return List.Add( new BindingTemplate( serviceKey ) );
  297. }
  298. public int Add( string serviceKey, string bindingKey )
  299. {
  300. return List.Add( new BindingTemplate( serviceKey, bindingKey ) );
  301. }
  302. public void Insert(int index, BindingTemplate value)
  303. {
  304. List.Insert(index, value);
  305. }
  306. public int IndexOf(BindingTemplate value)
  307. {
  308. return List.IndexOf(value);
  309. }
  310. public bool Contains(BindingTemplate value)
  311. {
  312. return List.Contains(value);
  313. }
  314. public void Remove(BindingTemplate value)
  315. {
  316. List.Remove(value);
  317. }
  318. public void CopyTo(BindingTemplate[] array, int index)
  319. {
  320. List.CopyTo(array, index);
  321. }
  322. public new BindingTemplateEnumerator GetEnumerator()
  323. {
  324. return new BindingTemplateEnumerator( List.GetEnumerator() );
  325. }
  326. }
  327. public sealed class BindingTemplateEnumerator : IEnumerator
  328. {
  329. private IEnumerator enumerator;
  330. public BindingTemplateEnumerator( IEnumerator enumerator )
  331. {
  332. this.enumerator = enumerator;
  333. }
  334. public BindingTemplate Current
  335. {
  336. get { return ( BindingTemplate ) enumerator.Current; }
  337. }
  338. object IEnumerator.Current
  339. {
  340. get{ return enumerator.Current; }
  341. }
  342. public bool MoveNext()
  343. {
  344. return enumerator.MoveNext();
  345. }
  346. public void Reset()
  347. {
  348. enumerator.Reset();
  349. }
  350. }
  351. }