001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2004 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: ThreadContextClassLoader.java 5530 2004-09-29 15:13:04Z sauthieg $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas_lib.loader;
025:
026: import java.io.InputStream;
027: import java.net.URL;
028:
029: /**
030: * Delegate all call to the Thread context ClassLoader.
031: * @author Guillaume Sauthier
032: */
033: public class ThreadContextClassLoader extends ClassLoader {
034:
035: /**
036: *
037: */
038: public ThreadContextClassLoader() {
039: super ();
040: }
041:
042: /**
043: * @see java.lang.ClassLoader#clearAssertionStatus()
044: */
045: public synchronized void clearAssertionStatus() {
046: getContextClassLoader().clearAssertionStatus();
047: }
048:
049: /**
050: * @see java.lang.ClassLoader#getResource(java.lang.String)
051: */
052: public URL getResource(String name) {
053: return getContextClassLoader().getResource(name);
054: }
055:
056: /**
057: * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String)
058: */
059: public InputStream getResourceAsStream(String name) {
060: return getContextClassLoader().getResourceAsStream(name);
061: }
062:
063: /**
064: * @see java.lang.ClassLoader#loadClass(java.lang.String)
065: */
066: public Class loadClass(String name) throws ClassNotFoundException {
067: return getContextClassLoader().loadClass(name);
068: }
069:
070: /**
071: * @see java.lang.ClassLoader#setClassAssertionStatus(java.lang.String,
072: * boolean)
073: */
074: public synchronized void setClassAssertionStatus(String className,
075: boolean enabled) {
076: getContextClassLoader().setClassAssertionStatus(className,
077: enabled);
078: }
079:
080: /**
081: * @see java.lang.ClassLoader#setDefaultAssertionStatus(boolean)
082: */
083: public synchronized void setDefaultAssertionStatus(boolean enabled) {
084: getContextClassLoader().setDefaultAssertionStatus(enabled);
085: }
086:
087: /**
088: * @see java.lang.ClassLoader#setPackageAssertionStatus(java.lang.String,
089: * boolean)
090: */
091: public synchronized void setPackageAssertionStatus(
092: String packageName, boolean enabled) {
093: getContextClassLoader().setPackageAssertionStatus(packageName,
094: enabled);
095: }
096:
097: /**
098: * @return Thread context ClassLoader
099: */
100: private ClassLoader getContextClassLoader() {
101: return Thread.currentThread().getContextClassLoader();
102: }
103: }
|