KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > mbeanserver > SecureClassLoaderRepository


1 /*
2  * @(#)SecureClassLoaderRepository.java 1.10 05/05/27
3  *
4  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package com.sun.jmx.mbeanserver;
8
9 import javax.management.loading.ClassLoaderRepository JavaDoc;
10
11 /**
12  * Fix security hole in ClassLoaderRepository. This class wraps
13  * the actual ClassLoaderRepository implementation so that
14  * only the methods from {@link javax.management.loading.ClassLoaderRepository}
15  * can be accessed (read-only).
16  *
17  * @since 1.5
18  */

19 final class SecureClassLoaderRepository
20     implements ClassLoaderRepository JavaDoc {
21
22     private final ClassLoaderRepository JavaDoc clr;
23     /**
24      * Creates a new secure ClassLoaderRepository wrapping an
25      * unsecure implementation.
26      * @param clr Unsecure {@link ClassLoaderRepository} implementation
27      * to wrap.
28      **/

29     public SecureClassLoaderRepository(ClassLoaderRepository JavaDoc clr) {
30     this.clr=clr;
31     }
32     public final Class JavaDoc loadClass(String JavaDoc className)
33     throws ClassNotFoundException JavaDoc {
34     return clr.loadClass(className);
35     }
36     public final Class JavaDoc loadClassWithout(ClassLoader JavaDoc loader,
37                   String JavaDoc className)
38     throws ClassNotFoundException JavaDoc {
39     return clr.loadClassWithout(loader,className);
40     }
41     public final Class JavaDoc loadClassBefore(ClassLoader JavaDoc loader,
42                  String JavaDoc className)
43     throws ClassNotFoundException JavaDoc {
44     return clr.loadClassBefore(loader,className);
45     }
46 }
47
Popular Tags