1/* 2 * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package javax.management; 27 28import javax.management.loading.ClassLoaderRepository; 29 30/** 31 * <p>Keeps the list of Class Loaders registered in the MBean Server. 32 * It provides the necessary methods to load classes using the registered 33 * Class Loaders.</p> 34 * 35 * <p>This deprecated class is maintained for compatibility. In 36 * previous versions of the JMX API, there was one 37 * <code>DefaultLoaderRepository</code> shared by all MBean servers. 38 * As of version 1.2 of the JMX API, that functionality is 39 * approximated by using {@link MBeanServerFactory#findMBeanServer} to 40 * find all known MBean servers, and consulting the {@link 41 * ClassLoaderRepository} of each one. It is strongly recommended 42 * that code referencing <code>DefaultLoaderRepository</code> be 43 * rewritten.</p> 44 * 45 * @deprecated Use 46 * {@link javax.management.MBeanServer#getClassLoaderRepository()} 47 * instead. 48 * 49 * @since 1.5 50 */ 51@Deprecated 52public class DefaultLoaderRepository { 53 /** 54 * Go through the list of class loaders and try to load the requested class. 55 * The method will stop as soon as the class is found. If the class 56 * is not found the method will throw a <CODE>ClassNotFoundException</CODE> 57 * exception. 58 * 59 * @param className The name of the class to be loaded. 60 * 61 * @return the loaded class. 62 * 63 * @exception ClassNotFoundException The specified class could not be found. 64 */ 65 public static Class<?> loadClass(String className) 66 throws ClassNotFoundException { 67 return javax.management.loading.DefaultLoaderRepository.loadClass(className); 68 } 69 70 71 /** 72 * Go through the list of class loaders but exclude the given class loader, then try to load 73 * the requested class. 74 * The method will stop as soon as the class is found. If the class 75 * is not found the method will throw a <CODE>ClassNotFoundException</CODE> 76 * exception. 77 * 78 * @param className The name of the class to be loaded. 79 * @param loader The class loader to be excluded. 80 * 81 * @return the loaded class. 82 * 83 * @exception ClassNotFoundException The specified class could not be found. 84 */ 85 public static Class<?> loadClassWithout(ClassLoader loader,String className) 86 throws ClassNotFoundException { 87 return javax.management.loading.DefaultLoaderRepository.loadClassWithout(loader, className); 88 } 89 90 } 91