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;
  6. import java.util.*;
  7. import java.security.Identity;
  8. /**
  9. * The SessionContext interface provides access to the runtime session context
  10. * that the container provides for a session enterprise Bean instance. The
  11. * container passes the SessionContext interface to an instance after the
  12. * instance has been created. The session context remains associated with
  13. * the instance for the lifetime of the instance.
  14. */
  15. public interface SessionContext extends EJBContext
  16. {
  17. /**
  18. * Obtain a reference to the EJB local object that is currently
  19. * associated with the instance.
  20. *
  21. * <p> An instance of an entity enterprise Bean can call this method only
  22. * when the instance is associated with an EJB local object identity, i.e.
  23. * in the ejbActivate, ejbPassivate, ejbPostCreate, ejbRemove,
  24. * ejbLoad, ejbStore, and business methods.
  25. *
  26. * <p> An instance can use this method, for example, when it wants to
  27. * pass a reference to itself in a method argument or result.
  28. *
  29. * @return The EJB local object currently associated with the instance.
  30. *
  31. * @exception IllegalStateException Thrown if the instance invokes this
  32. * method while the instance is in a state that does not allow the
  33. * instance to invoke this method, or if the instance does not have
  34. * a local interface.
  35. */
  36. EJBLocalObject getEJBLocalObject() throws IllegalStateException;
  37. /**
  38. * Obtain a reference to the EJB object that is currently associated with
  39. * the instance.
  40. *
  41. * <p> An instance of a session enterprise Bean can call this method
  42. * at anytime between the ejbCreate() and ejbRemove() methods, including
  43. * from within the ejbCreate() and ejbRemove() methods.
  44. *
  45. * <p> An instance can use this method, for example, when it wants to
  46. * pass a reference to itself in a method argument or result.
  47. *
  48. * @return The EJB object currently associated with the instance.
  49. *
  50. * @exception IllegalStateException Thrown if the instance invokes this
  51. * method while the instance is in a state that does not allow the
  52. * instance to invoke this method, or if the instance does not have
  53. * a remote interface.
  54. */
  55. EJBObject getEJBObject() throws IllegalStateException;
  56. }