1 17 18 package org.objectweb.jac.aspects.cache; 19 20 import java.util.Iterator ; 21 import org.apache.log4j.Logger; 22 import org.objectweb.jac.core.AspectComponent; 23 import org.objectweb.jac.core.rtti.AbstractMethodItem; 24 25 28 29 public class CacheAC extends AspectComponent implements CacheConf { 30 static final Logger logger = Logger.getLogger("cache"); 31 32 public static final String IGNORED_PARAMETERS = "CacheAC.IGNORED_PARAMETERS"; 33 34 40 public void cache(String classExpr, String methodExpr) 41 { 42 logger.info("cache "+classExpr+"."+methodExpr); 43 44 pointcut("ALL",classExpr,methodExpr, 45 "org.objectweb.jac.aspects.cache.CacheWrapper", 46 null,NOT_SHARED); 47 } 48 49 public void cacheWithTimeStamps( 50 String classExpr, String methodExpr, 51 String stampsName) 52 { 53 logger.info("cache "+classExpr+"."+methodExpr); 54 55 pointcut( 56 "ALL", classExpr, methodExpr, 57 "org.objectweb.jac.aspects.cache.CacheWrapper", 58 new Object [] {stampsName}, 59 null, 60 NOT_SHARED); 61 } 62 63 public void setIgnoredParameters(AbstractMethodItem method, 64 int[] ignored) 65 { 66 method.setAttribute(IGNORED_PARAMETERS,ignored); 67 } 68 69 public void invalidateCache() { 70 Iterator i = wrappers.iterator(); 71 while(i.hasNext()) { 72 CacheWrapper wrapper = (CacheWrapper)i.next(); 73 wrapper.invalidate(); 74 } 75 } 76 } 77 | Popular Tags |