Package org.jboss.mx.loading

Examples of org.jboss.mx.loading.RepositoryClassLoader


            }
           
            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)
                  {
View Full Code Here


   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;
   }
View Full Code Here

   {
      log.info("+++ Begin testSystemClasses");
      UnifiedLoaderRepository3 parent = new UnifiedLoaderRepository3();
      HeirarchicalLoaderRepository3 repository0 = new HeirarchicalLoaderRepository3(parent);
      URL j0URL = getDeployURL("tests-dummy.jar");
      RepositoryClassLoader ucl0 = repository0.newClassLoader(j0URL, true);

      Class c0 = ucl0.loadClass("java.sql.SQLException");
      StringBuffer info = new StringBuffer();
      ClassLoaderUtils.displayClassInfo(c0, info);
      log.info("Loaded c0: "+info);

      HeirarchicalLoaderRepository3 repository1 = new HeirarchicalLoaderRepository3(parent);
      repository1.setUseParentFirst(false);
      RepositoryClassLoader ucl1 = repository1.newClassLoader(j0URL, true);     
      Class c1 = ucl1.loadClass("java.sql.SQLException");
      info.setLength(0);
      ClassLoaderUtils.displayClassInfo(c1, info);
      log.info("Loaded c1: "+info);

      Class c2 = ucl1.loadClass("java.sql.SQLWarning");
      info.setLength(0);
      ClassLoaderUtils.displayClassInfo(c2, info);
      log.info("Loaded c2: "+info);
   }
View Full Code Here

   {
      log.info("+++ Begin testSystemClasses2");
      UnifiedLoaderRepository3 parent = new UnifiedLoaderRepository3();
      HeirarchicalLoaderRepository3 repository0 = new HeirarchicalLoaderRepository3(parent);
      URL j0URL = getDeployURL("java-sql.jar");
      RepositoryClassLoader ucl0 = repository0.newClassLoader(j0URL, true);

      Class c0 = ucl0.loadClass("java.sql.SQLException");
      StringBuffer info = new StringBuffer();
      ClassLoaderUtils.displayClassInfo(c0, info);
      log.info("Loaded c0: "+info);

      HeirarchicalLoaderRepository3 repository1 = new HeirarchicalLoaderRepository3(parent);
      repository1.setUseParentFirst(false);
      RepositoryClassLoader ucl1 = repository1.newClassLoader(j0URL, true);     
      Class c1 = ucl1.loadClass("java.sql.SQLException");
      info.setLength(0);
      ClassLoaderUtils.displayClassInfo(c1, info);
      log.info("Loaded c1: "+info);

      Class c2 = ucl1.loadClass("java.sql.SQLWarning");
      info.setLength(0);
      ClassLoaderUtils.displayClassInfo(c2, info);
      log.info("Loaded c2: "+info);
   }
View Full Code Here

   public boolean isUnloadedClassLoader()
   {
      if (getClassLoader() instanceof RepositoryClassLoader)
      {
         RepositoryClassLoader rcl = (RepositoryClassLoader) getClassLoader();
         return rcl.getLoaderRepository() == null;
      }
      return false;
   }
View Full Code Here

         }
         // We have to clear Blacklist caches or the class will never
         // be found
         //((UnifiedClassLoader)dcl).clearBlacklists();
         // To be backward compatible
         RepositoryClassLoader rcl = (RepositoryClassLoader) getClassLoader();
         rcl.clearClassBlackList();
         rcl.clearResourceBlackList();

         // Now load the class through the cl
         dynClass = getClassLoader().loadClass(cc.getName());
      }
      catch (Exception ex)
View Full Code Here

   }

   // FIXME: JBAOP-107 REMOVE THIS HACK
   public boolean isValid()
   {
      RepositoryClassLoader cl = (RepositoryClassLoader) getClassLoader();
      if (cl == null)
         return false;
      return cl.getLoaderRepository() != null;
   }
View Full Code Here

      ClassLoader classloader = getClassLoader();
      if (classloader == null)
         throw new IllegalStateException("ClassLoader no longer exists: " + classLoaderString);
      if (classloader instanceof RepositoryClassLoader == false)
         throw new IllegalStateException("ClassLoader is not an instanceof RepositoryClassLoader " + classLoaderString);
      RepositoryClassLoader repositoryClassLoader = (RepositoryClassLoader) classloader;
      LoaderRepository loaderRepository = repositoryClassLoader.getLoaderRepository();
      if (loaderRepository == null)
         throw new IllegalStateException("ClassLoader has been undeployed: " + classLoaderString);
      if (loaderRepository instanceof HeirarchicalLoaderRepository3 == false)
         throw new IllegalStateException("Repository " + loaderRepository + " for classlaoder " + classLoaderString + " is not an HeirarchicalLoaderRepository3");
      return (HeirarchicalLoaderRepository3) loaderRepository;
View Full Code Here

   }
  
   private ClassLoader getTopLevelJBossClassLoader()
   {
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      RepositoryClassLoader topRcl = null;
      while (loader != null)
      {
         if (loader instanceof RepositoryClassLoader)
         {
            topRcl = (RepositoryClassLoader)loader;
View Full Code Here

      try
      {
         URL tmpURL = tempdir.toURI().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;
      }
      catch(Exception e)
View Full Code Here

TOP

Related Classes of org.jboss.mx.loading.RepositoryClassLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.