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. package javax.management;
  8. import javax.management.loading.ClassLoaderRepository;
  9. import com.sun.jmx.trace.Trace;
  10. /**
  11. * <p>Keeps the list of Class Loaders registered in the MBean Server.
  12. * It provides the necessary methods to load classes using the registered
  13. * Class Loaders.</p>
  14. *
  15. * <p>This deprecated class is maintained for compatibility. In
  16. * previous versions of the JMX API, there was one
  17. * <code>DefaultLoaderRepository</code> shared by all MBean servers.
  18. * As of version 1.2 of the JMX API, that functionality is
  19. * approximated by using {@link MBeanServerFactory#findMBeanServer} to
  20. * find all known MBean servers, and consulting the {@link
  21. * ClassLoaderRepository} of each one. It is strongly recommended
  22. * that code referencing <code>DefaultLoaderRepository</code> be
  23. * rewritten.</p>
  24. *
  25. * @deprecated Use
  26. * {@link javax.management.MBeanServer#getClassLoaderRepository()}
  27. * instead.
  28. *
  29. * @since 1.5
  30. */
  31. @Deprecated
  32. public class DefaultLoaderRepository {
  33. /**
  34. * Go through the list of class loaders and try to load the requested class.
  35. * The method will stop as soon as the class is found. If the class
  36. * is not found the method will throw a <CODE>ClassNotFoundException</CODE>
  37. * exception.
  38. *
  39. * @param className The name of the class to be loaded.
  40. *
  41. * @return the loaded class.
  42. *
  43. * @exception ClassNotFoundException The specified class could not be found.
  44. */
  45. public static Class loadClass(String className)
  46. throws ClassNotFoundException {
  47. return javax.management.loading.DefaultLoaderRepository.loadClass(className);
  48. }
  49. /**
  50. * Go through the list of class loaders but exclude the given class loader, then try to load
  51. * the requested class.
  52. * The method will stop as soon as the class is found. If the class
  53. * is not found the method will throw a <CODE>ClassNotFoundException</CODE>
  54. * exception.
  55. *
  56. * @param className The name of the class to be loaded.
  57. * @param loader The class loader to be excluded.
  58. *
  59. * @return the loaded class.
  60. *
  61. * @exception ClassNotFoundException The specified class could not be found.
  62. */
  63. public static Class loadClassWithout(ClassLoader loader,String className)
  64. throws ClassNotFoundException {
  65. return javax.management.loading.DefaultLoaderRepository.loadClassWithout(loader, className);
  66. }
  67. }