1. package org.omg.PortableServer;
  2. /**
  3. * org/omg/PortableServer/ServantLocatorHelper.java .
  4. * Generated by the IDL-to-Java compiler (portable), version "3.1"
  5. * from ../../../../src/share/classes/org/omg/PortableServer/poa.idl
  6. * Monday, February 23, 2004 7:03:02 AM GMT
  7. */
  8. /**
  9. * When the POA has the NON_RETAIN policy it uses servant
  10. * managers that are ServantLocators. Because the POA
  11. * knows that the servant returned by this servant
  12. * manager will be used only for a single request,
  13. * it can supply extra information to the servant
  14. * manager's operations and the servant manager's pair
  15. * of operations may be able to cooperate to do
  16. * something different than a ServantActivator.
  17. * When the POA uses the ServantLocator interface,
  18. * immediately after performing the operation invocation
  19. * on the servant returned by preinvoke, the POA will
  20. * invoke postinvoke on the servant manager, passing the
  21. * ObjectId value and the Servant value as parameters
  22. * (among others). This feature may be used to force
  23. * every request for objects associated with a POA to
  24. * be mediated by the servant manager.
  25. */
  26. abstract public class ServantLocatorHelper
  27. {
  28. private static String _id = "IDL:omg.org/PortableServer/ServantLocator:1.0";
  29. public static void insert (org.omg.CORBA.Any a, org.omg.PortableServer.ServantLocator that)
  30. {
  31. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  32. a.type (type ());
  33. write (out, that);
  34. a.read_value (out.create_input_stream (), type ());
  35. }
  36. public static org.omg.PortableServer.ServantLocator extract (org.omg.CORBA.Any a)
  37. {
  38. return read (a.create_input_stream ());
  39. }
  40. private static org.omg.CORBA.TypeCode __typeCode = null;
  41. synchronized public static org.omg.CORBA.TypeCode type ()
  42. {
  43. if (__typeCode == null)
  44. {
  45. __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.PortableServer.ServantLocatorHelper.id (), "ServantLocator");
  46. }
  47. return __typeCode;
  48. }
  49. public static String id ()
  50. {
  51. return _id;
  52. }
  53. public static org.omg.PortableServer.ServantLocator read (org.omg.CORBA.portable.InputStream istream)
  54. {
  55. throw new org.omg.CORBA.MARSHAL ();
  56. }
  57. public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.PortableServer.ServantLocator value)
  58. {
  59. throw new org.omg.CORBA.MARSHAL ();
  60. }
  61. public static org.omg.PortableServer.ServantLocator narrow (org.omg.CORBA.Object obj)
  62. {
  63. if (obj == null)
  64. return null;
  65. else if (obj instanceof org.omg.PortableServer.ServantLocator)
  66. return (org.omg.PortableServer.ServantLocator)obj;
  67. else if (!obj._is_a (id ()))
  68. throw new org.omg.CORBA.BAD_PARAM ();
  69. else
  70. {
  71. org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
  72. org.omg.PortableServer._ServantLocatorStub stub = new org.omg.PortableServer._ServantLocatorStub ();
  73. stub._set_delegate(delegate);
  74. return stub;
  75. }
  76. }
  77. }