1 22 package org.jboss.ejb.plugins.local; 23 24 import java.lang.reflect.InvocationHandler ; 25 import java.lang.reflect.Method ; 26 27 32 class EntityProxy extends LocalProxy 33 implements InvocationHandler 34 { 35 static final long serialVersionUID = 5196148608172665115L; 36 private Object cacheKey; 37 private boolean removed; 38 39 EntityProxy(String jndiName, Object id, BaseLocalProxyFactory factory) 40 { 41 super(jndiName, factory); 42 cacheKey = id; 43 } 44 45 protected Object getId() 46 { 47 return cacheKey; 48 } 49 50 public final Object invoke(final Object proxy, final Method m, Object [] args) 51 throws Throwable 52 { 53 if(removed) 54 { 55 throw new javax.ejb.NoSuchObjectLocalException ("The instance has been removed: " + toStringImpl()); 56 } 57 58 if (args == null) 59 args = EMPTY_ARGS; 60 61 Object retValue = super.invoke( proxy, m, args ); 62 if( retValue == null ) 63 { 64 retValue = factory.invoke(cacheKey, m, args); 66 } 67 68 if(m.equals(REMOVE)) 69 { 70 removed = true; 71 } 72 73 return retValue; 74 } 75 76 } 77 | Popular Tags |