1 25 package org.objectweb.jonas_lib.loader; 26 27 import java.io.InputStream ; 28 import java.net.URL ; 29 30 34 public class ThreadContextClassLoader extends ClassLoader { 35 36 39 public ThreadContextClassLoader() { 40 super(); 41 } 42 43 46 public synchronized void clearAssertionStatus() { 47 getContextClassLoader().clearAssertionStatus(); 48 } 49 50 53 public URL getResource(String name) { 54 return getContextClassLoader().getResource(name); 55 } 56 57 60 public InputStream getResourceAsStream(String name) { 61 return getContextClassLoader().getResourceAsStream(name); 62 } 63 64 67 public Class loadClass(String name) throws ClassNotFoundException { 68 return getContextClassLoader().loadClass(name); 69 } 70 71 75 public synchronized void setClassAssertionStatus(String className, boolean enabled) { 76 getContextClassLoader().setClassAssertionStatus(className, enabled); 77 } 78 79 82 public synchronized void setDefaultAssertionStatus(boolean enabled) { 83 getContextClassLoader().setDefaultAssertionStatus(enabled); 84 } 85 86 90 public synchronized void setPackageAssertionStatus(String packageName, boolean enabled) { 91 getContextClassLoader().setPackageAssertionStatus(packageName, enabled); 92 } 93 94 97 private ClassLoader getContextClassLoader() { 98 return Thread.currentThread().getContextClassLoader(); 99 } 100 } | Popular Tags |