diff options
author | jkew <jkew@vmware.com> | 2012-02-22 16:19:51 -0800 |
---|---|---|
committer | Andy Clement <aclement@vmware.com> | 2012-02-29 15:32:46 -0800 |
commit | e07c4112d8a6161f110a3752158abcc0e1d290b2 (patch) | |
tree | 6f5c8c00e3e5ff22002bea6d746c977b246adcbc /loadtime | |
parent | ac0d0829758c207077cdc737c80277dd9c17b489 (diff) | |
download | aspectj-e07c4112d8a6161f110a3752158abcc0e1d290b2.tar.gz aspectj-e07c4112d8a6161f110a3752158abcc0e1d290b2.zip |
AspectJ Caching w/ CRC Index File
Signed-off-by: Andy Clement <aclement@vmware.com>
Diffstat (limited to 'loadtime')
-rw-r--r-- | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 868c94c48..0615ff489 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -9,26 +9,17 @@ * Contributors: * Alexandre Vasseur initial implementation * David Knibb weaving context enhancments + * John Kew (vmware) caching hook *******************************************************************************/ package org.aspectj.weaver.loadtime; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.security.ProtectionDomain; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.Set; -import java.util.StringTokenizer; +import java.util.*; import org.aspectj.bridge.AbortException; import org.aspectj.bridge.Constants; @@ -47,10 +38,8 @@ import org.aspectj.weaver.loadtime.definition.DocumentParser; import org.aspectj.weaver.ltw.LTWWorld; import org.aspectj.weaver.patterns.PatternParser; import org.aspectj.weaver.patterns.TypePattern; -import org.aspectj.weaver.tools.GeneratedClassHandler; -import org.aspectj.weaver.tools.Trace; -import org.aspectj.weaver.tools.TraceFactory; -import org.aspectj.weaver.tools.WeavingAdaptor; +import org.aspectj.weaver.tools.*; +import org.aspectj.weaver.tools.cache.WeavedClassCache; /** * @author Alexandre Vasseur @@ -195,6 +184,9 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { bcelWorld = null; weaver = null; } + if (WeavedClassCache.isEnabled()) { + initializeCache(classLoader, getAspectClassNames(definitions), generatedClassHandler, getMessageHandler()); + } initialized = true; if (trace.isTraceEnabled()) { @@ -203,9 +195,25 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { } /** + * Get the list of all aspects from the defintion list + * @param definitions + * @return + */ + List<String> getAspectClassNames(List<Definition> definitions) { + List<String> aspects = new LinkedList<String>(); + for (Iterator<Definition> it = definitions.iterator(); it.hasNext(); ) { + Definition def = it.next(); + List<String> defAspects = def.getAspectClassNames(); + if (defAspects != null) { + aspects.addAll(defAspects); + } + } + return aspects; + } + + /** * Load and cache the aop.xml/properties according to the classloader visibility rules * - * @param weaver * @param loader */ List<Definition> parseDefinitions(final ClassLoader loader) { |