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.

577 lines
12 KiB

  1. using System;
  2. using System.Collections;
  3. using System.Collections.Specialized;
  4. using System.Diagnostics;
  5. using System.ComponentModel;
  6. using System.Xml.Serialization;
  7. using Microsoft.Uddi;
  8. using Microsoft.Uddi.Binding;
  9. using Microsoft.Uddi.Service;
  10. using Microsoft.Uddi.ServiceType;
  11. namespace Microsoft.Uddi.Service
  12. {
  13. [XmlRootAttribute("delete_service", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  14. public class DeleteService : UddiSecureMessage
  15. {
  16. private StringCollection serviceKeys;
  17. [XmlElement("serviceKey")]
  18. public StringCollection ServiceKeys
  19. {
  20. get
  21. {
  22. if( null == serviceKeys )
  23. {
  24. serviceKeys = new StringCollection();
  25. }
  26. return serviceKeys;
  27. }
  28. set { serviceKeys = value; }
  29. }
  30. }
  31. [XmlRootAttribute("find_service", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  32. public class FindService : UddiQueryMessage
  33. {
  34. private string businessKey;
  35. private NameCollection names;
  36. private KeyedReferenceCollection categoryBag;
  37. private StringCollection tModelKeys;
  38. [XmlAttribute("businessKey")]
  39. public string BusinessKey
  40. {
  41. get { return businessKey; }
  42. set { businessKey = value; }
  43. }
  44. [XmlElement("name")]
  45. public NameCollection Names
  46. {
  47. get
  48. {
  49. if( null == names )
  50. {
  51. names = new NameCollection();
  52. }
  53. return names;
  54. }
  55. set { names = value; }
  56. }
  57. [XmlArray("categoryBag"), XmlArrayItem("keyedReference")]
  58. public KeyedReferenceCollection CategoryBag
  59. {
  60. get
  61. {
  62. if( true == SerializeMode &&
  63. true == Utility.CollectionEmpty( categoryBag ) )
  64. {
  65. return null;
  66. }
  67. if( null == categoryBag )
  68. {
  69. categoryBag = new KeyedReferenceCollection();
  70. }
  71. return categoryBag;
  72. }
  73. set { categoryBag = value; }
  74. }
  75. [XmlArray("tModelBag"), XmlArrayItem("tModelKey")]
  76. public StringCollection TModelKeys
  77. {
  78. get
  79. {
  80. if( true == SerializeMode &&
  81. true == Utility.CollectionEmpty( tModelKeys ) )
  82. {
  83. return null;
  84. }
  85. if( null == tModelKeys )
  86. {
  87. tModelKeys = new StringCollection();
  88. }
  89. return tModelKeys;
  90. }
  91. set { tModelKeys = value; }
  92. }
  93. }
  94. [XmlRootAttribute("get_serviceDetail", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  95. public class GetServiceDetail : UddiMessage
  96. {
  97. private StringCollection serviceKeys;
  98. [XmlElement("serviceKey")]
  99. public StringCollection ServiceKeys
  100. {
  101. get
  102. {
  103. if( null == serviceKeys )
  104. {
  105. serviceKeys = new StringCollection();
  106. }
  107. return serviceKeys;
  108. }
  109. set { serviceKeys = value; }
  110. }
  111. }
  112. [XmlRootAttribute("save_service", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  113. public class SaveService : UddiSecureMessage
  114. {
  115. private BusinessServiceCollection businessServices;
  116. [XmlElement("businessService")]
  117. public BusinessServiceCollection BusinessServices
  118. {
  119. get
  120. {
  121. if( null == businessServices )
  122. {
  123. businessServices = new BusinessServiceCollection();
  124. }
  125. return businessServices;
  126. }
  127. set { businessServices = value; }
  128. }
  129. public override bool SerializeMode
  130. {
  131. get { return base.SerializeMode; }
  132. set
  133. {
  134. if( false == Utility.CollectionEmpty( businessServices ) )
  135. {
  136. foreach( BusinessService service in businessServices )
  137. {
  138. service.SerializeMode = value;
  139. }
  140. }
  141. base.SerializeMode = value;
  142. }
  143. }
  144. }
  145. [XmlRootAttribute("serviceDetail", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  146. public class ServiceDetail : UddiCore
  147. {
  148. private string node;
  149. private bool truncated;
  150. private BusinessServiceCollection businessServices;
  151. [XmlAttribute("operator")]
  152. public string Operator
  153. {
  154. get { return node; }
  155. set { node = value; }
  156. }
  157. [XmlAttribute("truncated")]
  158. public bool Truncated
  159. {
  160. get { return truncated; }
  161. set { truncated = value; }
  162. }
  163. [XmlElement("businessService")]
  164. public BusinessServiceCollection BusinessServices
  165. {
  166. get
  167. {
  168. if( null == businessServices )
  169. {
  170. businessServices = new BusinessServiceCollection();
  171. }
  172. return businessServices;
  173. }
  174. set { businessServices = value; }
  175. }
  176. }
  177. [XmlRootAttribute("serviceList", Namespace=Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace)]
  178. public class ServiceList : UddiCore
  179. {
  180. private string node;
  181. private bool truncated;
  182. private ServiceInfoCollection serviceInfos;
  183. [XmlAttribute("operator")]
  184. public string Operator
  185. {
  186. get { return node; }
  187. set { node = value; }
  188. }
  189. [XmlAttribute("truncated")]
  190. public bool Truncated
  191. {
  192. get { return truncated; }
  193. set { truncated = value; }
  194. }
  195. [XmlArray("serviceInfos"), XmlArrayItem("serviceInfo")]
  196. public ServiceInfoCollection ServiceInfos
  197. {
  198. get
  199. {
  200. if( null == serviceInfos )
  201. {
  202. serviceInfos = new ServiceInfoCollection();
  203. }
  204. return serviceInfos;
  205. }
  206. set { serviceInfos = value; }
  207. }
  208. }
  209. public class BusinessService : UddiCore
  210. {
  211. private string serviceKey;
  212. private string businessKey;
  213. private NameCollection names;
  214. private DescriptionCollection descriptions;
  215. private BindingTemplateCollection bindingTemplates;
  216. private KeyedReferenceCollection categoryBag;
  217. public BusinessService() : this( "", "" )
  218. {}
  219. public BusinessService( string businessKey ) : this( businessKey, "" )
  220. {}
  221. public BusinessService(string businessKey, string serviceKey )
  222. {
  223. BusinessKey = businessKey;
  224. ServiceKey = serviceKey;
  225. }
  226. [XmlAttribute("serviceKey")]
  227. public string ServiceKey
  228. {
  229. get { return serviceKey; }
  230. set { serviceKey = value; }
  231. }
  232. [XmlAttribute("businessKey")]
  233. public string BusinessKey
  234. {
  235. get { return businessKey; }
  236. set { businessKey = value; }
  237. }
  238. [XmlElement("name")]
  239. public NameCollection Names
  240. {
  241. get
  242. {
  243. if( null == names )
  244. {
  245. names = new NameCollection();
  246. }
  247. return names;
  248. }
  249. set { names = value; }
  250. }
  251. [XmlElement("description")]
  252. public DescriptionCollection Descriptions
  253. {
  254. get
  255. {
  256. if( true == SerializeMode &&
  257. true == Utility.CollectionEmpty( descriptions ) )
  258. {
  259. return null;
  260. }
  261. if( null == descriptions )
  262. {
  263. descriptions = new DescriptionCollection();
  264. }
  265. return descriptions;
  266. }
  267. set { descriptions = value; }
  268. }
  269. [XmlArray("bindingTemplates"), XmlArrayItem("bindingTemplate")]
  270. public BindingTemplateCollection BindingTemplates
  271. {
  272. get
  273. {
  274. if( null == bindingTemplates )
  275. {
  276. bindingTemplates = new BindingTemplateCollection();
  277. }
  278. return bindingTemplates;
  279. }
  280. set { bindingTemplates = value; }
  281. }
  282. [XmlArray("categoryBag"), XmlArrayItem("keyedReference")]
  283. public KeyedReferenceCollection CategoryBag
  284. {
  285. get
  286. {
  287. if( true == SerializeMode &&
  288. true == Utility.CollectionEmpty( categoryBag ) )
  289. {
  290. return null;
  291. }
  292. if( null == categoryBag )
  293. {
  294. categoryBag = new KeyedReferenceCollection();
  295. }
  296. return categoryBag;
  297. }
  298. set { categoryBag = value; }
  299. }
  300. public override bool SerializeMode
  301. {
  302. get { return base.SerializeMode; }
  303. set
  304. {
  305. if( false == Utility.CollectionEmpty( bindingTemplates ) )
  306. {
  307. foreach( BindingTemplate binding in bindingTemplates )
  308. {
  309. binding.SerializeMode = value;
  310. }
  311. }
  312. base.SerializeMode = value;
  313. }
  314. }
  315. }
  316. public class ServiceInfo : UddiCore
  317. {
  318. private string serviceKey;
  319. private string businessKey;
  320. private string name;
  321. public ServiceInfo()
  322. {}
  323. public ServiceInfo( string businessKey, string serviceKey, string name )
  324. {
  325. BusinessKey = businessKey;
  326. ServiceKey = serviceKey;
  327. Name = name;
  328. }
  329. [XmlAttribute("serviceKey")]
  330. public string ServiceKey
  331. {
  332. get { return serviceKey; }
  333. set { serviceKey = value; }
  334. }
  335. [XmlAttribute("businessKey")]
  336. public string BusinessKey
  337. {
  338. get { return businessKey; }
  339. set { businessKey = value; }
  340. }
  341. [XmlElement("name")]
  342. public string Name
  343. {
  344. get { return name; }
  345. set { name = value; }
  346. }
  347. }
  348. public class BusinessServiceCollection : CollectionBase
  349. {
  350. public BusinessService this[int index]
  351. {
  352. get { return (BusinessService)List[index]; }
  353. set { List[index] = value; }
  354. }
  355. public int Add(BusinessService businessService)
  356. {
  357. return List.Add(businessService);
  358. }
  359. public int Add( string businessKey )
  360. {
  361. return List.Add( new BusinessService( businessKey ) );
  362. }
  363. public int Add( string businessKey, string serviceKey )
  364. {
  365. return List.Add( new BusinessService( businessKey, serviceKey ) );
  366. }
  367. public void Insert(int index, BusinessService value)
  368. {
  369. List.Insert(index, value);
  370. }
  371. public int IndexOf(BusinessService value)
  372. {
  373. return List.IndexOf(value);
  374. }
  375. public bool Contains(BusinessService value)
  376. {
  377. return List.Contains(value);
  378. }
  379. public void Remove(BusinessService value)
  380. {
  381. List.Remove(value);
  382. }
  383. public void CopyTo(BusinessService[] array, int index)
  384. {
  385. List.CopyTo(array, index);
  386. }
  387. public new BusinessServiceEnumerator GetEnumerator()
  388. {
  389. return new BusinessServiceEnumerator( List.GetEnumerator() );
  390. }
  391. }
  392. public sealed class BusinessServiceEnumerator : IEnumerator
  393. {
  394. private IEnumerator enumerator;
  395. public BusinessServiceEnumerator( IEnumerator enumerator )
  396. {
  397. this.enumerator = enumerator;
  398. }
  399. public BusinessService Current
  400. {
  401. get { return ( BusinessService ) enumerator.Current; }
  402. }
  403. object IEnumerator.Current
  404. {
  405. get{ return enumerator.Current; }
  406. }
  407. public bool MoveNext()
  408. {
  409. return enumerator.MoveNext();
  410. }
  411. public void Reset()
  412. {
  413. enumerator.Reset();
  414. }
  415. }
  416. public class ServiceInfoCollection : CollectionBase
  417. {
  418. public ServiceInfo this[int index]
  419. {
  420. get { return (ServiceInfo)List[index]; }
  421. set { List[index] = value; }
  422. }
  423. public int Add( string businessKey, string serviceKey, string name )
  424. {
  425. return List.Add( new ServiceInfo( businessKey, serviceKey, name ) );
  426. }
  427. public int Add(ServiceInfo serviceInfo)
  428. {
  429. return List.Add(serviceInfo);
  430. }
  431. public void Insert(int index, ServiceInfo value)
  432. {
  433. List.Insert(index, value);
  434. }
  435. public int IndexOf(ServiceInfo value)
  436. {
  437. return List.IndexOf(value);
  438. }
  439. public bool Contains(ServiceInfo value)
  440. {
  441. return List.Contains(value);
  442. }
  443. public void Remove(ServiceInfo value)
  444. {
  445. List.Remove(value);
  446. }
  447. public void CopyTo(ServiceInfo[] array, int index)
  448. {
  449. List.CopyTo(array, index);
  450. }
  451. public new ServiceInfoEnumerator GetEnumerator()
  452. {
  453. return new ServiceInfoEnumerator( List.GetEnumerator() );
  454. }
  455. }
  456. public sealed class ServiceInfoEnumerator : IEnumerator
  457. {
  458. private IEnumerator enumerator;
  459. public ServiceInfoEnumerator( IEnumerator enumerator )
  460. {
  461. this.enumerator = enumerator;
  462. }
  463. public ServiceInfo Current
  464. {
  465. get { return ( ServiceInfo ) enumerator.Current; }
  466. }
  467. object IEnumerator.Current
  468. {
  469. get{ return enumerator.Current; }
  470. }
  471. public bool MoveNext()
  472. {
  473. return enumerator.MoveNext();
  474. }
  475. public void Reset()
  476. {
  477. enumerator.Reset();
  478. }
  479. }
  480. }