1. /*
  2. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package javax.ejb.spi;
  6. import java.io.IOException;
  7. import java.io.ObjectOutputStream;
  8. import java.io.ObjectInputStream;
  9. import javax.ejb.EJBObject;
  10. import javax.ejb.EJBHome;
  11. /**
  12. * The HandleDelegate interface is implemented by the EJB container.
  13. * It is used by portable implementations of javax.ejb.Handle and
  14. * javax.ejb.HomeHandle.
  15. * It is not used by EJB components or by client components.
  16. * It provides methods to serialize and deserialize EJBObject and
  17. * EJBHome references to streams.
  18. *
  19. * <p> The HandleDelegate object is obtained by JNDI lookup at the
  20. * reserved name "java:comp/HandleDelegate".
  21. */
  22. public interface HandleDelegate {
  23. /**
  24. * Serialize the EJBObject reference corresponding to a Handle.
  25. *
  26. * <p> This method is called from the writeObject method of
  27. * portable Handle implementation classes. The ostream object is the
  28. * same object that was passed in to the Handle class's writeObject.
  29. *
  30. * @param ejbObject The EJBObject reference to be serialized.
  31. *
  32. * @param ostream The output stream.
  33. *
  34. * @exception IOException The EJBObject could not be serialized
  35. * because of a system-level failure.
  36. */
  37. public void writeEJBObject(EJBObject ejbObject, ObjectOutputStream ostream)
  38. throws IOException;
  39. /**
  40. * Deserialize the EJBObject reference corresponding to a Handle.
  41. *
  42. * <p> readEJBObject is called from the readObject method of
  43. * portable Handle implementation classes. The istream object is the
  44. * same object that was passed in to the Handle class's readObject.
  45. * When readEJBObject is called, istream must point to the location
  46. * in the stream at which the EJBObject reference can be read.
  47. * The container must ensure that the EJBObject reference is
  48. * capable of performing invocations immediately after deserialization.
  49. *
  50. * @param istream The input stream.
  51. *
  52. * @return The deserialized EJBObject reference.
  53. *
  54. * @exception IOException The EJBObject could not be deserialized
  55. * because of a system-level failure.
  56. * @exception ClassNotFoundException The EJBObject could not be deserialized
  57. * because some class could not be found.
  58. */
  59. public javax.ejb.EJBObject readEJBObject(ObjectInputStream istream)
  60. throws IOException, ClassNotFoundException;
  61. /**
  62. * Serialize the EJBHome reference corresponding to a HomeHandle.
  63. *
  64. * <p> This method is called from the writeObject method of
  65. * portable HomeHandle implementation classes. The ostream object is the
  66. * same object that was passed in to the Handle class's writeObject.
  67. *
  68. * @param ejbHome The EJBHome reference to be serialized.
  69. *
  70. * @param ostream The output stream.
  71. *
  72. * @exception IOException The EJBObject could not be serialized
  73. * because of a system-level failure.
  74. */
  75. public void writeEJBHome(EJBHome ejbHome, ObjectOutputStream ostream)
  76. throws IOException;
  77. /**
  78. * Deserialize the EJBHome reference corresponding to a HomeHandle.
  79. *
  80. * <p> readEJBHome is called from the readObject method of
  81. * portable HomeHandle implementation classes. The istream object is the
  82. * same object that was passed in to the HomeHandle class's readObject.
  83. * When readEJBHome is called, istream must point to the location
  84. * in the stream at which the EJBHome reference can be read.
  85. * The container must ensure that the EJBHome reference is
  86. * capable of performing invocations immediately after deserialization.
  87. *
  88. * @param istream The input stream.
  89. *
  90. * @return The deserialized EJBHome reference.
  91. *
  92. * @exception IOException The EJBHome could not be deserialized
  93. * because of a system-level failure.
  94. * @exception ClassNotFoundException The EJBHome could not be deserialized
  95. * because some class could not be found.
  96. */
  97. public javax.ejb.EJBHome readEJBHome(ObjectInputStream istream)
  98. throws IOException, ClassNotFoundException;
  99. }