1 28 29 package com.caucho.ejb.session; 30 31 import com.caucho.ejb.AbstractServer; 32 import com.caucho.ejb.EJBExceptionWrapper; 33 import com.caucho.ejb.EjbServerManager; 34 import com.caucho.util.Log; 35 36 import javax.ejb.EJBHome ; 37 import javax.ejb.EJBLocalHome ; 38 import javax.ejb.SessionBean ; 39 import java.rmi.RemoteException ; 40 import java.util.logging.Logger ; 41 42 45 abstract public class AbstractSessionServer extends AbstractServer { 46 protected final static Logger log = Log.open(AbstractSessionServer.class); 47 48 private AbstractSessionContext _homeContext; 49 50 public AbstractSessionServer(EjbServerManager manager) 51 throws Exception 52 { 53 super(manager); 54 } 55 56 59 @Override 60 public void init() 61 throws Exception 62 { 63 try { 64 super.init(); 65 66 68 84 85 log.config("initialized session bean: " + this); 86 } catch (Exception e) { 87 throw e; 88 } 89 } 90 91 94 public Class getPrimaryKeyClass() 95 { 96 return String .class; 97 } 98 99 102 public EJBLocalHome getEJBLocalHome() 103 { 104 return _localHome; 105 } 106 107 110 public EJBHome getEJBHome() 111 throws RemoteException 112 { 113 if (_remoteHome == null) { 114 try { 115 _remoteHome = _jvmClient.createHomeStub(); 116 } catch (Exception e) { 117 EJBExceptionWrapper.createRuntime(e); 118 } 119 } 120 121 return _remoteHome; 122 } 123 124 public Object getHomeObject() 125 { 126 return _remoteHomeView; 127 } 128 129 132 SessionObject getEJBLocalObject(SessionBean bean) 133 { 134 try { 135 SessionObject obj = null; 136 137 141 if (obj == null) 142 throw new IllegalStateException ("bean has no local interface"); 143 144 return obj; 145 } catch (Exception e) { 146 throw new EJBExceptionWrapper(e); 147 } 148 } 149 } 150 | Popular Tags |