1 26 27 package com.caucho.ejb.protocol; 28 29 import com.caucho.ejb.AbstractEJBObject; 30 import com.caucho.ejb.AbstractServer; 31 32 import javax.ejb.EJBHome ; 33 import javax.ejb.EJBMetaData ; 34 import javax.ejb.Handle ; 35 import javax.ejb.HomeHandle ; 36 import javax.ejb.RemoveException ; 37 import java.rmi.RemoteException ; 38 39 42 public abstract class JVMHome extends AbstractEJBObject implements EJBHome { 43 protected AbstractServer _server; 44 protected Object _object; 45 46 49 void _init(AbstractServer server) 50 { 51 _server = server; 52 } 53 54 57 public Class getAPIClass() 58 { 59 return getServer().getRemoteHomeClass(); 60 } 61 62 65 public String getURL(String protocol) 66 { 67 return getServer().getHandleEncoder(protocol).getServerId(); 68 } 69 70 73 public HomeHandle getHomeHandle() 74 throws RemoteException 75 { 76 return getServer().getHomeHandle(); 77 } 78 79 82 protected Object _caucho_getObject() 83 throws RemoteException 84 { 85 if (_server == null || _server.isDead()) { 86 _object = null; 87 _server = getServer(); 88 } 89 90 if (_object == null) { 91 _object = _server.getHomeObject(); 92 93 if (_object == null) 94 throw new RemoteException ("missing home object"); 95 96 _caucho_init_methods(_object.getClass()); 97 } 98 99 return _object; 100 } 101 102 protected void _caucho_init_methods(Class cl) 103 { 104 } 105 106 109 protected ClassLoader _caucho_getClassLoader() 110 throws RemoteException 111 { 112 return getServer().getClassLoader(); 113 } 114 115 public EJBMetaData getEJBMetaData() 116 { 117 return getServer().getEJBMetaData(); 118 } 119 120 124 private AbstractServer getServer() 125 { 126 if (_server.isDead()) { 127 String serverId = _server.getHandleServerId(); 128 129 _object = null; 130 _server = EjbProtocolManager.getJVMServer(serverId); 131 } 132 133 return _server; 134 } 135 136 public void remove(Object o) 137 throws RemoveException , RemoteException 138 { 139 } 140 141 public void remove(Handle handle) 142 throws RemoveException , RemoteException 143 { 144 } 145 } 146 | Popular Tags |