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.

578 lines
11 KiB

  1. using System;
  2. using System.Web;
  3. using System.IO;
  4. using System.Xml;
  5. using System.Xml.Schema;
  6. using System.Collections;
  7. using System.Data.SqlClient;
  8. using System.Xml.Serialization;
  9. using Microsoft.Uddi;
  10. using Microsoft.Uddi.Business;
  11. using Microsoft.Uddi.ServiceType;
  12. using Microsoft.Uddi.Service;
  13. using Microsoft.Uddi.Binding;
  14. using Microsoft.Uddi.VersionSupport;
  15. namespace Microsoft.Uddi.Extensions
  16. {
  17. public enum RelationshipQualifier
  18. {
  19. root = 1,
  20. parent = 2,
  21. child = 3
  22. }
  23. [XmlRoot( "get_relatedCategories", Namespace=Microsoft.Uddi.Extensions.Namespaces.GetRelatedCategories)]
  24. public class GetRelatedCategories : UddiCore
  25. {
  26. private CategoryCollection categories;
  27. [XmlElement("category")]
  28. public CategoryCollection Categories
  29. {
  30. get
  31. {
  32. if( true == SerializeMode &&
  33. true == Utility.CollectionEmpty( categories ) )
  34. {
  35. return null;
  36. }
  37. if( null == categories )
  38. {
  39. categories = new CategoryCollection();
  40. }
  41. return categories;
  42. }
  43. set
  44. {
  45. categories = value;
  46. }
  47. }
  48. }
  49. [XmlRoot( "categoryList", Namespace=Microsoft.Uddi.Extensions.Namespaces.GetRelatedCategories)]
  50. public class CategoryList : UddiCore
  51. {
  52. private bool truncated;
  53. private string operatorValue;
  54. private CategoryInfoCollection categoryInfos;
  55. public CategoryList()
  56. {
  57. truncated = false;
  58. }
  59. [XmlAttribute( "truncated" )]
  60. public bool Truncated
  61. {
  62. get { return truncated; }
  63. set { truncated = value; }
  64. }
  65. [XmlAttribute( "operator" )]
  66. public string Operator
  67. {
  68. get { return operatorValue; }
  69. set { operatorValue = value; }
  70. }
  71. [XmlElement( "categoryInfo" )]
  72. public CategoryInfoCollection CategoryInfosSerialize
  73. {
  74. get
  75. {
  76. if( null == categoryInfos )
  77. {
  78. categoryInfos = new CategoryInfoCollection();
  79. }
  80. return categoryInfos;
  81. }
  82. set { categoryInfos = value; }
  83. }
  84. }
  85. [XmlRoot("category", Namespace=Microsoft.Uddi.Extensions.Namespaces.GetRelatedCategories)]
  86. public class CategoryInfo : CategoryValue
  87. {
  88. private CategoryValueCollection roots;
  89. private CategoryValueCollection parents;
  90. private CategoryValueCollection children;
  91. public CategoryInfo()
  92. {}
  93. public CategoryInfo( string tmodelkey, string keyvalue ) : base( tmodelkey, keyvalue )
  94. {}
  95. [XmlArray( "rootRelationship" ), XmlArrayItem( "categoryValue" )]
  96. public CategoryValueCollection Roots
  97. {
  98. get
  99. {
  100. if( null == roots )
  101. {
  102. roots = new CategoryValueCollection();
  103. }
  104. return roots;
  105. }
  106. set { roots = value; }
  107. }
  108. [XmlArray( "parentRelationship" ), XmlArrayItem( "categoryValue" )]
  109. public CategoryValueCollection Parents
  110. {
  111. get
  112. {
  113. if( null == parents )
  114. {
  115. parents = new CategoryValueCollection();
  116. }
  117. return parents;
  118. }
  119. set { parents = value; }
  120. }
  121. [XmlArray( "childRelationship" ), XmlArrayItem( "categoryValue" )]
  122. public CategoryValueCollection Children
  123. {
  124. get
  125. {
  126. if( null == children )
  127. {
  128. children = new CategoryValueCollection();
  129. }
  130. return children;
  131. }
  132. set { children = value; }
  133. }
  134. }
  135. [XmlInclude( typeof( CategoryInfo ) )]
  136. public class CategoryValue : UddiCore
  137. {
  138. private bool isValid;
  139. private string tModelKey;
  140. private string keyName;
  141. private string keyValue;
  142. private string parentKeyValue;
  143. public CategoryValue()
  144. {}
  145. public CategoryValue( string tModelKey, string keyValue )
  146. {
  147. TModelKey = tModelKey;
  148. KeyValue = keyValue;
  149. }
  150. public CategoryValue( string keyName, string keyValue, string parentKeyValue, bool isValid )
  151. {
  152. KeyName = keyName;
  153. KeyValue = keyValue;
  154. ParentKeyValue = parentKeyValue;
  155. IsValid = isValid;
  156. }
  157. [XmlAttribute( "tModelKey" )]
  158. public string TModelKey
  159. {
  160. get { return tModelKey; }
  161. set { tModelKey = value; }
  162. }
  163. [XmlAttribute( "keyName" )]
  164. public string KeyName
  165. {
  166. get { return keyName; }
  167. set { keyName = value; }
  168. }
  169. [XmlAttribute( "keyValue" )]
  170. public string KeyValue
  171. {
  172. get { return keyValue; }
  173. set { keyValue = value; }
  174. }
  175. [XmlAttribute( "parentKeyValue" )]
  176. public string ParentKeyValue
  177. {
  178. get { return parentKeyValue; }
  179. set { parentKeyValue = value; }
  180. }
  181. [XmlAttribute( "isValid" )]
  182. public bool IsValid
  183. {
  184. get { return isValid; }
  185. set { isValid = value; }
  186. }
  187. }
  188. public class Category : UddiCore
  189. {
  190. private string tModelKey;
  191. private string keyValue;
  192. private RelationshipQualifierCollection relationshipQualifiers;
  193. [XmlElement( "relationshipQualifier" )]
  194. public RelationshipQualifierCollection RelationshipQualifiers
  195. {
  196. get
  197. {
  198. if( true == SerializeMode &&
  199. true == Utility.CollectionEmpty( relationshipQualifiers ) )
  200. {
  201. return null;
  202. }
  203. if( null == relationshipQualifiers )
  204. {
  205. relationshipQualifiers = new RelationshipQualifierCollection();
  206. }
  207. return relationshipQualifiers;
  208. }
  209. set { relationshipQualifiers = value; }
  210. }
  211. [XmlAttribute( "tModelKey" )]
  212. public string TModelKey
  213. {
  214. get { return tModelKey; }
  215. set { tModelKey = value; }
  216. }
  217. [XmlAttribute( "keyValue" )]
  218. public string KeyValue
  219. {
  220. get { return keyValue; }
  221. set { keyValue = value; }
  222. }
  223. }
  224. public class RelationshipQualifierCollection : CollectionBase
  225. {
  226. public RelationshipQualifierCollection()
  227. {}
  228. public RelationshipQualifier this[int index]
  229. {
  230. get { return (RelationshipQualifier)List[index]; }
  231. set { List[index] = value; }
  232. }
  233. public int Add( RelationshipQualifier relationshipQualifier )
  234. {
  235. return List.Add( relationshipQualifier );
  236. }
  237. public void Insert( int index, CategoryValue value )
  238. {
  239. List.Insert(index, value);
  240. }
  241. public int IndexOf( RelationshipQualifier value )
  242. {
  243. return List.IndexOf( value );
  244. }
  245. public bool Contains( RelationshipQualifier value )
  246. {
  247. return List.Contains( value );
  248. }
  249. public void Remove( RelationshipQualifier value )
  250. {
  251. List.Remove( value );
  252. }
  253. public void CopyTo(RelationshipQualifier[] array, int index)
  254. {
  255. List.CopyTo( array, index );
  256. }
  257. public new RelationshipQualifierEnumerator GetEnumerator()
  258. {
  259. return new RelationshipQualifierEnumerator( List.GetEnumerator() );
  260. }
  261. }
  262. public sealed class RelationshipQualifierEnumerator : IEnumerator
  263. {
  264. private IEnumerator enumerator;
  265. public RelationshipQualifierEnumerator( IEnumerator enumerator )
  266. {
  267. this.enumerator = enumerator;
  268. }
  269. public RelationshipQualifier Current
  270. {
  271. get { return ( RelationshipQualifier ) enumerator.Current; }
  272. }
  273. object IEnumerator.Current
  274. {
  275. get{ return enumerator.Current; }
  276. }
  277. public bool MoveNext()
  278. {
  279. return enumerator.MoveNext();
  280. }
  281. public void Reset()
  282. {
  283. enumerator.Reset();
  284. }
  285. }
  286. public class CategoryValueCollection : CollectionBase
  287. {
  288. public CategoryValueCollection()
  289. {}
  290. public CategoryValue this[int index]
  291. {
  292. get { return (CategoryValue)List[index]; }
  293. set { List[index] = value; }
  294. }
  295. public int Add( string keyname, string keyvalue, string parent, bool isvalid )
  296. {
  297. return List.Add( new CategoryValue( keyname, keyvalue, parent, isvalid ) );
  298. }
  299. public int Add(CategoryValue value)
  300. {
  301. return List.Add(value);
  302. }
  303. public void Insert(int index, CategoryValue value)
  304. {
  305. List.Insert(index, value);
  306. }
  307. public int IndexOf( CategoryValue value )
  308. {
  309. return List.IndexOf( value );
  310. }
  311. public bool Contains( CategoryValue value )
  312. {
  313. return List.Contains( value );
  314. }
  315. public void Remove( CategoryValue value )
  316. {
  317. List.Remove( value );
  318. }
  319. public void CopyTo(CategoryValue[] array, int index)
  320. {
  321. List.CopyTo( array, index );
  322. }
  323. public new CategoryValueEnumerator GetEnumerator()
  324. {
  325. return new CategoryValueEnumerator( List.GetEnumerator() );
  326. }
  327. }
  328. public sealed class CategoryValueEnumerator : IEnumerator
  329. {
  330. private IEnumerator enumerator;
  331. public CategoryValueEnumerator( IEnumerator enumerator )
  332. {
  333. this.enumerator = enumerator;
  334. }
  335. public CategoryValue Current
  336. {
  337. get { return ( CategoryValue ) enumerator.Current; }
  338. }
  339. object IEnumerator.Current
  340. {
  341. get{ return enumerator.Current; }
  342. }
  343. public bool MoveNext()
  344. {
  345. return enumerator.MoveNext();
  346. }
  347. public void Reset()
  348. {
  349. enumerator.Reset();
  350. }
  351. }
  352. public class CategoryCollection : CollectionBase
  353. {
  354. public CategoryCollection()
  355. {}
  356. public Category this[int index]
  357. {
  358. get { return (Category)List[index]; }
  359. set { List[index] = value; }
  360. }
  361. public int Add(Category value)
  362. {
  363. return List.Add(value);
  364. }
  365. public void Insert(int index, Category value)
  366. {
  367. List.Insert(index, value);
  368. }
  369. public int IndexOf( Category value )
  370. {
  371. return List.IndexOf( value );
  372. }
  373. public bool Contains( Category value )
  374. {
  375. return List.Contains( value );
  376. }
  377. public void Remove( Category value )
  378. {
  379. List.Remove( value );
  380. }
  381. public void CopyTo(Category[] array, int index)
  382. {
  383. List.CopyTo( array, index );
  384. }
  385. public new CategoryEnumerator GetEnumerator()
  386. {
  387. return new CategoryEnumerator( List.GetEnumerator() );
  388. }
  389. }
  390. public sealed class CategoryEnumerator : IEnumerator
  391. {
  392. private IEnumerator enumerator;
  393. public CategoryEnumerator( IEnumerator enumerator )
  394. {
  395. this.enumerator = enumerator;
  396. }
  397. public Category Current
  398. {
  399. get { return ( Category ) enumerator.Current; }
  400. }
  401. object IEnumerator.Current
  402. {
  403. get{ return enumerator.Current; }
  404. }
  405. public bool MoveNext()
  406. {
  407. return enumerator.MoveNext();
  408. }
  409. public void Reset()
  410. {
  411. enumerator.Reset();
  412. }
  413. }
  414. public class CategoryInfoCollection : CollectionBase
  415. {
  416. public CategoryInfoCollection()
  417. {}
  418. public CategoryInfo this[int index]
  419. {
  420. get { return (CategoryInfo)List[index]; }
  421. set { List[index] = value; }
  422. }
  423. public int Add(CategoryInfo value)
  424. {
  425. return List.Add(value);
  426. }
  427. public void Insert(int index, CategoryInfo value)
  428. {
  429. List.Insert(index, value);
  430. }
  431. public int IndexOf( CategoryInfo value )
  432. {
  433. return List.IndexOf( value );
  434. }
  435. public bool Contains( CategoryInfo value )
  436. {
  437. return List.Contains( value );
  438. }
  439. public void Remove( CategoryInfo value )
  440. {
  441. List.Remove( value );
  442. }
  443. public void CopyTo(CategoryInfo[] array, int index)
  444. {
  445. List.CopyTo( array, index );
  446. }
  447. public CategoryInfo[] ToArray()
  448. {
  449. return (CategoryInfo[]) InnerList.ToArray( typeof( CategoryInfo ) );
  450. }
  451. public new CategoryInfoEnumerator GetEnumerator()
  452. {
  453. return new CategoryInfoEnumerator( List.GetEnumerator() );
  454. }
  455. }
  456. public sealed class CategoryInfoEnumerator : IEnumerator
  457. {
  458. private IEnumerator enumerator;
  459. public CategoryInfoEnumerator( IEnumerator enumerator )
  460. {
  461. this.enumerator = enumerator;
  462. }
  463. public CategoryInfo Current
  464. {
  465. get { return ( CategoryInfo ) 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. }