[jboss-cvs] JBossAS SVN: r91984 - in projects/aop/branches/classpool_JBAOP-742/asintegration-jmx: src/main/java/org/jboss/aop/asintegration/jboss4 and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 4 17:35:24 EDT 2009


Author: flavia.rainone at jboss.com
Date: 2009-08-04 17:35:23 -0400 (Tue, 04 Aug 2009)
New Revision: 91984

Removed:
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPool.java
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPoolFactory.java
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/LoaderRepositoryUrlUtil.java
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedJBossClassPool.java
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedRepositoryClassLoaderHelper.java
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/SecurityActions.java
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvoker.java
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvokerPoolReference.java
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/classpool/ucl/
Modified:
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/pom.xml
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java
   projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/test/java/org/jboss/test/aop/classpool/ucl/test/UclClassPoolTest.java
Log:
[JBAOP-742] Deleted classes from asintegration-jmx that have been moved to jboss-classpool. Added dependency to jboss-classpool project and references to its classes at JBoss4Integration class.

Modified: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/pom.xml
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/pom.xml	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/pom.xml	2009-08-04 21:35:23 UTC (rev 91984)
@@ -144,6 +144,10 @@
       <groupId>org.jboss.logging</groupId>
       <artifactId>jboss-logging-spi</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-classpool</artifactId>
+    </dependency>
   </dependencies>
   
 </project>

Modified: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -40,9 +40,15 @@
 
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.asintegration.JBossIntegration;
-import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
-import org.jboss.aop.classpool.ucl.JBossUclDelegatingClassPoolFactory;
+import org.jboss.aop.newclasspool.AOPClassLoaderScopingPolicy;
+import org.jboss.aop.newclasspool.AOPClassPoolFactory;
 import org.jboss.aop.domain.ScopedRepositoryClassLoaderDomain;
+import org.jboss.classpool.jboss4.JBossClassPool;
+import org.jboss.classpool.jboss4.JBossClassPoolFactory;
+import org.jboss.classpool.jboss4.LoaderRepositoryUrlUtil;
+import org.jboss.classpool.jboss4.ScopedJBossClassPool;
+import org.jboss.classpool.jboss4.ScopedRepositoryClassLoaderHelper;
+import org.jboss.classpool.ucl.JBossUclDelegatingClassPoolFactory;
 import org.jboss.logging.Logger;
 import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
 import org.jboss.mx.loading.RepositoryClassLoader;
@@ -127,6 +133,7 @@
       if (classname.equals(JBossClassPoolFactory.class.getName()))
       {
          delegateClassPoolFactory = new JBossClassPoolFactory(tmpDir);
+         AOPClassPoolFactory.setDelegateClassPoolFactory(delegateClassPoolFactory);
       }
       else if (classname.equals(JBossUclDelegatingClassPoolFactory.class.getName()))
       {

Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPool.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPool.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPool.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -1,84 +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.asintegration.jboss4;
-
-import java.io.File;
-import java.net.URL;
-import java.security.ProtectionDomain;
-
-import javassist.CannotCompileException;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.mx.loading.RepositoryClassLoader;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public class JBossClassPool extends AOPClassPool implements ToClassInvokerPoolReference
-{
-   ToClassInvoker toClassInvoker = null;
-   
-   protected JBossClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, File tmp, URL tmpURL)
-   {
-      super(cl, src, repository);
-      toClassInvoker = new ToClassInvoker(tmp);
-   }
-
-   protected JBossClassPool(ClassPool src, ScopedClassPoolRepository repository)
-   {
-      super(src, repository);
-   }
-
-   public boolean isUnloadedClassLoader()
-   {
-      if (getClassLoader() instanceof RepositoryClassLoader)
-      {
-         RepositoryClassLoader rcl = (RepositoryClassLoader) getClassLoader();
-         return rcl.getLoaderRepository() == null;
-      }
-      return false;
-   }
-
-   public Class<?> toClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException
-   {
-      return toClassInvoker.toClass(this, cc, getResourceName(cc.getName()), loader, domain);
-   }
-
-   public Class<?> superPoolToClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException
-   {
-      return super.toClass(cc, loader, domain);
-   }
-
-   @Override
-   public void lockInCache(CtClass clazz)
-   {
-      super.lockInCache(clazz);
-      localResources.put(getResourceName(clazz.getName()), Boolean.TRUE);
-   }
-}

Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPoolFactory.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPoolFactory.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPoolFactory.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -1,129 +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.asintegration.jboss4;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.classpool.AbstractJBossClassPoolFactory;
-import org.jboss.mx.loading.RepositoryClassLoader;
-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>
- * @author adrian at jboss.org
- * @version $Revision$
- **/
-public class JBossClassPoolFactory extends AbstractJBossClassPoolFactory implements ScopedClassPoolFactory
-{
-   protected File tmpClassesDir;
-
-   public JBossClassPoolFactory(File tmpClassesDir) throws IOException
-   {
-      this.tmpClassesDir = tmpClassesDir;
-
-   }
-   public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
-   {
-      ClassPool parent = getCreateParentClassPools(cl, src, repository);
-      if (cl instanceof RepositoryClassLoader)
-      {
-         File tempdir = getTempDirectory(cl);
-         URL tmpCP;
-         try
-         {
-            tmpCP = createURLAndAddToLoader(cl, tempdir);
-         }
-         catch (IOException e)
-         {
-            throw new RuntimeException(e);
-         }
-         if (ScopedRepositoryClassLoaderHelper.isScopedClassLoader(cl))
-         {
-            //It is scoped
-            return new ScopedJBossClassPool(cl, parent, repository, tempdir, tmpCP);
-         }
-         return new JBossClassPool(cl, parent, repository, tempdir, tmpCP);
-      }
-      return new AOPClassPool(cl, parent, repository);
-   }
-
-   protected File getTempDirectory(ClassLoader cl)
-   {
-      File tempdir = null;
-      int attempts = 0;
-      IOException ex = null;
-      while (tempdir == null && attempts < 5)
-      {
-         //Workaround for JBAOP-254, retry a few times
-         try
-         {
-            tempdir = createTempDir(cl);
-         }
-         catch (IOException e)
-         {
-            ex = e;
-         }
-      }
-      
-      if (tempdir == null)
-      {
-         throw new RuntimeException("", ex);
-      }
-      
-      return tempdir;
-   }
-
-   public File createTempDir(ClassLoader cl) throws IOException
-   {
-      File tempdir = File.createTempFile("ucl", "", tmpClassesDir);
-      tempdir.delete();
-      tempdir.mkdir();
-      tempdir.deleteOnExit();
-
-      return tempdir;
-   }
-   
-   private URL createURLAndAddToLoader(ClassLoader cl, File tempdir) throws IOException
-   {
-      URL tmpURL = tempdir.toURL();
-      URL tmpCP = new URL(tmpURL, "?dynamic=true");
-
-      RepositoryClassLoader ucl = (RepositoryClassLoader) cl;
-
-      // We may be undeploying.
-      if (ucl.getLoaderRepository() != null)
-      {
-         ucl.addURL(tmpCP);
-      }
-      
-      return tmpCP;
-   }
-
-}

Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/LoaderRepositoryUrlUtil.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/LoaderRepositoryUrlUtil.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/LoaderRepositoryUrlUtil.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -1,173 +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.asintegration.jboss4;
-
-import java.net.URL;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
-import org.jboss.mx.loading.LoaderRepository;
-import org.jboss.mx.util.MBeanServerLocator;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class LoaderRepositoryUrlUtil implements NotificationListener
-{
-   final static MBeanServer SERVER;
-   final static ObjectName MAIN_LOADER_REPOSITORY_OBJECT_NAME;
-   final static LoaderRepository MAIN_LOADER_REPOSITORY;
-   static
-   {
-      SERVER = MBeanServerLocator.locateJBoss();
-      try
-      {
-         MAIN_LOADER_REPOSITORY_OBJECT_NAME = new ObjectName("JMImplementation:name=Default,service=LoaderRepository");
-         MAIN_LOADER_REPOSITORY = (LoaderRepository)SERVER.invoke(MAIN_LOADER_REPOSITORY_OBJECT_NAME, "getInstance", new Object[0], new String[0]);
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-   
-   long currentSequenceNumber;
-   long lastSequenceNumber = -1;
-   URL[] urls;
-   
-   public LoaderRepositoryUrlUtil()
-   {
-      try
-      {
-         SERVER.addNotificationListener(MAIN_LOADER_REPOSITORY_OBJECT_NAME, this, null, null);
-      }
-      catch (InstanceNotFoundException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   public synchronized void handleNotification(Notification notification, Object handback)
-   {
-      if (notification.getType().equals(LoaderRepository.CLASSLOADER_ADDED))
-      {
-         currentSequenceNumber = notification.getSequenceNumber();
-      }
-      else if (notification.getType().equals(LoaderRepository.CLASSLOADER_REMOVED))
-      {
-         currentSequenceNumber = notification.getSequenceNumber();
-      }
-   }
-   
-   public synchronized UrlInfo getURLInfo(HeirarchicalLoaderRepository3 scopedLoader, UrlInfo urlInfo)
-   {
-      boolean changed = false;
-      if (lastSequenceNumber != currentSequenceNumber)
-      {
-         urls = MAIN_LOADER_REPOSITORY.getURLs();
-         lastSequenceNumber = currentSequenceNumber;
-         changed = true;
-      }
-      if (!changed)
-      {
-         changed = urlInfo != null && (urlInfo.getSequenceNumber() != lastSequenceNumber);
-      }
-      if (urlInfo == null || changed)
-      {
-         URL[] localUrls = getLocalUrls(scopedLoader, urls);
-         urlInfo = new UrlInfo(urls, localUrls, lastSequenceNumber);
-      }
-      return urlInfo;
-   }
-   
-   public long getCurrentSequenceNumber()
-   {
-      return currentSequenceNumber;
-   }
-   
-   private URL[] getLocalUrls(HeirarchicalLoaderRepository3 scopedRepository, URL[] globalUrls)
-   {
-      URL[] scopedRepositoryUrls = scopedRepository.getURLs();
-
-      //This is a bit of a hack, since this relies on the order of the urls returned by HeirarchicalLoaderRepository3
-      //My urls, followed by parent urls.
-      int scopedLength = 0;
-      for (int i = 0 ; i < scopedRepositoryUrls.length ; i++)
-      {
-         for (int j = 0 ; j < globalUrls.length ; j ++)
-         {
-            if (scopedRepositoryUrls[i].equals(globalUrls[j]))
-            {
-               scopedLength = i;
-               break;
-            }
-         }
-         if (scopedLength > 0)
-         {
-            break;
-         }
-      }
-      
-      URL[] localUrls = new URL[scopedLength];
-      System.arraycopy(scopedRepositoryUrls, 0, localUrls, 0, scopedLength);
-      return localUrls;
-   }
-   
-   public class UrlInfo
-   {
-      
-      URL[] globalUrls;
-      URL[] localUrls;
-      long sequenceNumber;
-
-      public UrlInfo(URL[] globalUrls, URL[] localUrls, long sequenceNumber)
-      {
-         super();
-         this.globalUrls = globalUrls;
-         this.localUrls = localUrls;
-         this.sequenceNumber = sequenceNumber;
-      }
-      
-      public URL[] getGlobalUrls()
-      {
-         return globalUrls;
-      }
-      
-      public URL[] getLocalUrls()
-      {
-         return localUrls;
-      }
-
-      public long getSequenceNumber()
-      {
-         return sequenceNumber;
-      }
-   }
-   
-}

Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedJBossClassPool.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedJBossClassPool.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedJBossClassPool.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -1,273 +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.asintegration.jboss4;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.classpool.AOPClassPoolRepository;
-import org.jboss.aop.asintegration.jboss4.LoaderRepositoryUrlUtil.UrlInfo;
-import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
-import org.jboss.mx.loading.LoaderRepository;
-import org.jboss.mx.loading.RepositoryClassLoader;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * A classpool in JBoss backed by a scoped (HierarchicalLoaderRepository) loader repository
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ScopedJBossClassPool extends JBossClassPool 
-{
-   final static LoaderRepositoryUrlUtil LOADER_REPOSITORY_UTIL = new LoaderRepositoryUrlUtil();
-   
-   private UrlInfo urlInfo;
-   private ThreadLocal<ClassPool> lastPool = new ThreadLocal<ClassPool>();
-
-   public ScopedJBossClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, File tmp, URL tmpURL)
-   {
-      super(cl, src, repository, tmp, tmpURL);
-      
-      boolean parentFirst = false;
-      LoaderRepository loaderRepository = null;
-      ClassLoader prnt = cl;
-      while (prnt != null)
-      {
-         if (prnt instanceof RepositoryClassLoader)
-         {
-            loaderRepository = ((RepositoryClassLoader)prnt).getLoaderRepository();
-            if (loaderRepository instanceof HeirarchicalLoaderRepository3)
-            {
-               parentFirst = ((HeirarchicalLoaderRepository3)loaderRepository).getUseParentFirst();
-            }
-            break;
-         }
-         prnt = SecurityActions.getParent(cl);
-      }
-      
-      super.childFirstLookup = !parentFirst;
-   }
-   
-
-   private HeirarchicalLoaderRepository3 getRepository()
-   {
-      ClassLoader cl = getClassLoader0();
-      if (cl != null)
-      {
-         return (HeirarchicalLoaderRepository3)((RepositoryClassLoader)cl).getLoaderRepository();
-      }
-      return null;
-   }
-
-   private URL getResourceUrlForClass(String resourcename)
-   {
-      HeirarchicalLoaderRepository3 repo = getRepository();
-      return repo.getResource(resourcename, super.getClassLoader());
-   }
-   
-   private boolean isMine(URL url)
-   {
-      HeirarchicalLoaderRepository3 repo = getRepository();
-      if (repo != null)
-      {
-         //The URL of the class loaded with my scoped classloader
-         if (url != null)
-         {
-            urlInfo = LOADER_REPOSITORY_UTIL.getURLInfo(getRepository(), urlInfo);
-            
-            URL[] myUrls = urlInfo.getLocalUrls();
-            String resource = url.toString();
-            for (int i = 0 ; i < myUrls.length ; i++)
-            {
-               if (resource.indexOf(myUrls[i].toString()) >= 0)
-               {
-                  return true;
-               }
-            }
-            return false;
-         }
-      }
-      return true;
-   }
-
-   public CtClass getCached(String classname)
-   {
-      if (classname == null)
-      {
-         return null;
-      }
-      if (isUnloadedClassLoader())
-      {
-         return null;
-      }
-
-      if (generatedClasses.get(classname) != null)
-      {
-         //It is a new class, and this callback is probably coming from the frozen check when creating a new nested class
-         return super.getCached(classname);
-      }
-      
-      //Is this from the scoped classloader itself of from the parent?
-      String resourcename = getResourceName(classname);
-      URL url = getResourceUrlForClass(resourcename);
-      boolean isMine = isMine(url);
-      
-      if (isMine)
-      {
-         if (super.childFirstLookup)
-         {
-            //Parent delegation is false, attempt to get this class out of ourselves
-            CtClass clazz = super.getCachedLocally(classname);
-            if (clazz == null)
-            {
-               clazz = createCtClass(classname, false);
-               if (clazz != null)
-               {
-                  lockInCache(clazz);
-               }
-            }
-            if (clazz != null)
-            {
-               return clazz;
-            }
-         }
-         return super.getCached(classname);
-      }
-      
-
-      try
-      {
-         ClassPool pool = getCorrectPoolForResource(classname, url);
-         if (pool != lastPool.get())
-         {
-            lastPool.set(pool);
-            return pool.get(classname);
-         }
-      }
-      catch (NotFoundException e)
-      {
-      }
-      catch(StackOverflowError e)
-      {
-         throw e;
-      }
-      finally
-      {
-         lastPool.set(null);
-      }
-
-      return null;
-   }
-
-   @Override
-   protected boolean includeInGlobalSearch()
-   {
-      return false;
-   }
-   
-   private ClassPool getCorrectPoolForResource(String classname, URL url)
-   {
-      synchronized(AspectManager.getRegisteredCLs())
-      {
-         //JBoss 5 has an extra NoAnnotationURLCLassLoader that is not on the default path, make sure that that is checked at the end
-         //FIXME This needs revisiting/removing once the 
-         ArrayList<AOPClassPool> noAnnotationURLClassLoaderPools = null;
-         String resource = url.toString();
-         for(ClassPool pool : AspectManager.getRegisteredCLs().values())
-         {
-            AOPClassPool candidate = (AOPClassPool)pool;
-            if (candidate.isUnloadedClassLoader())
-            {
-               AspectManager.instance().unregisterClassLoader(candidate.getClassLoader());
-               continue;
-            }
-            
-            if (candidate.getClassLoader() instanceof RepositoryClassLoader)
-            {
-               //Sometimes the ClassLoader is a proxy for MBeanProxyExt?!
-               RepositoryClassLoader rcl = (RepositoryClassLoader)candidate.getClassLoader();
-               URL[] urls = rcl.getClasspath();
-               
-               for (int i = 0 ; i < urls.length ; i++)
-               {
-                  if (resource.indexOf(urls[i].getFile()) >= 0)
-                  {
-                     return candidate;
-                  }
-               }
-            }
-            //FIXME Remove once we have the JBoss 5 version of pool
-            else if (isInstanceOfNoAnnotationURLClassLoader(candidate.getClassLoader()))
-            {
-               if (noAnnotationURLClassLoaderPools == null)
-               {
-                  noAnnotationURLClassLoaderPools = new ArrayList<AOPClassPool>(); 
-               }
-               noAnnotationURLClassLoaderPools.add(candidate);
-            }
-         }
-         
-         //FIXME Remove once we have the JBoss 5 version of pool
-         if (noAnnotationURLClassLoaderPools != null)
-         {
-            for (AOPClassPool pool : noAnnotationURLClassLoaderPools)
-            {
-               try
-               {
-                  pool.get(classname);
-                  return pool;
-               }
-               catch(NotFoundException ignoreTryNext)
-               {
-               }
-            }
-         }
-      }
-
-      return AOPClassPool.createAOPClassPool(ClassPool.getDefault(), AOPClassPoolRepository.getInstance());
-   }
-   
-   /**
-    * NoAnnotationURLCLassLoader lives in different packages in JBoss 4 and 5
-    */
-   private boolean isInstanceOfNoAnnotationURLClassLoader(ClassLoader loader)
-   {
-      Class<?> parent = loader.getClass();
-      while (parent != null)
-      {
-         if ("NoAnnotationURLClassLoader".equals(parent.getSimpleName()))
-         {
-            return true;
-         }
-         parent = parent.getSuperclass();
-      }
-      return false;
-   }
-}

Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedRepositoryClassLoaderHelper.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedRepositoryClassLoaderHelper.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedRepositoryClassLoaderHelper.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -1,51 +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.asintegration.jboss4;
-
-import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
-import org.jboss.mx.loading.LoaderRepository;
-import org.jboss.mx.loading.RepositoryClassLoader;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @autor adrian at jboss.org
- * @version $Revision$
- */
-public class ScopedRepositoryClassLoaderHelper
-{
-   public static boolean isScopedClassLoader(ClassLoader loader)
-   {
-      boolean scoped = false;
-      if (loader instanceof RepositoryClassLoader)
-      {
-         LoaderRepository repository = ((RepositoryClassLoader)loader).getLoaderRepository();
-         if (repository instanceof HeirarchicalLoaderRepository3)
-         {
-            scoped = true;
-            //HeirarchicalLoaderRepository3 hlr = (HeirarchicalLoaderRepository3)repository;
-            //boolean parentFirst = hlr.getUseParentFirst();
-         }
-      }
-      return scoped;
-   }
-}

Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/SecurityActions.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/SecurityActions.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/SecurityActions.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -1,84 +0,0 @@
-/*
-* 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.aop.asintegration.jboss4;
-
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-class SecurityActions
-{
-   interface GetParentAction
-   {
-      ClassLoader getParent(ClassLoader loader);
-      
-      GetParentAction NON_PRIVILEGED = new GetParentAction()
-      {
-         public ClassLoader getParent(ClassLoader loader)
-         {
-            return loader.getParent();
-         }
-      };
-      
-      GetParentAction PRIVILEGED = new GetParentAction()
-      {
-         public ClassLoader getParent(final ClassLoader loader)
-         {
-            try
-            {
-               return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>()
-               {
-                  public ClassLoader run() throws Exception
-                  {
-                     return loader.getParent();
-                  }
-               });
-            }
-            catch (PrivilegedActionException e)
-            {
-               throw new RuntimeException(e.getException());
-            }
-         }
-      };
-   }
-   
-   public static ClassLoader getParent(ClassLoader loader)
-   {
-      if (loader == null)
-      {
-         return null;
-      }
-      if (System.getSecurityManager() == null)
-      {
-         return GetParentAction.NON_PRIVILEGED.getParent(loader);
-      }
-      else
-      {
-         return GetParentAction.PRIVILEGED.getParent(loader);
-      }
-   }
-}

Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvoker.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvoker.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvoker.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -1,103 +0,0 @@
-/*
-* 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.aop.asintegration.jboss4;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.security.ProtectionDomain;
-
-import javassist.CannotCompileException;
-import javassist.CtClass;
-
-import org.jboss.logging.Logger;
-import org.jboss.mx.loading.RepositoryClassLoader;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ToClassInvoker
-{
-   Logger logger = Logger.getLogger(this.getClass());
-
-   public File tmpDir;
-
-   public Object tmplock = new Object();
-
-   public ToClassInvoker(File tmpDir)
-   {
-      this.tmpDir = tmpDir;
-   }
-
-   public Class<?> toClass(ToClassInvokerPoolReference pool, CtClass cc, String classFileName, ClassLoader loader, ProtectionDomain domain)
-   throws CannotCompileException
-   {
-      boolean trace = logger.isTraceEnabled();
-      pool.lockInCache(cc);
-      final ClassLoader myloader = pool.getClassLoader();
-      if (myloader == null || tmpDir == null)
-      {
-         if (trace) logger.trace(this + " " + pool + ".toClass() myloader:" + myloader + " tmpDir:" + tmpDir + " default to superPool.toClass for " + cc.getName());
-         Class<?> clazz = pool.superPoolToClass(cc, loader, domain);
-         if (trace) logger.trace(this + " " + pool + " myloader:" + myloader + " created class:" + clazz);
-         return clazz;
-      }
-      Class<?> dynClass = null;
-      try
-      {
-         File classFile = null;
-         // Write the clas file to the tmpdir
-         synchronized (tmplock)
-         {
-            classFile = new File(tmpDir, classFileName);
-            if (trace) logger.trace(this + " " + pool + ".toClass() myloader:" + myloader + " writing bytes to " + classFile);
-            File pkgDirs = classFile.getParentFile();
-            pkgDirs.mkdirs();
-            FileOutputStream stream = new FileOutputStream(classFile);
-            stream.write(cc.toBytecode());
-            stream.flush();
-            stream.close();
-            classFile.deleteOnExit();
-         }
-         // We have to clear Blacklist caches or the class will never
-         // be found
-         //((UnifiedClassLoader)dcl).clearBlacklists();
-         // To be backward compatible
-         RepositoryClassLoader rcl = (RepositoryClassLoader)myloader;
-         rcl.clearClassBlackList();
-         rcl.clearResourceBlackList();
-
-         // Now load the class through the cl
-         dynClass = myloader.loadClass(cc.getName());
-         if (trace) logger.trace(this + " " + pool + " myloader:" + myloader + " created class:" + dynClass);
-         return dynClass;
-      }
-      catch (Exception ex)
-      {
-         ClassFormatError cfe = new ClassFormatError("Failed to load dyn class: " + cc.getName());
-         cfe.initCause(ex);
-         throw cfe;
-      }
-   }
-
-}

Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvokerPoolReference.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvokerPoolReference.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvokerPoolReference.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -1,39 +0,0 @@
-/*
-* 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.aop.asintegration.jboss4;
-
-import java.security.ProtectionDomain;
-
-import javassist.CannotCompileException;
-import javassist.CtClass;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface ToClassInvokerPoolReference
-{
-   Class<?> superPoolToClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException;
-   ClassLoader getClassLoader();
-   void lockInCache(CtClass clazz);
-}

Modified: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/test/java/org/jboss/test/aop/classpool/ucl/test/UclClassPoolTest.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/test/java/org/jboss/test/aop/classpool/ucl/test/UclClassPoolTest.java	2009-08-04 21:33:28 UTC (rev 91983)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/test/java/org/jboss/test/aop/classpool/ucl/test/UclClassPoolTest.java	2009-08-04 21:35:23 UTC (rev 91984)
@@ -36,7 +36,7 @@
 import javax.management.ObjectName;
 
 import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.ucl.JBossUclDelegatingClassPoolFactory;
+import org.jboss.classpool.ucl.JBossUclDelegatingClassPoolFactory;
 import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
 import org.jboss.mx.loading.LoaderRepository;
 import org.jboss.mx.loading.RepositoryClassLoader;




More information about the jboss-cvs-commits mailing list