]> source.dussan.org Git - aspectj.git/commitdiff
248814: perclassloaderdumpdir
authoraclement <aclement>
Sat, 27 Sep 2008 17:26:37 +0000 (17:26 +0000)
committeraclement <aclement>
Sat, 27 Sep 2008 17:26:37 +0000 (17:26 +0000)
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
loadtime/src/org/aspectj/weaver/loadtime/definition/Definition.java
loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java

index 95016f6556222e4b05b7d83a8b92129f8d5f421c..10eaefbabc181940dcf98903babbdf9276b9c670 100644 (file)
@@ -62,6 +62,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
 
        private List m_dumpTypePattern = new ArrayList();
        private boolean m_dumpBefore = false;
+       private boolean dumpDirPerClassloader = false;
        private List m_includeTypePattern = new ArrayList();
        private List m_excludeTypePattern = new ArrayList();
        private List m_includeStartsWith = new ArrayList();
@@ -593,6 +594,9 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
                        if (definition.shouldDumpBefore()) {
                                m_dumpBefore = true;
                        }
+                       if (definition.createDumpDirPerClassloader()) {
+                               dumpDirPerClassloader = true;
+                       }
                }
        }
 
@@ -728,10 +732,21 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
                return false;
        }
 
+       protected String getDumpDir() {
+               if (dumpDirPerClassloader) {
+                       StringBuffer dir = new StringBuffer();
+                       dir.append("_ajdump").append(File.separator).append(weavingContext.getClassLoaderName());
+                       return dir.toString();
+               } else {
+                       return super.getDumpDir();
+               }
+       }
+       
        /*
         * shared classes methods
         */
 
+
        /**
         * @return Returns the key.
         */
index 3b6e06a1ddf83584479b3bb7e3410d030cd7b8b5..73801b9305b2f6963d38e84f9973a0d19c60b982 100644 (file)
@@ -26,6 +26,8 @@ public class Definition {
        private final List m_dumpPatterns;
 
        private boolean m_dumpBefore;
+       
+       private boolean perClassloaderDumpDir;
 
        private final List m_includePatterns;
 
@@ -42,6 +44,7 @@ public class Definition {
        public Definition() {
                m_weaverOptions = new StringBuffer();
                m_dumpBefore = false;
+               perClassloaderDumpDir = false;
                m_dumpPatterns = new ArrayList(0);
                m_includePatterns = new ArrayList(0);
                m_excludePatterns = new ArrayList(0);
@@ -67,6 +70,14 @@ public class Definition {
                return m_dumpBefore;
        }
 
+       public void setCreateDumpDirPerClassloader(boolean b) {
+               perClassloaderDumpDir = b;
+       }
+
+       public boolean createDumpDirPerClassloader() {
+               return perClassloaderDumpDir;
+       }
+
        public List getIncludePatterns() {
                return m_includePatterns;
        }
index f620e78d91ec64612c1a42a18429975b8c527c0f..101fcbaa721d36f6984da53a191a82ad0aa0b6c8 100644 (file)
@@ -52,6 +52,7 @@ public class DocumentParser extends DefaultHandler {
        private final static String WEAVER_ELEMENT = "weaver";
        private final static String DUMP_ELEMENT = "dump";
        private final static String DUMP_BEFOREANDAFTER_ATTRIBUTE = "beforeandafter";
+       private final static String DUMP_PERCLASSLOADERDIR_ATTRIBUTE = "perclassloaderdumpdir";
        private final static String INCLUDE_ELEMENT = "include";
        private final static String EXCLUDE_ELEMENT = "exclude";
        private final static String OPTIONS_ATTRIBUTE = "options";
@@ -205,6 +206,10 @@ public class DocumentParser extends DefaultHandler {
                        if (isTrue(beforeAndAfter)) {
                                m_definition.setDumpBefore(true);
                        }
+                       String perWeaverDumpDir = attributes.getValue(DUMP_PERCLASSLOADERDIR_ATTRIBUTE);
+                       if (isTrue(perWeaverDumpDir)) {
+                               m_definition.setCreateDumpDirPerClassloader(true);
+                       }
                } else if (EXCLUDE_ELEMENT.equals(qName) && m_inAspects) {
                        String typePattern = getWithinAttribute(attributes);
                        if (!isNull(typePattern)) {