KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > DefaultLoaderRepository


1 /*
2  * @(#)DefaultLoaderRepository.java 1.33 04/05/18
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.management;
9
10 import javax.management.loading.ClassLoaderRepository JavaDoc;
11 import com.sun.jmx.trace.Trace;
12
13 /**
14  * <p>Keeps the list of Class Loaders registered in the MBean Server.
15  * It provides the necessary methods to load classes using the registered
16  * Class Loaders.</p>
17  *
18  * <p>This deprecated class is maintained for compatibility. In
19  * previous versions of the JMX API, there was one
20  * <code>DefaultLoaderRepository</code> shared by all MBean servers.
21  * As of version 1.2 of the JMX API, that functionality is
22  * approximated by using {@link MBeanServerFactory#findMBeanServer} to
23  * find all known MBean servers, and consulting the {@link
24  * ClassLoaderRepository} of each one. It is strongly recommended
25  * that code referencing <code>DefaultLoaderRepository</code> be
26  * rewritten.</p>
27  *
28  * @deprecated Use
29  * {@link javax.management.MBeanServer#getClassLoaderRepository()}
30  * instead.
31  *
32  * @since 1.5
33  */

34 @Deprecated JavaDoc
35 public class DefaultLoaderRepository {
36     /**
37      * Go through the list of class loaders and try to load the requested class.
38      * The method will stop as soon as the class is found. If the class
39      * is not found the method will throw a <CODE>ClassNotFoundException</CODE>
40      * exception.
41      *
42      * @param className The name of the class to be loaded.
43      *
44      * @return the loaded class.
45      *
46      * @exception ClassNotFoundException The specified class could not be found.
47      */

48     public static Class JavaDoc loadClass(String JavaDoc className)
49     throws ClassNotFoundException JavaDoc {
50     return javax.management.loading.DefaultLoaderRepository.loadClass(className);
51     }
52
53
54     /**
55      * Go through the list of class loaders but exclude the given class loader, then try to load
56      * the requested class.
57      * The method will stop as soon as the class is found. If the class
58      * is not found the method will throw a <CODE>ClassNotFoundException</CODE>
59      * exception.
60      *
61      * @param className The name of the class to be loaded.
62      * @param loader The class loader to be excluded.
63      *
64      * @return the loaded class.
65      *
66      * @exception ClassNotFoundException The specified class could not be found.
67      */

68     public static Class JavaDoc loadClassWithout(ClassLoader JavaDoc loader,String JavaDoc className)
69     throws ClassNotFoundException JavaDoc {
70     return javax.management.loading.DefaultLoaderRepository.loadClassWithout(loader, className);
71     }
72        
73  }
74
Popular Tags