1 45 package org.openejb.core.stateless; 46 47 import java.lang.reflect.Method ; 48 import java.rmi.RemoteException ; 49 50 import org.openejb.RpcContainer; 51 import org.openejb.core.ThreadContext; 52 import org.openejb.core.ivm.EjbHomeProxyHandler; 53 import org.openejb.core.ivm.EjbObjectProxyHandler; 54 import org.openejb.core.ivm.IntraVmHandle; 55 import org.openejb.util.proxy.ProxyManager; 56 57 66 public class StatelessEjbHomeHandler extends EjbHomeProxyHandler { 67 68 public StatelessEjbHomeHandler(RpcContainer container, Object pk, Object depID){ 69 super(container, pk, depID); 70 } 71 72 84 protected Object findX(Method method, Object [] args, Object proxy) throws Throwable { 85 throw new UnsupportedOperationException ("Stateful beans may not have find methods"); 86 } 87 88 117 protected Object removeByPrimaryKey(Method method, Object [] args, Object proxy) throws Throwable { 118 throw new RemoteException ("Session objects are private resources and do not have primary keys"); 119 } 120 127 protected Object removeWithHandle(Method method, Object [] args, Object proxy) throws Throwable { 128 129 IntraVmHandle handle = (IntraVmHandle)args[0]; 131 Object primKey = handle.getPrimaryKey(); 132 EjbObjectProxyHandler stub; 133 try{ 134 stub = (EjbObjectProxyHandler)ProxyManager.getInvocationHandler(handle.getEJBObject()); 135 }catch(IllegalArgumentException e) { 136 stub=null; 138 } 139 container.invoke(deploymentID, method, args, primKey, ThreadContext.getThreadContext().getSecurityIdentity()); 141 if(stub!=null) { 142 stub.invalidateReference(); 143 } 144 return null; 145 } 146 147 protected EjbObjectProxyHandler newEjbObjectHandler(RpcContainer container, Object pk, Object depID) { 148 return new StatelessEjbObjectHandler(container, pk, depID); 149 } 150 151 } 152 | Popular Tags |