1. package org.omg.IOP;
  2. /**
  3. * org/omg/IOP/ServiceContextHelper.java .
  4. * Generated by the IDL-to-Java compiler (portable), version "3.1"
  5. * from ../../../../src/share/classes/org/omg/PortableInterceptor/IOP.idl
  6. * Monday, February 23, 2004 7:03:03 AM GMT
  7. */
  8. /**
  9. * Service-specific information to be passed implicitly with requests
  10. * and replies. Service contexts are composed of service ids and
  11. * associated data.
  12. */
  13. abstract public class ServiceContextHelper
  14. {
  15. private static String _id = "IDL:omg.org/IOP/ServiceContext:1.0";
  16. public static void insert (org.omg.CORBA.Any a, org.omg.IOP.ServiceContext that)
  17. {
  18. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  19. a.type (type ());
  20. write (out, that);
  21. a.read_value (out.create_input_stream (), type ());
  22. }
  23. public static org.omg.IOP.ServiceContext extract (org.omg.CORBA.Any a)
  24. {
  25. return read (a.create_input_stream ());
  26. }
  27. private static org.omg.CORBA.TypeCode __typeCode = null;
  28. private static boolean __active = false;
  29. synchronized public static org.omg.CORBA.TypeCode type ()
  30. {
  31. if (__typeCode == null)
  32. {
  33. synchronized (org.omg.CORBA.TypeCode.class)
  34. {
  35. if (__typeCode == null)
  36. {
  37. if (__active)
  38. {
  39. return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
  40. }
  41. __active = true;
  42. org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [2];
  43. org.omg.CORBA.TypeCode _tcOf_members0 = null;
  44. _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong);
  45. _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.IOP.ServiceIdHelper.id (), "ServiceId", _tcOf_members0);
  46. _members0[0] = new org.omg.CORBA.StructMember (
  47. "context_id",
  48. _tcOf_members0,
  49. null);
  50. _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_octet);
  51. _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0);
  52. _members0[1] = new org.omg.CORBA.StructMember (
  53. "context_data",
  54. _tcOf_members0,
  55. null);
  56. __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.IOP.ServiceContextHelper.id (), "ServiceContext", _members0);
  57. __active = false;
  58. }
  59. }
  60. }
  61. return __typeCode;
  62. }
  63. public static String id ()
  64. {
  65. return _id;
  66. }
  67. public static org.omg.IOP.ServiceContext read (org.omg.CORBA.portable.InputStream istream)
  68. {
  69. org.omg.IOP.ServiceContext value = new org.omg.IOP.ServiceContext ();
  70. value.context_id = istream.read_ulong ();
  71. int _len0 = istream.read_long ();
  72. value.context_data = new byte[_len0];
  73. istream.read_octet_array (value.context_data, 0, _len0);
  74. return value;
  75. }
  76. public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.IOP.ServiceContext value)
  77. {
  78. ostream.write_ulong (value.context_id);
  79. ostream.write_long (value.context_data.length);
  80. ostream.write_octet_array (value.context_data, 0, value.context_data.length);
  81. }
  82. }