1. /*
  2. * @(#)CurrentHelper.java 1.4 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package org.omg.PortableServer;
  8. /**
  9. * org/omg/PortableServer/CurrentHelper.java .
  10. * Generated by the IDL-to-Java compiler (portable), version "3.1"
  11. * from ../../../../src/share/classes/org/omg/PortableServer/poa.idl
  12. * Tuesday, October 23, 2001 1:17:01 PM PDT
  13. */
  14. /**
  15. * The PortableServer::Current interface, derived from
  16. * CORBA::Current, provides method implementations with
  17. * access to the identity of the object on which the
  18. * method was invoked. The Current interface is provided
  19. * to support servants that implement multiple objects,
  20. * but can be used within the context of POA-dispatched
  21. * method invocations on any servant. To provide location
  22. * transparency, ORBs are required to support use of
  23. * Current in the context of both locally and remotely
  24. * invoked operations. An instance of Current can be
  25. * obtained by the application by issuing the
  26. * CORBA::ORB::resolve_initial_references("POACurrent")
  27. * operation. Thereafter, it can be used within the
  28. * context of a method dispatched by the POA to obtain
  29. * the POA and ObjectId that identify the object on
  30. * which that operation was invoked.
  31. */
  32. abstract public class CurrentHelper
  33. {
  34. private static String _id = "IDL:omg.org/PortableServer/Current:2.3";
  35. public static void insert (org.omg.CORBA.Any a,
  36. org.omg.PortableServer.Current that)
  37. {
  38. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  39. a.type (type ());
  40. write (out, that);
  41. a.read_value (out.create_input_stream (), type ());
  42. }
  43. public static org.omg.PortableServer.Current extract (org.omg.CORBA.Any a)
  44. {
  45. return read (a.create_input_stream ());
  46. }
  47. private static org.omg.CORBA.TypeCode __typeCode = null;
  48. synchronized public static org.omg.CORBA.TypeCode type ()
  49. {
  50. if (__typeCode == null)
  51. {
  52. __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (
  53. org.omg.PortableServer.CurrentHelper.id (), "Current");
  54. }
  55. return __typeCode;
  56. }
  57. public static String id ()
  58. {
  59. return _id;
  60. }
  61. public static org.omg.PortableServer.Current read (
  62. org.omg.CORBA.portable.InputStream istream)
  63. {
  64. throw new org.omg.CORBA.MARSHAL ();
  65. }
  66. public static void write (org.omg.CORBA.portable.OutputStream ostream,
  67. org.omg.PortableServer.Current value)
  68. {
  69. throw new org.omg.CORBA.MARSHAL ();
  70. }
  71. public static org.omg.PortableServer.Current narrow (
  72. org.omg.CORBA.Object obj)
  73. {
  74. if (obj == null)
  75. return null;
  76. else if (obj instanceof org.omg.PortableServer.Current)
  77. return (org.omg.PortableServer.Current)obj;
  78. else if (!obj._is_a (id ()))
  79. throw new org.omg.CORBA.BAD_PARAM ();
  80. return null;
  81. }
  82. }