1. package org.omg.IOP;
  2. /**
  3. * org/omg/IOP/IORHelper.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. * Captures information about a object references, such as whether the
  10. * object is null, what type it is, what protocols are supported, and what
  11. * ORB services are available.
  12. * <p>
  13. * This data structure need not be used internally to any given ORB,
  14. * and is not intended to be visible to application-level ORB programmers.
  15. * It should be used only when crossing object reference domain
  16. * boundaries, within bridges.
  17. * <p>
  18. * This data structure is designed to be efficient in typical
  19. * single-protocol configurations, while not penalizing multiprotocol ones.
  20. * <p>
  21. * Object references have at least one tagged profile. Each profile
  22. * supports one or more protocols and encapsulates all the basic
  23. * information the protocols it supports need to identify an object.
  24. * Any single profile holds enough information to drive a complete
  25. * invocation using any of the protocols it supports; the content
  26. * and structure of those profile entries are wholly specified by
  27. * these protocols. A bridge between two domains may need to know the
  28. * detailed content of the profile for those domains' profiles,
  29. * depending on the technique it uses to bridge the domains.
  30. * <p>
  31. * Each profile has a unique numeric tag, assigned by the OMG.
  32. * Profile tags in the range 0x80000000 through 0xffffffff are reserved
  33. * for future use, and are not currently available for assignment.
  34. * <p>
  35. * Null object references are indicated by an empty set of profiles,
  36. * and by a "Null" type ID (a string which contains only a single
  37. * terminating character). A Null <code>TypeID</code> is the only
  38. * mechanism that can be used to represent the type
  39. * <code>CORBA.Object</code>. Type IDs may only be "Null" in any message,
  40. * requiring the client to use existing knowledge or to consult the
  41. * object, to determine interface types supported. The type ID
  42. * is a Repository ID identifying the interface type, and is provided
  43. * to allow ORBs to preserve strong typing. This identifier is agreed
  44. * on within the bridge and, for reasons outside the scope of the
  45. * interoperability specification, needs to have a much broader scope to
  46. * address various problems in system evolution and maintenance.
  47. * Type IDs support detection of type equivalence, and in conjunction
  48. * with an Interface Repository, allow processes to reason about the
  49. * relationship of the type of the object referred to and any other type.
  50. * <p>
  51. * The type ID, if provided by the server, indicates the most derived
  52. * type that the server wishes to publish, at the time the reference
  53. * is generated. The object's actual most derived type may later change
  54. * to a more derived type. Therefore, the type ID in the IOR can only
  55. * be interpreted by the client as a hint that the object supports at
  56. * least the indicated interface. The client can succeed in narrowing
  57. * the reference to the indicated interface, or to one of its base
  58. * interfaces, based solely on the type ID in the IOR, but must not fail
  59. * to narrow the reference without consulting the object via the
  60. * "_is_a" or "_get_interface" pseudo-operations.
  61. */
  62. abstract public class IORHelper
  63. {
  64. private static String _id = "IDL:omg.org/IOP/IOR:1.0";
  65. public static void insert (org.omg.CORBA.Any a, org.omg.IOP.IOR that)
  66. {
  67. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  68. a.type (type ());
  69. write (out, that);
  70. a.read_value (out.create_input_stream (), type ());
  71. }
  72. public static org.omg.IOP.IOR extract (org.omg.CORBA.Any a)
  73. {
  74. return read (a.create_input_stream ());
  75. }
  76. private static org.omg.CORBA.TypeCode __typeCode = null;
  77. private static boolean __active = false;
  78. synchronized public static org.omg.CORBA.TypeCode type ()
  79. {
  80. if (__typeCode == null)
  81. {
  82. synchronized (org.omg.CORBA.TypeCode.class)
  83. {
  84. if (__typeCode == null)
  85. {
  86. if (__active)
  87. {
  88. return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
  89. }
  90. __active = true;
  91. org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [2];
  92. org.omg.CORBA.TypeCode _tcOf_members0 = null;
  93. _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
  94. _members0[0] = new org.omg.CORBA.StructMember (
  95. "type_id",
  96. _tcOf_members0,
  97. null);
  98. _tcOf_members0 = org.omg.IOP.TaggedProfileHelper.type ();
  99. _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0);
  100. _members0[1] = new org.omg.CORBA.StructMember (
  101. "profiles",
  102. _tcOf_members0,
  103. null);
  104. __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.IOP.IORHelper.id (), "IOR", _members0);
  105. __active = false;
  106. }
  107. }
  108. }
  109. return __typeCode;
  110. }
  111. public static String id ()
  112. {
  113. return _id;
  114. }
  115. public static org.omg.IOP.IOR read (org.omg.CORBA.portable.InputStream istream)
  116. {
  117. org.omg.IOP.IOR value = new org.omg.IOP.IOR ();
  118. value.type_id = istream.read_string ();
  119. int _len0 = istream.read_long ();
  120. value.profiles = new org.omg.IOP.TaggedProfile[_len0];
  121. for (int _o1 = 0;_o1 < value.profiles.length; ++_o1)
  122. value.profiles[_o1] = org.omg.IOP.TaggedProfileHelper.read (istream);
  123. return value;
  124. }
  125. public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.IOP.IOR value)
  126. {
  127. ostream.write_string (value.type_id);
  128. ostream.write_long (value.profiles.length);
  129. for (int _i0 = 0;_i0 < value.profiles.length; ++_i0)
  130. org.omg.IOP.TaggedProfileHelper.write (ostream, value.profiles[_i0]);
  131. }
  132. }