KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > ejb > SessionBean


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: SessionBean.java 1100 2006-08-16 13:05:31Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package javax.ejb;
27
28 import java.rmi.RemoteException JavaDoc;
29
30 /**
31  * The SessionBean interface is implemented by every session enterprise Bean
32  * class. The container uses the SessionBean methods to notify the enterprise
33  * Bean instances of the instance's life cycle events.
34  * @see <a HREF="http://www.jcp.org/en/jsr/detail?id=220">EJB 3.0 specification</a>
35  * @author Florent Benoit
36  */

37 public interface SessionBean extends EnterpriseBean JavaDoc {
38
39     /**
40      * Set the associated session context. The container calls this method after
41      * the instance creation. The enterprise Bean instance should store the
42      * reference to the context object in an instance variable. This method is
43      * called with no transaction context.
44      * @param ctx A SessionContext interface for the instance.
45      * @throws EJBException Thrown by the method to indicate a failure caused by
46      * a system-level error.
47      * @throws RemoteException This exception is defined in the method signature
48      * to provide backward compatibility for applications written for
49      * the EJB 1.0 specification. Enterprise beans written for the EJB
50      * 1.1 specification should throw the javax.ejb.EJBException instead
51      * of this exception. Enterprise beans written for the EJB2.0 and
52      * higher specifications must throw the javax.ejb.EJBException
53      * instead of this exception.
54      */

55     void setSessionContext(SessionContext JavaDoc ctx) throws EJBException JavaDoc, RemoteException JavaDoc;
56
57     /**
58      * A container invokes this method before it ends the life of the session
59      * object. This happens as a result of a client's invoking a remove
60      * operation, or when a container decides to terminate the session object
61      * after a timeout. This method is called with no transaction context.
62      * @throws EJBException Thrown by the method to indicate a failure caused by
63      * a system-level error.
64      * @throws RemoteException This exception is defined in the method signature
65      * to provide backward compatibility for enterprise beans written
66      * for the EJB 1.0 specification. Enterprise beans written for the
67      * EJB 1.1 specification should throw the javax.ejb.EJBException
68      * instead of this exception. Enterprise beans written for the
69      * EJB2.0 and higher specifications must throw the
70      * javax.ejb.EJBException instead of this exception.
71      */

72     void ejbRemove() throws EJBException JavaDoc, RemoteException JavaDoc;
73
74     /**
75      * The activate method is called when the instance is activated from its
76      * "passive" state. The instance should acquire any resource that it has
77      * released earlier in the ejbPassivate() method. This method is called with
78      * no transaction context.
79      * @throws EJBException Thrown by the method to indicate a failure caused by
80      * a system-level error.
81      * @throws RemoteException This exception is defined in the method signature
82      * to provide backward compatibility for enterprise beans written
83      * for the EJB 1.0 specification. Enterprise beans written for the
84      * EJB 1.1 specification should throw the javax.ejb.EJBException
85      * instead of this exception. Enterprise beans written for the
86      * EJB2.0 and higher specifications must throw the
87      * javax.ejb.EJBException instead of this exception.
88      */

89     void ejbActivate() throws EJBException JavaDoc, RemoteException JavaDoc;
90
91     /**
92      * The passivate method is called before the instance enters the "passive"
93      * state. The instance should release any resources that it can re-acquire
94      * later in the ejbActivate() method. After the passivate method completes,
95      * the instance must be in a state that allows the container to use the Java
96      * Serialization protocol to externalize and store away the instance's
97      * state. This method is called with no transaction context.
98      * @throws EJBException Thrown by the method to indicate a failure caused by
99      * a system-level error.
100      * @throws RemoteException This exception is defined in the method signature
101      * to provide backward compatibility for enterprise beans written
102      * for the EJB 1.0 specification. Enterprise beans written for the
103      * EJB 1.1 specification should throw the javax.ejb.EJBException
104      * instead of this exception. Enterprise beans written for the
105      * EJB2.0 and higher specifications must throw the
106      * javax.ejb.EJBException instead of this exception.
107      */

108     void ejbPassivate() throws EJBException JavaDoc, RemoteException JavaDoc;
109 }
110
Popular Tags