[jboss-cvs] JBossAS SVN: r102779 - in projects/aop/branches/Branch_2_2: aop and 12 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 23 08:59:31 EDT 2010


Author: flavia.rainone at jboss.com
Date: 2010-03-23 08:59:27 -0400 (Tue, 23 Mar 2010)
New Revision: 102779

Added:
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/ClassLoaderRepository.java
Removed:
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPool.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolFactory.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java
Modified:
   projects/aop/branches/Branch_2_2/aop/pom.xml
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/AspectManager.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/ClassicWeavingStrategy.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/contrib/IDEClassPoolFactory.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/eclipsesupport/Agent.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/ClassicInstrumentor.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/FieldAccessTransformer.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/Instrumentor.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/InstrumentorFactory.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/MethodExecutionTransformer.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedCallerInvocations.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructionInvocations.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructorInvocations.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedFieldInvocations.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedInvocations.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedMethodInvocations.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/TransformerCommon.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPool.java
   projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPoolFactory.java
   projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/jdk15/dynamic/common/scenario/ScenarioRunner.java
   projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/stress/weavetest/GenerateClassesScenario.java
   projects/aop/branches/Branch_2_2/asintegration-core/pom.xml
   projects/aop/branches/Branch_2_2/asintegration-jmx/pom.xml
   projects/aop/branches/Branch_2_2/asintegration-mc/pom.xml
   projects/aop/branches/Branch_2_2/build/pom.xml
   projects/aop/branches/Branch_2_2/pom.xml
Log:
[JBAOP-772] Included classpool dependencies in the pom.xml files, and ported changes to aop module.

Modified: projects/aop/branches/Branch_2_2/aop/pom.xml
===================================================================
--- projects/aop/branches/Branch_2_2/aop/pom.xml	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/pom.xml	2010-03-23 12:59:27 UTC (rev 102779)
@@ -298,6 +298,15 @@
       <artifactId>javassist</artifactId>
     </dependency>
     <dependency>
+        <groupId>org.jboss.classpool</groupId>
+        <artifactId>jboss-classpool-scoped</artifactId>
+        <version>${version.org.jboss.classpool}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.classpool</groupId>
+      <artifactId>jboss-classpool</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.jboss</groupId>
       <artifactId>jboss-reflect</artifactId>
       <exclusions>

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/AspectManager.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/AspectManager.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/AspectManager.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,24 +1,24 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop;
 
 import java.lang.ref.WeakReference;
@@ -43,8 +43,6 @@
 
 import javassist.ClassPool;
 import javassist.CtClass;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
 
 import org.jboss.aop.advice.AdviceBinding;
 import org.jboss.aop.advice.AdviceStack;
@@ -61,7 +59,7 @@
 import org.jboss.aop.array.ArrayBinding;
 import org.jboss.aop.array.ArrayReplacement;
 import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
-import org.jboss.aop.classpool.AOPClassPoolRepository;
+import org.jboss.aop.classpool.ClassLoaderRepository;
 import org.jboss.aop.instrument.GeneratedAdvisorInstrumentor;
 import org.jboss.aop.instrument.Instrumentor;
 import org.jboss.aop.instrument.InstrumentorFactory;
@@ -84,6 +82,9 @@
 import org.jboss.aop.pointcut.ast.ClassExpression;
 import org.jboss.aop.util.AOPLock;
 import org.jboss.aop.util.UnmodifiableEmptyCollections;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.scoped.ScopedClassPoolFactory;
+import org.jboss.classpool.spi.ClassPoolRepository;
 import org.jboss.logging.Logger;
 import org.jboss.util.collection.WeakValueHashMap;
 import org.jboss.util.loading.Translator;
@@ -275,7 +276,7 @@
                String pruneit = System.getProperty("jboss.aop.prune", null);
                if (pruneit != null)
                {
-                  AOPClassPoolRepository.getInstance().setPrune((new Boolean(pruneit)).booleanValue());
+                  ClassPoolRepository.getInstance().setPrune(Boolean.valueOf(pruneit));
                }
                manager = new AspectManager();
                //Initialise frequently used fields needed by the top-level manager
@@ -286,7 +287,10 @@
                manager.includeInvisibleAnnotations = new ArrayList<String>();
                
 
-               AOPClassPoolRepository.getInstance().setAspectManager(manager);
+               ClassLoaderRepository classLoaderRepository = ClassLoaderRepository.getInstance();
+               ClassPoolRepository classPoolRepository = ClassPoolRepository.getInstance();
+               classLoaderRepository.setAspectManager(manager);
+               classPoolRepository.addClassPoolRepositoryCallback(classLoaderRepository);
 
                if (!verbose)
                {
@@ -762,9 +766,9 @@
 
    // Public -------------------------------------------------------
 
-   public static Map<ClassLoader, ClassPool> getRegisteredCLs()
+   public static Map<ClassLoader, ScopedClassPool> getRegisteredCLs()
    {
-      return AOPClassPoolRepository.getInstance().getRegisteredCLs();
+      return ClassPoolRepository.getInstance().getRegisteredCLs();
    }
 
    /**
@@ -772,7 +776,7 @@
     */
    public static void clearUnregisteredClassLoaders()
    {
-      AOPClassPoolRepository.getInstance().clearUnregisteredClassLoaders();
+      ClassPoolRepository.getInstance().clearUnregisteredClassLoaders();
    }
 
    /**
@@ -839,17 +843,17 @@
 
    public ClassPool registerClassLoader(ClassLoader ucl)
    {
-      return AOPClassPoolRepository.getInstance().registerClassLoader(ucl);
+      return ClassPoolRepository.getInstance().registerClassLoader(ucl);
    }
 
    protected void registerClass(Class<?> clazz)
    {
-      AOPClassPoolRepository.getInstance().registerClass(clazz);
+      ClassLoaderRepository.getInstance().registerClass(clazz);
    }
 
    public void unregisterClassLoader(ClassLoader cl)
    {
-      AOPClassPoolRepository.getInstance().unregisterClassLoader(cl);
+      ClassPoolRepository.getInstance().unregisterClassLoader(cl);
    }
 
    public ArrayList<String> getExclude()
@@ -947,22 +951,22 @@
 
    public static boolean getPrune()
    {
-      return AOPClassPoolRepository.getInstance().isPrune();
+      return ClassPoolRepository.getInstance().isPrune();
    }
 
    public static void setPrune(boolean prune)
    {
-      AOPClassPoolRepository.getInstance().setPrune(prune);
+      ClassPoolRepository.getInstance().setPrune(prune);
    }
 
    public static void setClassPoolFactory(ScopedClassPoolFactory factory)
    {
-      AOPClassPoolRepository.getInstance().setClassPoolFactory(factory);
+      ClassPoolRepository.getInstance().setClassPoolFactory(factory);
    }
 
    public static ScopedClassPoolFactory getClassPoolFactory()
    {
-      return AOPClassPoolRepository.getInstance().getClassPoolFactory();
+      return ClassPoolRepository.getInstance().getClassPoolFactory();
    }
 
    public boolean isNonAdvisableClassName(String classname)

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/ClassicWeavingStrategy.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/ClassicWeavingStrategy.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/ClassicWeavingStrategy.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,35 +1,36 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop;
 
-import org.jboss.aop.classpool.AOPClassPool;
+import javassist.ByteArrayClassPath;
+import javassist.CtClass;
+import javassist.NotFoundException;
+
 import org.jboss.aop.instrument.Instrumentor;
 import org.jboss.aop.instrument.InstrumentorFactory;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.spi.ClassPoolRepository;
 import org.jboss.logging.Logger;
 
-import javassist.ByteArrayClassPath;
-import javassist.CtClass;
-import javassist.NotFoundException;
-
 /**
  * Classic weaving.
  *
@@ -59,7 +60,7 @@
           {
              return null;
           }
-          AOPClassPool pool = (AOPClassPool) manager.registerClassLoader(loader);
+          ScopedClassPool pool = (ScopedClassPool) ClassPoolRepository.getInstance().registerClassLoader(loader);
           CtClass clazz = null;
           try
           {

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,37 +1,39 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop;
 
 
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.instrument.Instrumentor;
-import org.jboss.aop.instrument.InstrumentorFactory;
-import org.jboss.logging.Logger;
-
 import javassist.ByteArrayClassPath;
 import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.NotFoundException;
 
+import org.jboss.aop.instrument.Instrumentor;
+import org.jboss.aop.instrument.InstrumentorFactory;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.spi.AbstractClassPool;
+import org.jboss.classpool.spi.ClassPoolRepository;
+import org.jboss.logging.Logger;
+
 /**
  * Generated advisors need to load all the superclasses
  * before we load the actual class.
@@ -62,7 +64,7 @@
             return null;
          }
 
-         AOPClassPool pool = (AOPClassPool) manager.registerClassLoader(loader);
+         ScopedClassPool pool = (ScopedClassPool) ClassPoolRepository.getInstance().registerClassLoader(loader);
 
          CtClass clazz = obtainCtClassInfo(pool, className, classfileBuffer);
          
@@ -101,7 +103,7 @@
       }
    }
 
-   private CtClass obtainCtClassInfo(AOPClassPool pool, String className, byte[] classfileBuffer) throws NotFoundException
+   private CtClass obtainCtClassInfo(ScopedClassPool pool, String className, byte[] classfileBuffer) throws NotFoundException
    {
       try
       {
@@ -121,7 +123,7 @@
       }
    }
 
-   private CtClass instrumentClass(AspectManager manager, AOPClassPool pool, CtClass clazz, boolean isLoadedClass) throws NotFoundException, Exception
+   private CtClass instrumentClass(AspectManager manager, ScopedClassPool pool, CtClass clazz, boolean isLoadedClass) throws NotFoundException, Exception
    {
       if (pool.isClassLoadedButNotWoven(clazz.getName()))
       {
@@ -133,7 +135,7 @@
          if (superClass != null && !Instrumentor.implementsAdvised(clazz))
          {
             ClassPool superPool = superClass.getClassPool();
-            if (superPool instanceof AOPClassPool)
+            if (superPool != null && superPool instanceof AbstractClassPool)
             {
                AspectManager aspectManager = manager;
                if (manager instanceof Domain && superPool != pool)
@@ -141,7 +143,7 @@
                   //We are in a scoped classloader and the superclass is not
                   aspectManager = AspectManager.instance(superPool.getClassLoader());
                }
-               instrumentClass(aspectManager, (AOPClassPool)superPool, superClass, false);
+               instrumentClass(aspectManager, (ScopedClassPool) superPool, superClass, false);
             }
          }
 
@@ -178,7 +180,7 @@
             //info.getClazz().defrost();
          }
 
-         boolean transformed = clazz.isModified();
+         boolean transformed = isAdvised(pool, clazz);
          if (!transformed)
          {
             ClassAdvisor advisor =

Deleted: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPool.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPool.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPool.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,415 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.aop.classpool;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.util.ClassLoaderUtils;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class AOPClassPool extends ScopedClassPool
-{
-   protected final Logger logger = Logger.getLogger(this.getClass());
-   
-   /** Classnames of classes that will be created - we do not want to look for these in other pools.
-    * The main use for this is when a class is created in a parent pool, and we then want to 
-    * create a class with the same name in a parent-last child pool. As part of the create process
-    * javassist.ClassPool will check if that class is frozen (which in turn will call getCached()
-    * and get0()). If the classname exists in this map, get0() and getCached() should return null;   
-    */
-   protected final ConcurrentHashMap<String, String> generatedClasses = new ConcurrentHashMap<String, String>();
-
-   protected final ConcurrentHashMap<String, Boolean> localResources = new ConcurrentHashMap<String, Boolean>();
-
-   /** Classnames of classes that have been loaded, but were not woven */
-   protected final ConcurrentHashMap<String, Boolean> loadedButNotWovenClasses = new ConcurrentHashMap<String, Boolean>();
-
-   /** Causes the AOPClassPool.getCached() method to search all ClassPools registered in the repository */
-   public static final Class<SearchAllRegisteredLoadersSearchStrategy> SEARCH_ALL_STRATEGY = SearchAllRegisteredLoadersSearchStrategy.class;
-
-   /** Causes the AOPClassPool.getCached() method to search only itself */
-   public static final Class<SearchLocalLoaderLoaderSearchStrategy> SEARCH_LOCAL_ONLY_STRATEGY = SearchLocalLoaderLoaderSearchStrategy.class;
-   
-   private final AOPCLassPoolSearchStrategy searchStrategy;
-   
-   private final Map<AOPClassPool, Boolean> children = new WeakHashMap<AOPClassPool, Boolean>();
-   
-   static
-   {
-      ClassPool.doPruning = false;
-      ClassPool.releaseUnmodifiedClassFile = false;
-   }
-
-   public AOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
-   {
-      this(cl, src, repository, false);
-   }
-
-   protected AOPClassPool(ClassPool src, ScopedClassPoolRepository repository)
-   {
-      this(null, src, repository, true);
-   }
-
-   private AOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, boolean isTemp)
-   {
-      this(cl, src, repository, SEARCH_ALL_STRATEGY, isTemp);
-   }
-
-   public AOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, Class<? extends AOPCLassPoolSearchStrategy> searchStrategy)
-   {
-      this(cl, src, repository, searchStrategy, false);
-   }
-   
-   public AOPClassPool(ClassPool src, ScopedClassPoolRepository repository, Class<? extends AOPCLassPoolSearchStrategy> searchStrategy)
-   {
-      this(null, src, repository, searchStrategy, true);
-   }
-   
-   private AOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, Class<? extends AOPCLassPoolSearchStrategy> searchStrategy, boolean isTemp)
-   {
-      super(cl, src, repository, isTemp);
-      if (searchStrategy == SEARCH_ALL_STRATEGY)
-      {
-         this.searchStrategy = new SearchAllRegisteredLoadersSearchStrategy();
-      }
-      else if (searchStrategy == SEARCH_LOCAL_ONLY_STRATEGY)
-      {
-         this.searchStrategy = new SearchLocalLoaderLoaderSearchStrategy();
-      }
-      else
-      {
-         try
-         {
-            this.searchStrategy = searchStrategy.newInstance();
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException("Error instantiating search strategy class " + searchStrategy, e);
-         }
-      }
-      if (logger.isTraceEnabled()) logger.trace(this + " creating pool for loader " + cl + " searchStrategy:" + this.searchStrategy + " isTemp:" + isTemp);
-
-      registerWithParent();
-   }
-   
-   private void registerWithParent()
-   {
-      if (parent != null && parent instanceof AOPClassPool)
-      {
-         ((AOPClassPool)parent).children.put(this, Boolean.TRUE);
-      }
-   }
-   
-   private void unregisterWithParent()
-   {
-      if (parent != null && parent instanceof AOPClassPool)
-      {
-         ((AOPClassPool)parent).children.remove(this);
-      }
-   }
-   
-   public void registerGeneratedClass(String className)
-   {
-      generatedClasses.put(className, className);
-   }
-
-   public boolean isGeneratedClass(String className)
-   {
-      return generatedClasses.containsKey(className);
-   }
-   
-   public void doneGeneratingClass(String className)
-   {
-      generatedClasses.remove(className);
-   }
-
-   public void close()
-   {
-      super.close();
-      unregisterWithParent();
-      AOPClassPoolRepository.getInstance().perfomUnregisterClassLoader(getClassLoader());
-      for (Iterator<AOPClassPool> it = children.keySet().iterator() ; it.hasNext() ; )
-      {
-         AOPClassPool child = it.next();
-         it.remove();
-         ClassLoader loader = child.getClassLoader();
-         if (loader != null)
-         {
-            AspectManager.instance().unregisterClassLoader(loader);
-         }
-      }
-   }
-
-   public CtClass getCached(String classname)
-   {
-      return searchStrategy.getCached(classname);
-   }
-   
-   /**
-    * Make createCtClass public so that we can override it 
-    */
-   @Override
-   public CtClass createCtClass(String classname, boolean useCache)
-   {
-      boolean trace = logger.isTraceEnabled();
-      
-      if (trace) logger.trace(this + " attempting to create CtClass " + classname);
-      CtClass clazz = super.createCtClass(classname, useCache);
-      if (trace) logger.trace(this + " created CtClass " + getClassPoolLogStringForClass(clazz));
-      
-      return clazz;
-   }
-
-   @Override
-   public void cacheCtClass(String classname, CtClass c, boolean dynamic)
-   {
-      boolean trace = logger.isTraceEnabled();
-      if (trace) logger.trace(this + " caching " + classname);
-      super.cacheCtClass(classname, c, dynamic);
-      if (dynamic)
-      {
-         if (trace) logger.trace(this + " registering dynamic class " + classname);
-         doneGeneratingClass(classname);
-         String resourcename = getResourceName(classname);
-         localResources.put(resourcename, Boolean.TRUE);
-      }
-   }
-
-   protected boolean includeInGlobalSearch()
-   {
-      return true;
-   }
-
-   protected String getResourceName(String classname)
-   {
-      return ClassLoaderUtils.getResourceName(classname);
-   }
-
-   protected final boolean isLocalResource(String resourceName, boolean trace)
-   {
-      String classResourceName = resourceName;
-      Boolean isLocal = localResources.get(classResourceName);
-      if (isLocal != null)
-      {
-         if (trace) logger.trace(this + " " + resourceName + " is local " + isLocal);
-      
-         return isLocal.booleanValue();
-      }
-      boolean localResource = isLocalClassLoaderResource(classResourceName);
-      localResources.put(classResourceName, localResource ? Boolean.TRUE : Boolean.FALSE);
-      
-      if (trace) logger.trace(this + " " + resourceName + " is local " + localResource);
-      
-      return localResource;
-   }
-
-   protected boolean isLocalClassLoaderResource(String classResourceName)
-   {
-      return getClassLoader().getResource(classResourceName) != null;
-   }
-   
-   @Override
-   public synchronized CtClass getLocally(String classname)
-           throws NotFoundException
-   {
-      boolean trace = logger.isTraceEnabled();
-      if (trace) logger.trace(this + " attempting local get for " + classname);
-      softcache.remove(classname);
-      CtClass clazz = (CtClass) classes.get(classname);
-      if (trace && clazz != null)
-      {
-         logger.trace(this + " found " + classname + " in cache");
-      }
-      if (clazz == null)
-      {
-         clazz = createCtClass(classname, true);
-         if (clazz == null) throw new NotFoundException(classname);
-         lockInCache(clazz);//Avoid use of the softclasscache
-      }
-
-      return clazz;
-   }
-
-   @Override
-   protected CtClass getCachedLocally(String classname)
-   {
-      if (logger.isTraceEnabled()) logger.trace(this + " checking local cache for " + classname);
-      return super.getCachedLocally(classname);
-   }
-
-   @Override
-   public void lockInCache(CtClass c)
-   {
-      if (logger.isTraceEnabled()) logger.trace(this + " locking in cache " + c.getName());
-      super.lockInCache(c);
-   }
-
-   public void setClassLoadedButNotWoven(String classname)
-   {
-      loadedButNotWovenClasses.put(classname, Boolean.TRUE);
-   }
-
-   public boolean isClassLoadedButNotWoven(String classname)
-   {
-      return loadedButNotWovenClasses.get(classname) == Boolean.TRUE;
-   }
-
-   public static AOPClassPool createAOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
-   {
-      return (AOPClassPool)AspectManager.getClassPoolFactory().create(cl, src, repository);
-   }
-
-   public static AOPClassPool createAOPClassPool(ClassPool src, ScopedClassPoolRepository repository)
-   {
-      return (AOPClassPool)AspectManager.getClassPoolFactory().create(src, repository);
-   }
-
-   public String toString()
-   {
-      ClassLoader cl = null;
-      try
-      {
-         cl = getClassLoader();
-      }
-      catch(IllegalStateException ignore)
-      {
-      }
-      return this.getClass().getName() + "@" + System.identityHashCode(this) + " " + super.toString() + " - dcl:" + cl;
-   }
-
-   public CtClass internalGet0(String classname, boolean useCache) throws NotFoundException
-   {
-      return super.get0(classname, useCache);
-   }
-   
-   protected String getClassPoolLogStringForClass(CtClass clazz)
-   {
-      if (clazz == null)
-      {
-         return null;
-      }
-      if (clazz.getClassPool() == null)
-      {
-         return null;
-      }
-      return clazz.getClassPool().toString();
-   }
-
-   /**
-    * Contains the original AOPClassPool.getCached()
-    * 
-    */
-   private class SearchAllRegisteredLoadersSearchStrategy implements AOPCLassPoolSearchStrategy
-   {
-      Logger logger = Logger.getLogger(this.getClass());
-      public CtClass getCached(String classname)
-      {
-         boolean trace = logger.isTraceEnabled();
-         
-         if (trace) logger.trace(this + " " + AOPClassPool.this + " searching all pools for " + classname);
-         
-         CtClass clazz = getCachedLocally(classname);
-         if (clazz == null)
-         {
-            //TODO is this check really necessary 
-            boolean isLocal = false;
-
-            ClassLoader cl = getClassLoader0();
-
-            if (cl != null)
-            {
-               isLocal = isLocalResource(getResourceName(classname), trace);
-            }
-
-            if (!isLocal)
-            {
-               Object o = generatedClasses.get(classname);
-               if (o == null)
-               {
-                  Map<ClassLoader, ClassPool> registeredCLs = AspectManager.getRegisteredCLs();
-                  synchronized (registeredCLs)
-                  {
-                     for(ClassPool pl : AspectManager.getRegisteredCLs().values())
-                     {
-                        AOPClassPool pool = (AOPClassPool) pl;
-                        if (pool.isUnloadedClassLoader())
-                        {
-                           if (trace) logger.trace(this + " pool is unloaded " + pool);
-                           AspectManager.instance().unregisterClassLoader(pool.getClassLoader());
-                           continue;
-                        }
-
-                        //Do not check classpools for scoped classloaders
-                        if (!pool.includeInGlobalSearch())
-                        {
-                           if (trace) logger.trace(this + " pool is scoped " + pool);
-                           continue;
-                        }
-
-                        if (trace) logger.trace(this + " " + AOPClassPool.this + " searching for " + classname + " in " + pool);
-                        clazz = pool.getCachedLocally(classname);
-                        if (clazz != null)
-                        {
-                           break;
-                        }
-                     }
-                  }
-               }
-            }
-         }
-         if (trace) logger.trace(this + " " + AOPClassPool.this + " found " + classname + " in pool" + getClassPoolLogStringForClass(clazz));
-         return clazz;
-      }
-   }
-   
-   /**
-    * Checks only the AOPClassPool's cache 
-    */
-   private class SearchLocalLoaderLoaderSearchStrategy implements AOPCLassPoolSearchStrategy
-   {
-      Logger logger = Logger.getLogger(this.getClass());
-
-      public CtClass getCached(String classname)
-      {
-         boolean trace = logger.isTraceEnabled();
-         
-         if (trace) logger.trace(this + " " + AOPClassPool.this + " searching just this pool for " + classname);
-         CtClass clazz = getCachedLocally(classname);
-         if (trace) logger.trace(this + " " + AOPClassPool.this + " found " + classname + " in pool" + getClassPoolLogStringForClass(clazz));
-         return clazz;
-      }
-   }
-}

Deleted: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolFactory.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolFactory.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolFactory.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,47 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.aop.classpool;
-
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- *
- **/
-public class AOPClassPoolFactory implements ScopedClassPoolFactory
-{
-   public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
-   {
-      return new AOPClassPool(cl, src, repository);
-   }
-
-   public ScopedClassPool create(ClassPool src, ScopedClassPoolRepository repository)
-   {
-      return new AOPClassPool(src, repository);
-   }   
-}

Deleted: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,272 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.aop.classpool;
-
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.jboss.aop.Advisor;
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.SecurityActions;
-import org.jboss.aop.instrument.Instrumentor;
-import org.jboss.logging.Logger;
-
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
-import javassist.scopedpool.ScopedClassPoolRepositoryImpl;
-
-/**
- * Singleton classpool repository used by aop
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision$
- */
-public class AOPClassPoolRepository implements ScopedClassPoolRepository
-{
-   private static final Logger logger = Logger.getLogger(AOPClassPoolRepository.class);
-   
-   private final static AOPClassPoolRepository instance = new AOPClassPoolRepository();
-   
-   /** The classes per classppol */
-   protected final HashMap<ClassLoader, HashSet<Class<?>>> ucl2classes = new HashMap<ClassLoader, HashSet<Class<?>>>();
-
-   /** The top-level AspectManager this pool belongs to */
-   AspectManager manager;
-   
-   ScopedClassPoolRepository delegate;
-
-   public static AOPClassPoolRepository getInstance()
-   {
-      return instance;
-   }
-   
-   private AOPClassPoolRepository()
-   {
-      this.delegate = ScopedClassPoolRepositoryImpl.getInstance();
-      //This was needed when jboss-aop.jar was deployed in the jboss/lib directory since the AspectManager bean had no chance to initialise it
-      delegate.setClassPoolFactory(new AOPClassPoolFactory());
-//      if (!setJBossSpecificStartupVariables())
-//      {
-//         delegate.setClassPoolFactory(new AOPClassPoolFactory());
-//      }
-   }
-
-//   private boolean setJBossSpecificStartupVariables()
-//   {
-//      //We are running within JBoss 5, let's default to the JBossClassPoolFactory and set the ScopedClassPoolHelper
-//      //so that we get correct behaviour before the AspectManager service has been deployed
-//      try
-//      {
-//         Class jbcpf = Class.forName("org.jboss.aop.deployment.JBossClassPoolFactory");
-//         ScopedClassPoolFactory factory = (ScopedClassPoolFactory)jbcpf.newInstance();
-//         
-//         Class hlpr = Class.forName("org.jboss.aop.deployment.JBossScopedClassLoaderHelper");
-//         AOPScopedClassLoaderHelper helper = (AOPScopedClassLoaderHelper)hlpr.newInstance();
-//         delegate.setClassPoolFactory(factory);
-//         AspectManager.scopedCLHelper = helper;
-//         return true;
-//      }
-//      catch (Exception e)
-//      {
-//      }
-//      return false;//Not running in JBoss probably
-//   }
-   
-   public void setClassPoolFactory(ScopedClassPoolFactory factory)
-   {
-      delegate.setClassPoolFactory(factory);
-   }
-   
-   public ScopedClassPoolFactory getClassPoolFactory()
-   {
-      return delegate.getClassPoolFactory();
-   }
-
-   public boolean isPrune()
-   {
-      return delegate.isPrune();
-   }
-
-   public void setPrune(boolean prune)
-   {
-      delegate.setPrune(prune);
-   }
-
-   public ScopedClassPool createScopedClassPool(ClassLoader cl, ClassPool src)
-   {
-      return delegate.createScopedClassPool(cl, src);
-   }
-
-   public ClassPool findClassPool(ClassLoader cl)
-   {
-      return delegate.findClassPool(cl);
-   }
-
-   public void setAspectManager(AspectManager manager)
-   {
-      this.manager = manager;
-   }
-   
-   /**
-    * Get the registered classloaders
-    * 
-    * @return the registered classloaders
-    */
-   public Map<ClassLoader, ClassPool> getRegisteredCLs()
-   {
-      return delegate.getRegisteredCLs();
-   }
-
-   /**
-    * This method will check to see if a register classloader has been undeployed (as in JBoss)
-    */
-   public void clearUnregisteredClassLoaders()
-   {
-      delegate.clearUnregisteredClassLoaders();
-   }
-   
-   public ClassPool registerClassLoader(ClassLoader ucl)
-   {
-      return delegate.registerClassLoader(ucl);
-   }
-
-   public void unregisterClassLoader(ClassLoader cl)
-   {
-      delegate.unregisterClassLoader(cl);
-   }
-   
-   public void registerClass(Class<?> clazz)
-   {
-      ClassLoader classLoader = SecurityActions.getClassLoader(clazz);
-      HashSet<Class<?>> classes = ucl2classes.get(classLoader);
-      if (classes == null)
-      {
-         classes = new HashSet<Class<?>>();
-         ucl2classes.put(classLoader, classes);
-      }
-      classes.add(clazz);
-   }
-
-   public void perfomUnregisterClassLoader(ClassLoader cl)
-   {
-      if (System.getSecurityManager() == null)
-      {
-         UnregisterClassLoaderAction.NON_PRIVILEGED.unregister(this, cl);
-      }
-      else
-      {
-         UnregisterClassLoaderAction.PRIVILEGED.unregister(this, cl);
-      }
-   }
-   
-   private void doUnregisterClassLoader(ClassLoader cl)
-   {
-      synchronized (delegate.getRegisteredCLs())
-      {
-         HashSet<Class<?>> classes = ucl2classes.remove(cl);
-         if (classes != null)
-         {
-            for (Class<?> clazz : classes)
-            {
-               synchronized (manager.getAdvisors())
-               {
-                  WeakReference<Advisor> ref = manager.getAdvisors().get(clazz);
-                  if (ref != null)
-                  {
-                     Advisor advisor = ref.get();
-                     manager.getAdvisors().remove(clazz);
-                     if (advisor != null)
-                     {
-                        advisor.cleanup();
-                     }
-                  }
-                  Class<?> advisedClass = clazz;
-                  try
-                  {
-                     //The static advisor field should be the only remaining hard reference to the advisor
-                     Field f = advisedClass.getDeclaredField(Instrumentor.HELPER_FIELD_NAME);
-                     f.setAccessible(true);
-                     f.set(null, null);
-                  }
-                  catch(NoSuchFieldException e)
-                  {
-                     logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
-                  }
-                  catch(IllegalAccessException e)
-                  {
-                     logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
-                  }
-               }
-            }
-         }
-      }
-   }
-
-   
-   interface UnregisterClassLoaderAction
-   {
-      void unregister(AOPClassPoolRepository repository, ClassLoader loader);
-      
-      UnregisterClassLoaderAction PRIVILEGED = new UnregisterClassLoaderAction()
-      {
-         public void unregister(final AOPClassPoolRepository repository, final ClassLoader loader)
-         {
-            try
-            {
-               AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
-               {
-                  public Object run()
-                  {
-                     repository.doUnregisterClassLoader(loader);
-                     return null;
-                  }
-               });
-            }
-            catch (PrivilegedActionException e)
-            {
-               Exception ex = e.getException();
-               if (ex instanceof RuntimeException) 
-               { 
-                  throw (RuntimeException)ex;
-               }
-               throw new RuntimeException(ex);
-            }
-         }
-      };
-
-      UnregisterClassLoaderAction NON_PRIVILEGED = new UnregisterClassLoaderAction()
-      {
-         public void unregister(AOPClassPoolRepository repository, ClassLoader loader)
-         {
-            repository.doUnregisterClassLoader(loader);
-         }
-      };
-   }
-}

Copied: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/ClassLoaderRepository.java (from rev 102623, projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java)
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/ClassLoaderRepository.java	                        (rev 0)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/classpool/ClassLoaderRepository.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -0,0 +1,183 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.aop.classpool;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.SecurityActions;
+import org.jboss.aop.instrument.Instrumentor;
+import org.jboss.classpool.spi.ClassPoolRepositoryCallback;
+import org.jboss.logging.Logger;
+
+/**
+ * Singleton classpool repository used by aop
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ * @version $Revision$
+ */
+public class ClassLoaderRepository implements ClassPoolRepositoryCallback
+{
+   private static final Logger logger = Logger.getLogger(ClassLoaderRepository.class);
+   
+   private final static ClassLoaderRepository instance = new ClassLoaderRepository();
+   
+   /** The classes per classppol */
+   protected final HashMap<ClassLoader, HashSet<Class<?>>> ucl2classes = new HashMap<ClassLoader, HashSet<Class<?>>>();
+
+   /** The top-level AspectManager this pool belongs to */
+   AspectManager manager;
+   
+   public static ClassLoaderRepository getInstance()
+   {
+      return instance;
+   }
+   
+   private ClassLoaderRepository() {}
+
+   public void setAspectManager(AspectManager manager)
+   {
+      this.manager = manager;
+   }
+
+   
+   public void registerClass(Class<?> clazz)
+   {
+      ClassLoader classLoader = SecurityActions.getClassLoader(clazz);
+      HashSet<Class<?>> classes = ucl2classes.get(classLoader);
+      if (classes == null)
+      {
+         classes = new HashSet<Class<?>>();
+         ucl2classes.put(classLoader, classes);
+      }
+      classes.add(clazz);
+   }
+
+   public void classLoaderRegistered(ClassLoader classLoader)
+   {
+      // do nothing
+   }
+
+   public void classLoaderUnregistered(ClassLoader classLoader)
+   {
+      if (System.getSecurityManager() == null)
+      {
+         UnregisterClassLoaderAction.NON_PRIVILEGED.unregister(this, classLoader);
+      }
+      else
+      {
+         UnregisterClassLoaderAction.PRIVILEGED.unregister(this, classLoader);
+      }
+   }
+   
+   private void doUnregisterClassLoader(ClassLoader cl)
+   {
+      synchronized (this)
+      {
+         HashSet<Class<?>> classes = ucl2classes.remove(cl);
+         if (classes != null)
+         {
+            for (Class<?> clazz : classes)
+            {
+               synchronized (manager.getAdvisors())
+               {
+                  WeakReference<Advisor> ref = manager.getAdvisors().get(clazz);
+                  if (ref != null)
+                  {
+                     Advisor advisor = ref.get();
+                     manager.getAdvisors().remove(clazz);
+                     if (advisor != null)
+                     {
+                        advisor.cleanup();
+                     }
+                  }
+                  Class<?> advisedClass = clazz;
+                  try
+                  {
+                     //The static advisor field should be the only remaining hard reference to the advisor
+                     Field f = advisedClass.getDeclaredField(Instrumentor.HELPER_FIELD_NAME);
+                     f.setAccessible(true);
+                     f.set(null, null);
+                  }
+                  catch(NoSuchFieldException e)
+                  {
+                     logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
+                  }
+                  catch(IllegalAccessException e)
+                  {
+                     logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
+                  }
+               }
+            }
+         }
+      }
+   }
+
+   
+   interface UnregisterClassLoaderAction
+   {
+      void unregister(ClassLoaderRepository repository, ClassLoader loader);
+      
+      UnregisterClassLoaderAction PRIVILEGED = new UnregisterClassLoaderAction()
+      {
+         public void unregister(final ClassLoaderRepository repository, final ClassLoader loader)
+         {
+            try
+            {
+               AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
+               {
+                  public Object run()
+                  {
+                     repository.doUnregisterClassLoader(loader);
+                     return null;
+                  }
+               });
+            }
+            catch (PrivilegedActionException e)
+            {
+               Exception ex = e.getException();
+               if (ex instanceof RuntimeException) 
+               { 
+                  throw (RuntimeException)ex;
+               }
+               throw new RuntimeException(ex);
+            }
+         }
+      };
+
+      UnregisterClassLoaderAction NON_PRIVILEGED = new UnregisterClassLoaderAction()
+      {
+         public void unregister(ClassLoaderRepository repository, ClassLoader loader)
+         {
+            repository.doUnregisterClassLoader(loader);
+         }
+      };
+   }
+}

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/contrib/IDEClassPoolFactory.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/contrib/IDEClassPoolFactory.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/contrib/IDEClassPoolFactory.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,24 +1,24 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.contrib;
 
 import java.io.IOException;
@@ -32,11 +32,11 @@
 import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.LoaderClassPath;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
 
-import org.jboss.aop.classpool.AOPClassPool;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.scoped.ScopedClassPoolFactory;
+import org.jboss.classpool.scoped.ScopedClassPoolRepository;
+import org.jboss.classpool.spi.AbstractClassPool;
 
 /**
  * @author Marshall
@@ -77,7 +77,7 @@
       }
    }
 
-   private class SimpleClassPool extends AOPClassPool
+   private class SimpleClassPool extends AbstractClassPool
    {
       private Loader loader;
 

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/eclipsesupport/Agent.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/eclipsesupport/Agent.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/eclipsesupport/Agent.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,33 +1,32 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.eclipsesupport;
 
+import java.lang.instrument.Instrumentation;
+
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.standalone.StandaloneClassPoolFactory;
+import org.jboss.classpool.spi.ClassPoolRepository;
 
-import java.lang.instrument.Instrumentation;
-
-import javassist.scopedpool.ScopedClassPoolRepositoryImpl;
-
 /**
  * An Agent for installing the appropriate hooks into eclipse to make the handling of tests easier 
  *
@@ -43,7 +42,7 @@
       AspectManager.setClassPoolFactory(factory);
       // necessary for configuration
       AspectManager.instance();
-      ScopedClassPoolRepositoryImpl.getInstance().setPrune(false);
+      ClassPoolRepository.getInstance().setPrune(false);
       inst.addTransformer(new EclipseTestTransformer());
    }
 }
\ No newline at end of file

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/ClassicInstrumentor.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/ClassicInstrumentor.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/ClassicInstrumentor.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,27 +1,28 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 import javassist.CannotCompileException;
+import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtField;
 import javassist.CtMethod;
@@ -31,7 +32,6 @@
 
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.ClassAdvisor;
-import org.jboss.aop.classpool.AOPClassPool;
 
 /**
  * Comment
@@ -47,7 +47,7 @@
    public static final String HELPER_CLASS_NAME =
            Instrumentor.AOP_PACKAGE + ".ClassAdvisor";
    
-   public ClassicInstrumentor(AOPClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
+   public ClassicInstrumentor(ClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
    {
       super(pool, 
             manager, 

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/FieldAccessTransformer.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/FieldAccessTransformer.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/FieldAccessTransformer.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,24 +1,24 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 import java.util.Collection;
@@ -26,6 +26,7 @@
 import java.util.List;
 
 import javassist.CannotCompileException;
+import javassist.ClassPool;
 import javassist.CodeConverter;
 import javassist.CtClass;
 import javassist.CtField;
@@ -40,7 +41,6 @@
 
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.ClassAdvisor;
-import org.jboss.aop.classpool.AOPClassPool;
 import org.jboss.aop.util.Advisable;
 
 /**
@@ -507,7 +507,7 @@
    protected CtMethod buildReadWrapperPlaceHolder(CtClass clazz, CtField field, String wrapperName, int mod)
    throws NotFoundException, CannotCompileException
    {
-      AOPClassPool classPool = (AOPClassPool) instrumentor.getClassPool();
+      ClassPool classPool = instrumentor.getClassPool();
 
       CtClass ftype = field.getType();
       CtClass[] readParam = new CtClass[]{classPool.get("java.lang.Object")};
@@ -574,7 +574,7 @@
    protected CtMethod buildWriteWrapperPlaceHolder(CtClass clazz, CtField field, String wrapperName, int mod)
    throws NotFoundException, CannotCompileException
    {
-      AOPClassPool classPool = (AOPClassPool) instrumentor.getClassPool();
+      ClassPool classPool = instrumentor.getClassPool();
 
       CtClass ftype = field.getType();
 

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,27 +1,28 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 import javassist.CannotCompileException;
+import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtConstructor;
 import javassist.CtField;
@@ -41,7 +42,6 @@
 import org.jboss.aop.MethodByConInfo;
 import org.jboss.aop.MethodByMethodInfo;
 import org.jboss.aop.MethodInfo;
-import org.jboss.aop.classpool.AOPClassPool;
 import org.jboss.logging.Logger;
 
 /**
@@ -88,7 +88,7 @@
    CtClass genadvisor;
    CtClass genInstanceAdvisor;
 
-   public GeneratedAdvisorInstrumentor(AOPClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
+   public GeneratedAdvisorInstrumentor(ClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
    {
       super(pool, manager, joinpointClassifier, observer);
    }

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/Instrumentor.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/Instrumentor.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/Instrumentor.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,24 +1,24 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 import java.util.ArrayList;
@@ -54,14 +54,13 @@
 import org.jboss.aop.annotation.compiler.AnnotationInfoCreator;
 import org.jboss.aop.array.ArrayAdvisor;
 import org.jboss.aop.array.ArrayReplacement;
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.classpool.AOPClassPoolRepository;
 import org.jboss.aop.introduction.AnnotationIntroduction;
 import org.jboss.aop.introduction.InterfaceIntroduction;
 import org.jboss.aop.util.Advisable;
 import org.jboss.aop.util.CtConstructorComparator;
 import org.jboss.aop.util.CtFieldComparator;
 import org.jboss.aop.util.JavassistMethodHashing;
+import org.jboss.classpool.spi.ClassPoolRepository;
 import org.jboss.logging.Logger;
 
 /**
@@ -103,7 +102,7 @@
     */
    public static final String HELPER_FIELD_NAME = "aop$classAdvisor" + ClassAdvisor.NOT_TRANSFORMABLE_SUFFIX;
 
-   protected AOPClassPool classPool;
+   protected ClassPool classPool;
    protected boolean basicsSet = false;
 
 
@@ -126,7 +125,7 @@
     * @param observer need be notified of every joinpoint wrapping caused only
     * by pointcuts dynamicaly added.
     */
-   protected Instrumentor(AOPClassPool pool,
+   protected Instrumentor(ClassPool pool,
          AspectManager manager,
          JoinpointClassifier joinpointClassifier,
          DynamicTransformationObserver observer)
@@ -619,7 +618,7 @@
       String ref = null;
       try
       {
-         AOPClassPool pool = AOPClassPool.createAOPClassPool(clazz.getClassPool(), AOPClassPoolRepository.getInstance());
+         ClassPool pool = ClassPoolRepository.getInstance().getClassPoolFactory().create(clazz.getClassPool(), ClassPoolRepository.getInstance());
 
          //Class.getRefClasses() only gets classes explicitly referenced in the class. We need to check the super classes and do some extra handling
          for (ReferenceClassIterator it = new ReferenceClassIterator(clazz.getRefClasses()) ; it.hasNext() ; )
@@ -1015,7 +1014,7 @@
          // registers the classes bytecodes to be hot swapped
          for (CtClass clazz : classes)
          {
-            AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
+            ClassPool classPool = clazz.getClassPool();
             clazz.defrost();
             hotSwapper.registerChange(classPool.getClassLoader().loadClass(clazz.getName()),
                   clazz.toBytecode());
@@ -1108,7 +1107,7 @@
    public void convertProcessedClasses(HotSwapper hotSwapper, CtClass clazz,
          Collection<CtField> fieldReads, Collection<CtField> fieldWrites, boolean constructor)
    {
-      AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
+      ClassPool classPool = clazz.getClassPool();
       CodeConverter codeConverter = new CodeConverter();
       for (CtField field : fieldReads)
       {

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/InstrumentorFactory.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/InstrumentorFactory.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/InstrumentorFactory.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,30 +1,31 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 import java.lang.reflect.Constructor;
 
+import javassist.ClassPool;
+
 import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.AOPClassPool;
 import org.jboss.logging.Logger;
 
 /**
@@ -41,7 +42,7 @@
    
    protected static Constructor<?> otherInstrumentorConstructor;
    
-   private static final Class<?>[] CONSTRUCTOR_SIG = new Class[] {AOPClassPool.class, AspectManager.class, JoinpointClassifier.class, DynamicTransformationObserver.class};
+   private static final Class<?>[] CONSTRUCTOR_SIG = new Class[] {ClassPool.class, AspectManager.class, JoinpointClassifier.class, DynamicTransformationObserver.class};
    
    public static void initialise(String property)
    {
@@ -95,7 +96,7 @@
       return instrumentor;
    }
    
-   public static Instrumentor getInstrumentor(AOPClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
+   public static Instrumentor getInstrumentor(ClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
    {
       if (instrumentor == InstrumentorEnum.CLASSIC)
       {

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/MethodExecutionTransformer.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/MethodExecutionTransformer.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/MethodExecutionTransformer.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,24 +1,24 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 import java.lang.reflect.Method;
@@ -38,9 +38,9 @@
 import javassist.bytecode.annotation.Annotation;
 
 import org.jboss.aop.ClassAdvisor;
-import org.jboss.aop.classpool.AOPClassPool;
 import org.jboss.aop.util.Advisable;
 import org.jboss.aop.util.JavassistMethodHashing;
+import org.jboss.classpool.spi.AbstractClassPool;
 
 /**
  * Comment
@@ -166,7 +166,7 @@
       for (org.jboss.aop.MethodInfo methodInfo : methodInfos)
       {
          Method method = methodInfo.getMethod();
-         AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
+         AbstractClassPool classPool = (AbstractClassPool) clazz.getClassPool();
          Class<?>[] parameterTypes = method.getParameterTypes();
          CtClass[] javassistParameterTypes = new CtClass[parameterTypes.length];
          for (int i = 0; i < parameterTypes.length; i++)
@@ -212,7 +212,7 @@
       for (org.jboss.aop.MethodInfo methodInfo : methodInfos)
       {
          Method method = methodInfo.getMethod();
-         AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
+         AbstractClassPool classPool = (AbstractClassPool) clazz.getClassPool();
          Class<?>[] parameterTypes = method.getParameterTypes();
          CtClass[] javassistParameterTypes = new CtClass[parameterTypes.length];
          for (int i = 0; i < parameterTypes.length; i++)

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedCallerInvocations.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedCallerInvocations.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedCallerInvocations.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,28 +1,29 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 
 import javassist.CannotCompileException;
+import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtConstructor;
 import javassist.CtField;
@@ -31,7 +32,6 @@
 import javassist.Modifier;
 import javassist.NotFoundException;
 
-import org.jboss.aop.classpool.AOPClassPool;
 import org.jboss.logging.Logger;
 
 /**
@@ -105,7 +105,7 @@
          CtMethod method, String invocationClassName, String callerDescription)
    throws NotFoundException, CannotCompileException
    {
-      AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+      ClassPool pool = instrumentor.getClassPool();
       CtClass methodInvocation = pool.get(invocationClassName);
    
       ////////////////
@@ -156,7 +156,7 @@
          CtConstructor con, String invocationClassName, String callerDescription)
    throws NotFoundException, CannotCompileException
    {
-      AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+      ClassPool pool = instrumentor.getClassPool();
       CtClass conInvocation = pool.get(invocationClassName);
    
       ////////////////

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructionInvocations.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructionInvocations.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructionInvocations.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,35 +1,34 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 
+import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtConstructor;
 import javassist.CtMethod;
 import javassist.CtNewConstructor;
 import javassist.CtNewMethod;
 
-import org.jboss.aop.classpool.AOPClassPool;
-
 /**
  * Comment
  *
@@ -54,7 +53,7 @@
          Instrumentor instrumentor, CtClass clazz, CtConstructor con, int index)
    throws Exception
    {
-      AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+      ClassPool pool = instrumentor.getClassPool();
       CtClass conInvocation = pool.get("org.jboss.aop.joinpoint.ConstructionInvocation");
       
       ////////////////
@@ -73,6 +72,8 @@
             break;
          }
       }
+      if (template == null)
+         throw new IllegalStateException("Could not find template");
       CtConstructor icon = CtNewConstructor.make(template.getParameterTypes(),
             template.getExceptionTypes(), invocation);
       invocation.addConstructor(icon);

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructorInvocations.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructorInvocations.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructorInvocations.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,27 +1,28 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 import javassist.CannotCompileException;
+import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtConstructor;
 import javassist.CtMethod;
@@ -29,8 +30,6 @@
 import javassist.CtNewMethod;
 import javassist.NotFoundException;
 
-import org.jboss.aop.classpool.AOPClassPool;
-
 /**
  * Comment
  *
@@ -55,7 +54,7 @@
          CtClass clazz, CtConstructor con, int index)
    throws NotFoundException, CannotCompileException
    {
-      AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+      ClassPool pool = instrumentor.getClassPool();
       CtClass conInvocation = pool.get("org.jboss.aop.joinpoint.ConstructorInvocation");
 
       ////////////////

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedFieldInvocations.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedFieldInvocations.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedFieldInvocations.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,29 +1,26 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.util.JavassistToReflect;
-
 import javassist.CannotCompileException;
 import javassist.ClassPool;
 import javassist.CtClass;
@@ -33,6 +30,8 @@
 import javassist.Modifier;
 import javassist.NotFoundException;
 
+import org.jboss.aop.util.JavassistToReflect;
+
 /**
  * Comment
  *
@@ -108,7 +107,7 @@
 
    protected static String createOptimizedInvocationClass(Instrumentor instrumentor, CtClass clazz, CtField field, boolean get) throws Exception
    {
-      AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+      ClassPool pool = instrumentor.getClassPool();
       CtClass fieldInvocation =
               get
               ? pool.get("org.jboss.aop.joinpoint.FieldReadInvocation")

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedInvocations.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedInvocations.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedInvocations.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,35 +1,34 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 
 import javassist.CannotCompileException;
+import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtConstructor;
 import javassist.CtNewConstructor;
 import javassist.NotFoundException;
 
-import org.jboss.aop.classpool.AOPClassPool;
-
 /**
  * Comment
  *
@@ -38,15 +37,20 @@
  */
 public abstract class OptimizedInvocations
 {
-   public static void defrostClassIfExists(AOPClassPool pool, String className)
+   public static void defrostClassIfExists(ClassPool pool, String className)
    {
       //In some cases we get a class frozen exception. I guess if the invocation class 
       //existed, method was unwrapped and the wrapped again
-      CtClass existing = pool.getCached(className);
-      if (existing != null)
+      // I replaced getCached by get (JBAOP-772)
+      try
       {
+         CtClass existing = pool.getCtClass(className);
          existing.defrost();
       }
+      catch (NotFoundException e)
+      {
+         // ignore; class does not exist
+      }
    }
 
    /**
@@ -58,7 +62,7 @@
     * @param superInvocation The super class of this invocation
     * @return The created invocation class
     */
-   public static CtClass makeInvocationClass(AOPClassPool pool, 
+   public static CtClass makeInvocationClass(ClassPool pool, 
          boolean makeInnerClass, 
          CtClass outerClass, 
          String className, 
@@ -81,7 +85,7 @@
       return invocation;
    }
    
-   public static CtClass makeInvocationClassNoCtors(AOPClassPool pool, 
+   public static CtClass makeInvocationClassNoCtors(ClassPool pool, 
          boolean makeInnerClass, 
          CtClass outerClass, 
          String className, 

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedMethodInvocations.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedMethodInvocations.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/OptimizedMethodInvocations.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,29 +1,30 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 import java.lang.reflect.Method;
 
 import javassist.CannotCompileException;
+import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtField;
 import javassist.CtMethod;
@@ -31,8 +32,6 @@
 import javassist.Modifier;
 import javassist.NotFoundException;
 
-import org.jboss.aop.classpool.AOPClassPool;
-
 /**
  * Comment
  *
@@ -67,7 +66,7 @@
          CtClass clazz, CtMethod method, CtMethod notAdvisedMethod)
    throws NotFoundException, CannotCompileException
    {
-      AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+      ClassPool pool = instrumentor.getClassPool();
       CtClass methodInvocation = pool.get("org.jboss.aop.joinpoint.MethodInvocation");
    
       ////////////////

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/TransformerCommon.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/TransformerCommon.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/instrument/TransformerCommon.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,24 +1,24 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.instrument;
 
 import java.io.File;
@@ -40,8 +40,8 @@
 import javassist.NotFoundException;
 
 import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.AOPClassPool;
 import org.jboss.aop.standalone.Compiler;
+import org.jboss.classpool.spi.AbstractClassPool;
 
 /**
  *  A few handy methods and common things used by the other Transformers
@@ -258,27 +258,27 @@
 
    private static void registerGeneratedClass(ClassPool pool, String name)
    {
-      AOPClassPool aopPool = getAOPClassPool(pool);
-      if (aopPool != null)
+      AbstractClassPool classPool = getAbstractClassPool(pool);
+      if (classPool != null)
       {
-         aopPool.registerGeneratedClass(name);
+         classPool.registerGeneratedClass(name);
       }
    }
    
    private static void unregisterGeneratedClass(ClassPool pool, String name)
    {
-      AOPClassPool aopPool = getAOPClassPool(pool);
-      if (aopPool != null)
+      AbstractClassPool classPool = getAbstractClassPool(pool);
+      if (classPool != null)
       {
-         aopPool.doneGeneratingClass(name);
+         classPool.doneGeneratingClass(name);
       }
    }
    
-   private static AOPClassPool getAOPClassPool(ClassPool pool)
+   private static AbstractClassPool getAbstractClassPool(ClassPool pool)
    {
-      if (pool instanceof AOPClassPool)
+      if (pool instanceof AbstractClassPool)
       {
-         return (AOPClassPool)pool;
+         return (AbstractClassPool)pool;
       }
       return null;
    }

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPool.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPool.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPool.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,33 +1,33 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.standalone;
 
 import javassist.CannotCompileException;
 import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPoolRepository;
 
-import org.jboss.aop.classpool.AOPClassPool;
+import org.jboss.classpool.scoped.ScopedClassPoolRepository;
+import org.jboss.classpool.spi.AbstractClassPool;
 
 /**
  * Comment
@@ -36,7 +36,7 @@
  * @version $Revision: 46253 $
  * @deprecated Will be removed when Javassist is upgraded past 3.0 beta2
  */
-public class StandaloneClassPool extends AOPClassPool
+public class StandaloneClassPool extends AbstractClassPool
 {
    public StandaloneClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
    {

Modified: projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPoolFactory.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPoolFactory.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPoolFactory.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,46 +1,45 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.aop.standalone;
 
-import org.jboss.aop.classpool.AOPClassPoolFactory;
-
 import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolRepository;
 
+import org.jboss.classpool.scoped.ScopedClassPoolRepository;
+import org.jboss.classpool.spi.AbstractClassPoolFactory;
+
 /**
  * Comment
  *
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision: 46253 $
  */
-public class StandaloneClassPoolFactory extends AOPClassPoolFactory
+public class StandaloneClassPoolFactory extends AbstractClassPoolFactory
 {
-   public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
+   public StandaloneClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
    {
       return new StandaloneClassPool(cl, src, repository);
    }
 
-   public ScopedClassPool create(ClassPool src, ScopedClassPoolRepository repository)
+   public StandaloneClassPool create(ClassPool src, ScopedClassPoolRepository repository)
    {
       return new StandaloneClassPool(src, repository);
    }

Modified: projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/jdk15/dynamic/common/scenario/ScenarioRunner.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/jdk15/dynamic/common/scenario/ScenarioRunner.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/jdk15/dynamic/common/scenario/ScenarioRunner.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,30 +1,29 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.test.aop.jdk15.dynamic.common.scenario;
 
 
 import java.util.Map;
 
-import javassist.ClassPool;
 import javassist.CtClass;
 import javassist.CtField;
 import javassist.CtMethod;
@@ -34,8 +33,8 @@
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.ClassAdvisor;
 import org.jboss.aop.advice.AdviceBinding;
-import org.jboss.aop.classpool.AOPClassPool;
 import org.jboss.aop.pointcut.ast.ParseException;
+import org.jboss.classpool.scoped.ScopedClassPool;
 import org.jboss.test.aop.jdk15.dynamic.common.BindingInterceptor;
 import org.jboss.test.aop.jdk15.dynamic.common.InstanceInterceptor;
 import org.jboss.test.aop.jdk15.dynamic.common.POJOWrappingInfo;
@@ -325,8 +324,8 @@
     */
    private static void loadPOJOData()
    {
-      Map<ClassLoader, ClassPool> cls = AspectManager.getRegisteredCLs();
-      AOPClassPool classPool = (AOPClassPool) cls.get(POJO.class.getClassLoader());
+      Map<ClassLoader, ScopedClassPool> cls = AspectManager.getRegisteredCLs();
+      ScopedClassPool classPool = cls.get(POJO.class.getClassLoader());
       try
       {
          POJO_CLASS = classPool.getLocally(POJO.class.getName());

Modified: projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/stress/weavetest/GenerateClassesScenario.java
===================================================================
--- projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/stress/weavetest/GenerateClassesScenario.java	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/aop/src/test/java/org/jboss/test/aop/stress/weavetest/GenerateClassesScenario.java	2010-03-23 12:59:27 UTC (rev 102779)
@@ -1,24 +1,24 @@
 /*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors. 
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
 package org.jboss.test.aop.stress.weavetest;
 
 import java.io.File;
@@ -34,7 +34,7 @@
 import javassist.CtNewMethod;
 import javassist.Modifier;
 
-import org.jboss.aop.classpool.AOPClassPoolRepository;
+import org.jboss.classpool.spi.ClassPoolRepository;
 import org.jboss.test.aop.stress.AbstractScenario;
 import org.jboss.test.aop.stress.SkipWarmup;
 
@@ -132,7 +132,7 @@
    {
       initDirectory();
       
-      pool = AOPClassPoolRepository.getInstance().registerClassLoader(this.getClass().getClassLoader());
+      pool = ClassPoolRepository.getInstance().registerClassLoader(this.getClass().getClassLoader());
       packageName = this.getClass().getPackage().getName();
       CtClass clazz = pool.get("org.jboss.test.aop.stress.weavetest.TemplatePOJO");
       if (clazz == null)

Modified: projects/aop/branches/Branch_2_2/asintegration-core/pom.xml
===================================================================
--- projects/aop/branches/Branch_2_2/asintegration-core/pom.xml	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/asintegration-core/pom.xml	2010-03-23 12:59:27 UTC (rev 102779)
@@ -23,69 +23,12 @@
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.2</version>
-        <executions>
-          <execution>
-            <id>test-jar</id>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <excludes>
-            <exclude>org/jboss/test/aop/classpool/support/a/A.class</exclude>
-            <exclude>org/jboss/test/aop/classpool/support/b/B.class</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <version>1.2</version>
-        <executions>
-          <execution>
-            <id>create-test-jars</id>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <phase>process-test-classes</phase>
-            <configuration>
-              <tasks>
-                <property name="test.jar.suffix" value="-test-classpool-" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}a.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/support/a/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}b.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/support/b/*.class" />
-               <delete dir="${project.build.testOutputDirectory}/org/jboss/test/aop/classpool/support/a" />
-               <delete dir="${project.build.testOutputDirectory}/org/jboss/test/aop/classpool/support/b" />
-              </tasks>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <version>2.5</version>
         <configuration>
-          <testFailureIgnore>true</testFailureIgnore>
-          <forkMode>always</forkMode>
+          <skip>true</skip>
         </configuration>
       </plugin>
-      <plugin>
-       <groupId>org.apache.maven.plugins</groupId>
-       <artifactId>maven-surefire-report-plugin</artifactId>
-       <version>2.5</version>
-       <executions>
-         <execution>
-           <id>surefire-report</id>
-           <goals>
-             <goal>report-only</goal>
-           </goals>
-           <phase>package</phase>
-         </execution>
-       </executions>
-     </plugin>
     </plugins>
   </build>
   

Modified: projects/aop/branches/Branch_2_2/asintegration-jmx/pom.xml
===================================================================
--- projects/aop/branches/Branch_2_2/asintegration-jmx/pom.xml	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/asintegration-jmx/pom.xml	2010-03-23 12:59:27 UTC (rev 102779)
@@ -23,70 +23,12 @@
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.3</version>
-        <executions>
-          <execution>
-            <id>test-jar</id>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <excludes>
-            <exclude>org/jboss/test/aop/classpool/ucl/support/excluded/**</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <version>2.5</version>
         <configuration>
-          <testFailureIgnore>true</testFailureIgnore>
-          <forkMode>always</forkMode>
+          <skipTests>true</skipTests>
         </configuration>
       </plugin>
-      <plugin>
-       <groupId>org.apache.maven.plugins</groupId>
-       <artifactId>maven-surefire-report-plugin</artifactId>
-       <version>2.5</version>
-       <executions>
-         <execution>
-           <id>surefire-report</id>
-           <goals>
-             <goal>report-only</goal>
-           </goals>
-           <phase>package</phase>
-         </execution>
-       </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <version>1.3</version>
-        <executions>
-          <execution>
-            <id>create-test-jars</id>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <phase>process-test-classes</phase>
-            <configuration>
-              <tasks>
-                <property name="test.jar.suffix" value="-test-classpool-" />                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}a1.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/ucl/support/excluded/a/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}a2.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/ucl/support/excluded/a/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}b1.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/ucl/support/excluded/b/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}b2.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/ucl/support/excluded/b/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}c1.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/ucl/support/excluded/c/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}c2.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/ucl/support/excluded/c/*.class" />
-               <delete dir="${project.build.testOutputDirectory}/org/jboss/test/aop/classpool/ucl/support/excluded" />
-              </tasks>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
   </build>
   
@@ -100,6 +42,10 @@
       <artifactId>javassist</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.jboss.classpool</groupId>
+      <artifactId>jboss-classpool-ucl</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.aop</groupId>
       <artifactId>jboss-aop</artifactId>
     </dependency>

Modified: projects/aop/branches/Branch_2_2/asintegration-mc/pom.xml
===================================================================
--- projects/aop/branches/Branch_2_2/asintegration-mc/pom.xml	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/asintegration-mc/pom.xml	2010-03-23 12:59:27 UTC (rev 102779)
@@ -84,30 +84,6 @@
               <goal>run</goal>
             </goals>
             <phase>process-test-classes</phase>
-            <configuration>
-              <tasks>
-                <property name="test.jar.suffix" value="-test-classpool-" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}a1.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/jbosscl/support/excluded/a/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}a2.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/jbosscl/support/excluded/a/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}b1.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/jbosscl/support/excluded/b/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}b2.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/jbosscl/support/excluded/b/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}c1.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/jbosscl/support/excluded/c/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}c2.jar" basedir="${project.build.testOutputDirectory}" includes="org/jboss/test/aop/classpool/jbosscl/support/excluded/c/*.class" />
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}replacereferences-parent.jar">
-                  <fileset dir="${project.build.testOutputDirectory}">
-                     <include name="org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/**" />
-                     <exclude name="org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/child/*.class" />
-                  </fileset>
-                </jar>
-                <jar destfile="${project.build.directory}/${artifactId}${test.jar.suffix}replacereferences-child.jar">
-                  <fileset dir="${project.build.testOutputDirectory}">
-                     <include name="org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/**" />
-                     <exclude name="org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/parent/ParentCaller.class" />
-                  </fileset>
-                </jar>
-                <delete dir="${project.build.testOutputDirectory}/org/jboss/test/aop/classpool/jbosscl/support/excluded" />
-              </tasks>
-            </configuration>
           </execution>
         </executions>
       </plugin>
@@ -120,6 +96,10 @@
       <artifactId>javassist</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.jboss.classpool</groupId>
+      <artifactId>jboss-classpool-jbosscl</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.aop</groupId>
       <artifactId>jboss-aop</artifactId>
     </dependency>

Modified: projects/aop/branches/Branch_2_2/build/pom.xml
===================================================================
--- projects/aop/branches/Branch_2_2/build/pom.xml	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/build/pom.xml	2010-03-23 12:59:27 UTC (rev 102779)
@@ -16,6 +16,14 @@
       <artifactId>jboss-aop</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.jboss.classpool</groupId>
+      <artifactId>jboss-classpool-jbosscl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.classpool</groupId>
+      <artifactId>jboss-classpool-ucl</artifactId>
+    </dependency>
+    <dependency>
       <groupId>com.google.code</groupId>
       <artifactId>jarjar</artifactId>
     </dependency>

Modified: projects/aop/branches/Branch_2_2/pom.xml
===================================================================
--- projects/aop/branches/Branch_2_2/pom.xml	2010-03-23 12:53:25 UTC (rev 102778)
+++ projects/aop/branches/Branch_2_2/pom.xml	2010-03-23 12:59:27 UTC (rev 102779)
@@ -21,6 +21,7 @@
   
   <properties>
     <version.javassist.javassist>3.11.0.GA</version.javassist.javassist>
+    <version.org.jboss.classpool>1.0.0.Alpha4</version.org.jboss.classpool>
     <version.org.jboss.jbossas>6.0.0.20100216-M2</version.org.jboss.jbossas>
     <version.org.jboss.jboss-common-core>2.2.17.GA</version.org.jboss.jboss-common-core>
     <version.org.jboss.cl>2.2.0.Alpha4</version.org.jboss.cl>
@@ -136,6 +137,26 @@
         <version>${version.javassist.javassist}</version>
       </dependency>
       <dependency>
+        <groupId>org.jboss.classpool</groupId>
+        <artifactId>jboss-classpool-scoped</artifactId>
+        <version>${version.org.jboss.classpool}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.classpool</groupId>
+        <artifactId>jboss-classpool</artifactId>
+        <version>${version.org.jboss.classpool}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.classpool</groupId>
+        <artifactId>jboss-classpool-jbosscl</artifactId>
+        <version>${version.org.jboss.classpool}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.classpool</groupId>
+        <artifactId>jboss-classpool-ucl</artifactId>
+        <version>${version.org.jboss.classpool}</version>
+      </dependency>
+      <dependency>
         <groupId>org.jboss</groupId>
         <artifactId>jboss-reflect</artifactId>
         <version>${version.org.jboss.jboss-reflect}</version>




More information about the jboss-cvs-commits mailing list