01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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 6072 2005-01-12 14:40:21Z pelletib $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas_ejb.container;
25:
26: import java.io.Serializable;
27: import java.rmi.RemoteException;
28:
29: import javax.ejb.EJBObject;
30: import javax.ejb.Handle;
31: import javax.ejb.HomeHandle;
32:
33: import org.objectweb.util.monolog.api.BasicLevel;
34:
35: /**
36: * This class implements javax.ejb.Handle interface. For a Entity Bean a Handle
37: * is a serializable class that contains the HomeHandle and the primary key
38: * @author Philippe Coq
39: */
40: public abstract class JEntityHandle implements Handle, Serializable {
41:
42: /**
43: * @serial
44: */
45: protected HomeHandle homehandle = null;
46:
47: /**
48: * @serial
49: */
50: protected Serializable pk = null;
51:
52: /**
53: * constructor
54: * @param remote The Remote object
55: */
56: public JEntityHandle(JEntityRemote remote) {
57: try {
58: homehandle = remote.getEJBHome().getHomeHandle();
59: } catch (RemoteException e) {
60: TraceEjb.logger.log(BasicLevel.ERROR,
61: "cannot get HomeHandle: ", e);
62: }
63: }
64:
65: /**
66: * Obtains the EJB object represented by this handle.
67: * @return The EJB object
68: * @throws RemoteException The EJB object could not be obtained because of a
69: * system-level failure.
70: */
71: public abstract EJBObject getEJBObject() throws RemoteException;
72:
73: /**
74: * @return the Primary Key embedded in the Handle
75: */
76: public java.lang.Object getPK() {
77: return pk;
78: }
79: }
|