FileDocCategorySizeDatePackage
JBossScopedClassLoaderHelper.javaAPI DocJBoss 4.2.13931Fri Jul 13 21:02:24 BST 2007org.jboss.aop.deployment

JBossScopedClassLoaderHelper

public class JBossScopedClassLoaderHelper extends Object implements org.jboss.aop.classpool.AOPScopedClassLoaderHelper
author
Kabir Khan
version
$Revision$

Fields Summary
Constructors Summary
Methods Summary
public java.lang.ObjectgetLoaderRepository(java.lang.ClassLoader loader)

      ClassLoader cl = ifScopedDeploymentGetScopedParentUclForCL(loader);
      if (cl != null)
      {
         return ((RepositoryClassLoader)cl).getLoaderRepository();
      }
      return null;
   
public org.jboss.aop.DomaingetScopedClassLoaderDomain(java.lang.ClassLoader cl, org.jboss.aop.AspectManager parent)

      boolean parentDelegation = true;
      if (cl instanceof RepositoryClassLoader)
      {
         HeirarchicalLoaderRepository3 repository = (HeirarchicalLoaderRepository3)((RepositoryClassLoader)cl).getLoaderRepository();
         parentDelegation = repository.getUseParentFirst();
      }
      String name = String.valueOf(System.identityHashCode(cl));
      return new ScopedClassLoaderDomain(cl, name, parentDelegation, parent, false);
   
public java.lang.ClassLoadergetTopLevelJBossClassLoader()

      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      RepositoryClassLoader topRcl = null;
      while (loader != null)
      {
         if (loader instanceof RepositoryClassLoader)
         {
            topRcl = (RepositoryClassLoader)loader;
         }
         loader = loader.getParent();
      }
      return topRcl;
   
public java.lang.ClassLoaderifScopedDeploymentGetScopedParentUclForCL(java.lang.ClassLoader loader)

      ClassLoader parent = loader;
      //The web classloader will be a child of the unified classloader - find out if that is scoped
      while (parent != null)
      {
         if (isScopedClassLoader(parent))
         {
            return parent;
         }
         if (parent instanceof RepositoryClassLoader)
         {
            //We were a repository classloader, but not scoped - ignore the parents like a sulky teenager
            return null;
         }
         parent = parent.getParent();
      }
      return null;
   
public static booleanisScopedClassLoader(java.lang.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;