KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > container > JEntityHandle


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@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: JEntityHandle.java,v 1.9 2005/01/12 14:40:21 pelletib Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas_ejb.container;
27
28 import java.io.Serializable JavaDoc;
29 import java.rmi.RemoteException JavaDoc;
30
31 import javax.ejb.EJBObject JavaDoc;
32 import javax.ejb.Handle JavaDoc;
33 import javax.ejb.HomeHandle JavaDoc;
34
35 import org.objectweb.util.monolog.api.BasicLevel;
36
37 /**
38  * This class implements javax.ejb.Handle interface. For a Entity Bean a Handle
39  * is a serializable class that contains the HomeHandle and the primary key
40  * @author Philippe Coq
41  */

42 public abstract class JEntityHandle implements Handle JavaDoc, Serializable JavaDoc {
43
44     /**
45      * @serial
46      */

47     protected HomeHandle JavaDoc homehandle = null;
48
49     /**
50      * @serial
51      */

52     protected Serializable JavaDoc pk = null;
53
54     /**
55      * constructor
56      * @param remote The Remote object
57      */

58     public JEntityHandle(JEntityRemote remote) {
59         try {
60             homehandle = remote.getEJBHome().getHomeHandle();
61         } catch (RemoteException JavaDoc e) {
62             TraceEjb.logger.log(BasicLevel.ERROR, "cannot get HomeHandle: ", e);
63         }
64     }
65
66     /**
67      * Obtains the EJB object represented by this handle.
68      * @return The EJB object
69      * @throws RemoteException The EJB object could not be obtained because of a
70      * system-level failure.
71      */

72     public abstract EJBObject JavaDoc getEJBObject() throws RemoteException JavaDoc;
73
74     /**
75      * @return the Primary Key embedded in the Handle
76      */

77     public java.lang.Object JavaDoc getPK() {
78         return pk;
79     }
80 }
81
82
Popular Tags