KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > ejb > EntityContext


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

25
26 package javax.ejb;
27
28 /**
29  * The EntityContext interface provides an instance with access to the
30  * container-provided runtime context of an entity enterprise Bean instance.
31  * @see <a HREF="http://www.jcp.org/en/jsr/detail?id=220">EJB 3.0 specification</a>
32  * @author Florent Benoit
33  */

34 public interface EntityContext extends EJBContext JavaDoc {
35
36     /**
37      * Obtain a reference to the EJB local object that is currently associated
38      * with the instance. An instance of an entity enterprise Bean can call this
39      * method only when the instance is associated with an EJB local object
40      * identity, i.e. in the ejbActivate, ejbPassivate, ejbPostCreate,
41      * ejbRemove, ejbLoad, ejbStore, and business 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 if the instance invokes this method while
46      * the instance is in a state that does not allow the instance to
47      * invoke this method, or if the instance does not have a local
48      * 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 an entity enterprise Bean can call this
55      * method only when the instance is associated with an EJB object identity,
56      * i.e. in the ejbActivate, ejbPassivate, ejbPostCreate, ejbRemove, ejbLoad,
57      * ejbStore, and business methods. An instance can use this method, for
58      * example, when it wants to pass a reference to itself in a method argument
59      * or result.
60      * @return The EJB object currently associated with the instance.
61      * @throws IllegalStateException Thrown if the instance invokes this method
62      * while the instance is in a state that does not allow the instance
63      * to invoke this method, or if the instance does not have a remote
64      * interface.
65      */

66     EJBObject JavaDoc getEJBObject() throws IllegalStateException JavaDoc;
67
68     /**
69      * Obtain the primary key of the EJB object that is currently associated
70      * with this instance. An instance of an entity enterprise Bean can call
71      * this method only when the instance is associated with an EJB object
72      * identity, i.e. in the ejbActivate, ejbPassivate, ejbPostCreate,
73      * ejbRemove, ejbLoad, ejbStore, and business methods. Note: The result of
74      * this method is that same as the result of getEJBObject().getPrimaryKey().
75      * @return The primary key currently associated with the instance.
76      * @throws IllegalStateException Thrown if the instance invokes this method
77      * while the instance is in a state that does not allow the instance
78      * to invoke this method.
79      */

80     Object JavaDoc getPrimaryKey() throws IllegalStateException JavaDoc;
81
82 }
83
Popular Tags