1 22 package org.jboss.aspects.remoting; 23 24 import java.lang.reflect.InvocationHandler ; 25 import java.lang.reflect.Method ; 26 import org.jboss.aop.Dispatcher; 27 import org.jboss.aop.advice.Interceptor; 28 import org.jboss.aop.joinpoint.MethodInvocation; 29 import org.jboss.aop.util.MethodHashing; 30 import org.jboss.aop.util.PayloadKey; 31 import org.jboss.remoting.InvokerLocator; 32 33 38 public class PojiProxy implements java.io.Serializable , InvocationHandler 39 { 40 private static final long serialVersionUID = 8054816523858555978L; 41 42 private Object oid; 43 private InvokerLocator uri; 44 private Interceptor[] interceptors; 45 46 public PojiProxy(Object oid, InvokerLocator uri, Interceptor[] interceptors) 47 { 48 this.oid = oid; 49 this.uri = uri; 50 this.interceptors = interceptors; 51 } 52 53 public Object invoke(Object proxy, Method method, Object [] args) throws Throwable 54 { 55 long hash = MethodHashing.calculateHash(method); 56 MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null); 57 sri.setArguments(args); 58 sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, oid, PayloadKey.AS_IS); 59 sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS); 60 sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS); 61 return sri.invokeNext(); 62 } 63 } 64 | Popular Tags |