1 7 package org.jboss.cache.aop; 8 9 import org.apache.commons.logging.Log; 10 import org.apache.commons.logging.LogFactory; 11 import org.jboss.aop.InstanceAdvisor; 12 import org.jboss.aop.Advised; 13 import org.jboss.aop.advice.Interceptor; 14 import org.jboss.aop.joinpoint.Invocation; 15 import org.jboss.aop.joinpoint.MethodInvocation; 16 import org.jboss.aop.proxy.ClassProxy; 17 import org.jboss.aop.proxy.ClassProxyFactory; 18 import org.jboss.aop.util.MethodHashing; 19 import org.jboss.util.NestedRuntimeException; 20 import org.jboss.cache.Fqn; 21 22 import java.lang.reflect.Method ; 23 import java.util.HashMap ; 24 import java.util.Map ; 25 import java.io.Serializable ; 26 27 32 public class AopUtil 33 { 34 static Log log=LogFactory.getLog(AopUtil.class.getName()); 35 36 42 static Interceptor findCacheInterceptor(InstanceAdvisor advisor, Fqn fqn) 43 { 44 org.jboss.aop.advice.Interceptor[] interceptors = advisor.getInterceptors(); 45 for (int i = 0; i < interceptors.length; i++) { 47 Interceptor interceptor = interceptors[i]; 48 if (interceptor instanceof CacheInterceptor) { 49 CacheInterceptor inter = (CacheInterceptor)interceptor; 50 if (inter != null && inter.getFqn().equals(fqn)) 51 { 52 return interceptor; 53 } 54 } 55 } 56 return null; 57 } 58 59 66 static Interceptor findCacheInterceptor(InstanceAdvisor advisor) 67 { 68 Interceptor[] interceptors = advisor.getInterceptors(); 70 for (int i = 0; i < interceptors.length; i++) { 72 Interceptor interceptor = interceptors[i]; 73 if (interceptor instanceof CacheInterceptor) { 74 return interceptor; 75 } 76 } 77 return null; 78 } 79 80 86 static void checkObjectType(Object obj) { 87 if(obj == null) return; 88 if( ! (obj instanceof Advised) ) { 89 if( !(obj instanceof Serializable ) ) { 90 throw new IllegalArgumentException ("TreeCacheAop.putObject(): Object type is neither " + 91 " aspectized nor Serializable. Object class name is " +obj.getClass().getName()); 92 } 93 } 94 } 95 96 } 97 | Popular Tags |