KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > ejb > SessionContext


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: SessionContext.java 1100 2006-08-16 13:05:31Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package javax.ejb;
27
28 import javax.xml.rpc.handler.MessageContext JavaDoc;
29
30 /**
31  * Context provided by Session Bean.
32  * @see <a HREF="http://www.jcp.org/en/jsr/detail?id=220">EJB 3.0 specification</a>
33  * @author Florent Benoit
34  */

35 public interface SessionContext extends EJBContext JavaDoc {
36
37     /**
38      * Obtain a reference to the EJB local object that is associated with the
39      * instance. An instance of a session enterprise Bean can call this method
40      * at anytime between the ejbCreate() and ejbRemove() methods, including
41      * from within the ejbCreate() and ejbRemove() methods. An instance can use
42      * this method, for example, when it wants to pass a reference to itself in
43      * a method argument or result.
44      * @return The EJB local object currently associated with the instance.
45      * @throws IllegalStateException - Thrown if the instance invokes this
46      * method while the instance is in a state that does not allow the
47      * instance to invoke this method, or if the instance does not have
48      * a local interface.
49      */

50     EJBLocalObject JavaDoc getEJBLocalObject() throws IllegalStateException JavaDoc;
51
52     /**
53      * Obtain a reference to the EJB object that is currently associated with
54      * the instance. An instance of a session enterprise Bean can call this
55      * method at anytime between the ejbCreate() and ejbRemove() methods,
56      * including from within the ejbCreate() and ejbRemove() methods. An
57      * instance can use this method, for example, when it wants to pass a
58      * reference to itself in a method argument or result.
59      * @return The EJB object currently associated with the instance.
60      * @throws IllegalStateException - Thrown if the instance invokes this
61      * method while the instance is in a state that does not allow the
62      * instance to invoke this method, or if the instance does not have
63      * a remote interface.
64      */

65     EJBObject JavaDoc getEJBObject() throws IllegalStateException JavaDoc;
66
67     /**
68      * Obtain a reference to the JAX-RPC MessageContext. An instance of a
69      * stateless session bean can call this method from any business method
70      * invoked through its web service endpoint interface.
71      * @return The MessageContext for this web service invocation.
72      * @throws IllegalStateException - Thrown if this method is invoked while
73      * the instance is in a state that does not allow access to this
74      * method.
75      */

76     MessageContext JavaDoc getMessageContext() throws IllegalStateException JavaDoc;
77
78     /**
79      * Obtain an object that can be used to invoke the current bean through the
80      * given business interface.
81      * @param <T> the interface of the bean
82      * @param businessInterface One of the local business interfaces or remote
83      * business interfaces for this session bean.
84      * @return The business object corresponding to the given business
85      * interface.
86      * @throws IllegalStateException - Thrown if this method is invoked with an
87      * invalid business interface for the current bean.
88      * @since EJB 3.0 version.
89      */

90     <T> T getBusinessObject(Class JavaDoc<T> businessInterface) throws IllegalStateException JavaDoc;
91
92     /**
93      * Obtain the business interface through which the current business method
94      * invocation was made.
95      * @return the business interface through which the current business method
96      * invocation was made.
97      * @throws IllegalStateException - Thrown if this method is called and the
98      * bean has not been invoked through a business interface.
99      * @since EJB 3.0 version.
100      */

101     Class JavaDoc getInvokedBusinessInterface() throws IllegalStateException JavaDoc;
102
103 }
104
Popular Tags