1 22 package org.jboss.ejb3.mdb; 23 24 import java.io.Serializable ; 25 import java.lang.reflect.InvocationHandler ; 26 import java.lang.reflect.Method ; 27 import org.jboss.aop.advice.Interceptor; 28 import org.jboss.aop.joinpoint.MethodInvocation; 29 import org.jboss.aop.util.MethodHashing; 30 31 37 public class ProducerProxy implements InvocationHandler , Serializable 38 { 39 protected ProducerManager producer; 40 protected Interceptor[] interceptors; 41 42 public ProducerProxy(ProducerManager producer, Interceptor[] interceptors) 43 { 44 this.producer = producer; 45 this.interceptors = interceptors; 46 } 47 48 public ProducerProxy() 49 { 50 } 51 52 53 public Object invoke(Object proxy, Method method, Object [] args) 54 throws Throwable 55 { 56 if (method.getName().equals("getProducerManager")) 57 { 58 return producer; 59 } 60 long hash = MethodHashing.calculateHash(method); 61 MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null); 62 sri.setArguments(args); 63 return sri.invokeNext(); 64 } 65 } 66 | Popular Tags |