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.

80 lines
2.2 KiB

  1. using System;
  2. using System.Collections;
  3. using System.Xml.Serialization;
  4. using UDDI.API.Business;
  5. using UDDI.Replication;
  6. using UDDI.Diagnostics;
  7. namespace UDDI
  8. {
  9. //
  10. // This class caches all of the serializers that our API and replication uses.
  11. //
  12. public class XmlSerializerManager
  13. {
  14. private static Hashtable serializers;
  15. static XmlSerializerManager()
  16. {
  17. //
  18. // Pre-create all of our serializers
  19. //
  20. serializers = new Hashtable();
  21. Type type = typeof( ChangeRecordAcknowledgement );
  22. serializers.Add( type, new XmlSerializer( type ) ) ;
  23. type = typeof( ChangeRecordCorrection );
  24. serializers.Add( type, new XmlSerializer( type ) ) ;
  25. type = typeof( ChangeRecordCustodyTransfer );
  26. serializers.Add( type, new XmlSerializer( type ) ) ;
  27. type = typeof( ChangeRecordDelete );
  28. serializers.Add( type, new XmlSerializer( type ) ) ;
  29. type = typeof( ChangeRecordDeleteAssertion );
  30. serializers.Add( type, new XmlSerializer( type ) ) ;
  31. type = typeof( ChangeRecordHide );
  32. serializers.Add( type, new XmlSerializer( type ) ) ;
  33. type = typeof( ChangeRecordNewData );
  34. serializers.Add( type, new XmlSerializer( type ) ) ;
  35. type = typeof( ChangeRecordNull );
  36. serializers.Add( type, new XmlSerializer( type ) ) ;
  37. type = typeof( ChangeRecordPublisherAssertion );
  38. serializers.Add( type, new XmlSerializer( type ) ) ;
  39. type = typeof( ChangeRecordSetAssertions );
  40. serializers.Add( type, new XmlSerializer( type ) ) ;
  41. type = typeof( BusinessEntity );
  42. serializers.Add( type, new XmlSerializer( type ) ) ;
  43. type = typeof( UserInfo );
  44. serializers.Add( type, new XmlSerializer( type ) ) ;
  45. type = typeof( UDDI.API.DispositionReport );
  46. serializers.Add( type, new XmlSerializer( type ) ) ;
  47. }
  48. static public XmlSerializer GetSerializer( Type type )
  49. {
  50. XmlSerializer serializer = ( XmlSerializer )serializers[ type ];
  51. if( null == serializer )
  52. {
  53. Debug.Write( SeverityType.Warning, CategoryType.None, "No serializer for type: " + type.FullName );
  54. serializer = new XmlSerializer( type );
  55. serializers[ type ] = serializer;
  56. }
  57. return serializer;
  58. }
  59. }
  60. }