1 22 package org.jboss.mx.loading; 23 24 import java.net.URLStreamHandlerFactory ; 25 26 import org.jboss.util.loading.DelegatingClassLoader; 27 28 35 public class LoaderRepositoryClassLoader 36 extends DelegatingClassLoader 37 { 38 39 protected LoaderRepository repository; 40 41 47 public LoaderRepositoryClassLoader(ClassLoader parent, LoaderRepository repository) 48 { 49 super(parent); 50 if (repository == null) 51 throw new IllegalArgumentException ("No repository"); 52 this.repository = repository; 53 } 54 55 61 public LoaderRepositoryClassLoader(ClassLoader parent, LoaderRepository repository, URLStreamHandlerFactory factory) 62 { 63 super(parent); 64 if (repository == null) 65 throw new IllegalArgumentException ("No repository"); 66 this.repository = repository; 67 } 68 69 78 protected Class loadClass(String className, boolean resolve) 79 throws ClassNotFoundException 80 { 81 Class clazz = repository.getCachedClass(className); 82 if (clazz != null) 83 { 84 if (resolve) 85 resolveClass(clazz); 86 return clazz; 87 } 88 89 return super.loadClass(className, resolve); 91 } 92 } 93 | Popular Tags |