1 45 46 47 package org.openejb.core.stateless; 48 49 import java.lang.reflect.Method ; 50 import java.rmi.RemoteException ; 51 52 import org.openejb.Container; 53 import org.openejb.RpcContainer; 54 import org.openejb.core.ivm.EjbObjectProxyHandler; 55 import org.openejb.util.proxy.ProxyManager; 56 57 66 public class StatelessEjbObjectHandler extends EjbObjectProxyHandler { 67 public Object registryId; 68 69 public StatelessEjbObjectHandler(RpcContainer container, Object pk, Object depID){ 70 super(container, pk, depID); 71 } 72 73 public static Object createRegistryId(Object primKey, Object deployId, Container contnr){ 74 return ""+deployId+contnr.getContainerID(); 75 } 76 public Object getRegistryId(){ 77 if(registryId== null) 78 registryId= createRegistryId(primaryKey, deploymentID, container); 79 return registryId; 80 } 81 82 83 97 protected Object getPrimaryKey(Method method, Object [] args, Object proxy) throws Throwable { 98 throw new RemoteException ("Session objects are private resources and do not have primary keys"); 99 } 100 101 136 protected Object isIdentical(Method method, Object [] args, Object proxy) throws Throwable { 137 checkAuthorization(method); 138 139 try { 140 EjbObjectProxyHandler handler = 141 (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(args[0]); 142 return new Boolean ( deploymentID.equals(handler.deploymentID) ); 143 } catch (Throwable t){ 144 return Boolean.FALSE; 145 } 147 } 148 149 protected Object remove(Method method, Object [] args, Object proxy) throws Throwable { 150 checkAuthorization(method); 151 invalidateReference(); 152 return null; 153 } 154 155 } 156 | Popular Tags |