KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_lib > loader > ThreadContextClassLoader


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: ThreadContextClassLoader.java,v 1.1 2004/09/29 15:13:04 sauthieg Exp $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.jonas_lib.loader;
26
27 import java.io.InputStream JavaDoc;
28 import java.net.URL JavaDoc;
29
30 /**
31  * Delegate all call to the Thread context ClassLoader.
32  * @author Guillaume Sauthier
33  */

34 public class ThreadContextClassLoader extends ClassLoader JavaDoc {
35
36     /**
37      *
38      */

39     public ThreadContextClassLoader() {
40         super();
41     }
42
43     /**
44      * @see java.lang.ClassLoader#clearAssertionStatus()
45      */

46     public synchronized void clearAssertionStatus() {
47         getContextClassLoader().clearAssertionStatus();
48     }
49
50     /**
51      * @see java.lang.ClassLoader#getResource(java.lang.String)
52      */

53     public URL JavaDoc getResource(String JavaDoc name) {
54         return getContextClassLoader().getResource(name);
55     }
56
57     /**
58      * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String)
59      */

60     public InputStream JavaDoc getResourceAsStream(String JavaDoc name) {
61         return getContextClassLoader().getResourceAsStream(name);
62     }
63
64     /**
65      * @see java.lang.ClassLoader#loadClass(java.lang.String)
66      */

67     public Class JavaDoc loadClass(String JavaDoc name) throws ClassNotFoundException JavaDoc {
68         return getContextClassLoader().loadClass(name);
69     }
70
71     /**
72      * @see java.lang.ClassLoader#setClassAssertionStatus(java.lang.String,
73      * boolean)
74      */

75     public synchronized void setClassAssertionStatus(String JavaDoc className, boolean enabled) {
76         getContextClassLoader().setClassAssertionStatus(className, enabled);
77     }
78
79     /**
80      * @see java.lang.ClassLoader#setDefaultAssertionStatus(boolean)
81      */

82     public synchronized void setDefaultAssertionStatus(boolean enabled) {
83         getContextClassLoader().setDefaultAssertionStatus(enabled);
84     }
85
86     /**
87      * @see java.lang.ClassLoader#setPackageAssertionStatus(java.lang.String,
88      * boolean)
89      */

90     public synchronized void setPackageAssertionStatus(String JavaDoc packageName, boolean enabled) {
91         getContextClassLoader().setPackageAssertionStatus(packageName, enabled);
92     }
93
94     /**
95      * @return Thread context ClassLoader
96      */

97     private ClassLoader JavaDoc getContextClassLoader() {
98         return Thread.currentThread().getContextClassLoader();
99     }
100 }
Popular Tags