1 15 package org.apache.examples.impl; 16 17 import java.lang.reflect.InvocationHandler ; 18 import java.lang.reflect.Proxy ; 19 20 import org.apache.commons.logging.Log; 21 import org.apache.hivemind.InterceptorStack; 22 import org.apache.hivemind.ServiceInterceptorFactory; 23 import org.apache.hivemind.internal.Module; 24 25 31 public class ProxyLoggingInterceptorFactory implements ServiceInterceptorFactory 32 { 33 34 public void createInterceptor(InterceptorStack stack, Module invokingModule, Object parameters) 35 { 36 Log log = stack.getServiceLog(); 37 38 InvocationHandler handler = new ProxyLoggingInvocationHandler(log, stack.peek()); 39 40 Object interceptor = 41 Proxy.newProxyInstance( 42 invokingModule.getClassResolver().getClassLoader(), 43 new Class [] { stack.getServiceInterface()}, 44 handler); 45 46 stack.push(interceptor); 47 } 48 } 49 | Popular Tags |