01: /*
02: * JFox - The most lightweight Java EE Application Server!
03: * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
04: *
05: * JFox is licenced and re-distributable under GNU LGPL.
06: */
07: package org.jfox.ejb3;
08:
09: import java.rmi.RemoteException;
10: import java.io.Serializable;
11: import javax.ejb.EJBObject;
12: import javax.ejb.Handle;
13: import javax.naming.InitialContext;
14:
15: /**
16: * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
17: */
18: public class EJBHandleImpl implements Handle, Serializable {
19: /**
20: * ejb name
21: */
22: private EJBObjectId ejbObjectId;
23:
24: public EJBHandleImpl(EJBObjectId ejbObjectId) {
25: this .ejbObjectId = ejbObjectId;
26: }
27:
28: public EJBObject getEJBObject() throws RemoteException {
29: try {
30: InitialContext initContext = new InitialContext();
31: return (EJBObject) initContext.lookup(ejbObjectId
32: .getEJBName());
33: } catch (Exception e) {
34: throw new RemoteException(
35: "EJBHandleImpl.getEJBObject failed!", e);
36: }
37: }
38:
39: public static void main(String[] args) {
40:
41: }
42: }
|