View Javadoc

1   /*
2    * Copyright 2004-2005 Germinus XXI
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License")
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package kortsoft.kmx.jmx;
17  
18  import java.io.InputStream;
19  import java.net.URL;
20  
21  /***
22   * <a href="ManagedClassLoader.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author  Alvaro
25   * @version $Revision: 1.1 $
26   *
27   */
28  public class ManagedClassLoader extends ClassLoader implements
29  		ManagedClassLoaderMBean {
30  	private ClassLoader delegatedClassLoader;
31  	
32  	public ManagedClassLoader(ClassLoader classLoader){
33  		super();
34  		this.delegatedClassLoader=classLoader;
35  	}
36  	
37  	/* (non-Javadoc)
38  	 * @see java.lang.ClassLoader#clearAssertionStatus()
39  	 */
40  	public synchronized void clearAssertionStatus() {
41  		delegatedClassLoader.clearAssertionStatus();
42  	}
43  	/* (non-Javadoc)
44  	 * @see java.lang.ClassLoader#getResource(java.lang.String)
45  	 */
46  	public URL getResource(String arg0) {
47  		return delegatedClassLoader.getResource(arg0);
48  	}
49  	/* (non-Javadoc)
50  	 * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String)
51  	 */
52  	public InputStream getResourceAsStream(String arg0) {
53  		return delegatedClassLoader.getResourceAsStream(arg0);
54  	}
55  	/* (non-Javadoc)
56  	 * @see java.lang.ClassLoader#loadClass(java.lang.String)
57  	 */
58  	public Class<?> loadClass(String arg0) throws ClassNotFoundException {
59  		return delegatedClassLoader.loadClass(arg0);
60  	}
61  	/* (non-Javadoc)
62  	 * @see java.lang.ClassLoader#setClassAssertionStatus(java.lang.String, boolean)
63  	 */
64  	public synchronized void setClassAssertionStatus(String arg0, boolean arg1) {		
65  		delegatedClassLoader.setClassAssertionStatus(arg0, arg1);
66  	}
67  	/* (non-Javadoc)
68  	 * @see java.lang.ClassLoader#setDefaultAssertionStatus(boolean)
69  	 */
70  	public synchronized void setDefaultAssertionStatus(boolean arg0) {
71  		delegatedClassLoader.setDefaultAssertionStatus(arg0);
72  	}
73  	/* (non-Javadoc)
74  	 * @see java.lang.ClassLoader#setPackageAssertionStatus(java.lang.String, boolean)
75  	 */
76  	public synchronized void setPackageAssertionStatus(String arg0, boolean arg1) {
77  		delegatedClassLoader.setPackageAssertionStatus(arg0, arg1);
78  	}
79  
80  
81  	/***
82  	 * @return Returns the delegatedClassLoader.
83  	 */
84  	public ClassLoader getDelegatedClassLoader() {
85  		return delegatedClassLoader;
86  	}
87  }