1 17 18 package org.sape.carbon.core.component.proxy; 19 20 import java.lang.reflect.InvocationHandler ; 21 import java.lang.reflect.InvocationTargetException ; 22 import java.lang.reflect.Proxy ; 23 24 import org.sape.carbon.core.component.Component; 25 26 36 public class ProxyInvoker implements Interceptor { 37 38 39 44 public void setNextInterceptor(Interceptor interceptor) { 45 throw new UnsupportedOperationException ( 46 "ProxyInvoker is designed to be configured at the end of the " 47 + "interceptor chain. It makes no sense to configure it " 48 + "before the end of the chain. Please check your " 49 + "Component Template Configuration."); 50 } 51 52 61 public Object invoke(Invocation invocation) 62 throws Throwable { 63 64 try { 65 return invocation.getMethod().invoke( 72 invocation.getTarget(), 73 invocation.getMethodArguments() 74 ); 75 } catch (IllegalAccessException iae) { 76 throw iae; 77 } catch (InvocationTargetException ite) { 78 throw ite.getTargetException(); 79 } 80 81 } 82 83 91 public Class [] getExposedInterfaces() { 92 return new Class [0]; 93 } 94 95 105 public void setComponentReference(Component component) { 106 } 107 108 } 109 | Popular Tags |