feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
151
jdkSrc/jdk8/javax/management/loading/ClassLoaderRepository.java
Normal file
151
jdkSrc/jdk8/javax/management/loading/ClassLoaderRepository.java
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package javax.management.loading;
|
||||
|
||||
import javax.management.MBeanServer; // for Javadoc
|
||||
|
||||
/**
|
||||
* <p>Instances of this interface are used to keep the list of ClassLoaders
|
||||
* registered in an MBean Server.
|
||||
* They provide the necessary methods to load classes using the registered
|
||||
* ClassLoaders.</p>
|
||||
*
|
||||
* <p>The first ClassLoader in a <code>ClassLoaderRepository</code> is
|
||||
* always the MBean Server's own ClassLoader.</p>
|
||||
*
|
||||
* <p>When an MBean is registered in an MBean Server, if it is of a
|
||||
* subclass of {@link java.lang.ClassLoader} and if it does not
|
||||
* implement the interface {@link PrivateClassLoader}, it is added to
|
||||
* the end of the MBean Server's <code>ClassLoaderRepository</code>.
|
||||
* If it is subsequently unregistered from the MBean Server, it is
|
||||
* removed from the <code>ClassLoaderRepository</code>.</p>
|
||||
*
|
||||
* <p>The order of MBeans in the <code>ClassLoaderRepository</code> is
|
||||
* significant. For any two MBeans <em>X</em> and <em>Y</em> in the
|
||||
* <code>ClassLoaderRepository</code>, <em>X</em> must appear before
|
||||
* <em>Y</em> if the registration of <em>X</em> was completed before
|
||||
* the registration of <em>Y</em> started. If <em>X</em> and
|
||||
* <em>Y</em> were registered concurrently, their order is
|
||||
* indeterminate. The registration of an MBean corresponds to the
|
||||
* call to {@link MBeanServer#registerMBean} or one of the {@link
|
||||
* MBeanServer}<code>.createMBean</code> methods.</p>
|
||||
*
|
||||
* @see javax.management.MBeanServerFactory
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public interface ClassLoaderRepository {
|
||||
|
||||
/**
|
||||
* <p>Load the given class name through the list of class loaders.
|
||||
* Each ClassLoader in turn from the ClassLoaderRepository is
|
||||
* asked to load the class via its {@link
|
||||
* ClassLoader#loadClass(String)} method. If it successfully
|
||||
* returns a {@link Class} object, that is the result of this
|
||||
* method. If it throws a {@link ClassNotFoundException}, the
|
||||
* search continues with the next ClassLoader. If it throws
|
||||
* another exception, the exception is propagated from this
|
||||
* method. If the end of the list is reached, a {@link
|
||||
* ClassNotFoundException} is thrown.</p>
|
||||
*
|
||||
* @param className The name of the class to be loaded.
|
||||
*
|
||||
* @return the loaded class.
|
||||
*
|
||||
* @exception ClassNotFoundException The specified class could not be
|
||||
* found.
|
||||
*/
|
||||
public Class<?> loadClass(String className)
|
||||
throws ClassNotFoundException;
|
||||
|
||||
/**
|
||||
* <p>Load the given class name through the list of class loaders,
|
||||
* excluding the given one. Each ClassLoader in turn from the
|
||||
* ClassLoaderRepository, except <code>exclude</code>, is asked to
|
||||
* load the class via its {@link ClassLoader#loadClass(String)}
|
||||
* method. If it successfully returns a {@link Class} object,
|
||||
* that is the result of this method. If it throws a {@link
|
||||
* ClassNotFoundException}, the search continues with the next
|
||||
* ClassLoader. If it throws another exception, the exception is
|
||||
* propagated from this method. If the end of the list is
|
||||
* reached, a {@link ClassNotFoundException} is thrown.</p>
|
||||
*
|
||||
* <p>Be aware that if a ClassLoader in the ClassLoaderRepository
|
||||
* calls this method from its {@link ClassLoader#loadClass(String)
|
||||
* loadClass} method, it exposes itself to a deadlock if another
|
||||
* ClassLoader in the ClassLoaderRepository does the same thing at
|
||||
* the same time. The {@link #loadClassBefore} method is
|
||||
* recommended to avoid the risk of deadlock.</p>
|
||||
*
|
||||
* @param className The name of the class to be loaded.
|
||||
* @param exclude The class loader to be excluded. May be null,
|
||||
* in which case this method is equivalent to {@link #loadClass
|
||||
* loadClass(className)}.
|
||||
*
|
||||
* @return the loaded class.
|
||||
*
|
||||
* @exception ClassNotFoundException The specified class could not
|
||||
* be found.
|
||||
*/
|
||||
public Class<?> loadClassWithout(ClassLoader exclude,
|
||||
String className)
|
||||
throws ClassNotFoundException;
|
||||
|
||||
/**
|
||||
* <p>Load the given class name through the list of class loaders,
|
||||
* stopping at the given one. Each ClassLoader in turn from the
|
||||
* ClassLoaderRepository is asked to load the class via its {@link
|
||||
* ClassLoader#loadClass(String)} method. If it successfully
|
||||
* returns a {@link Class} object, that is the result of this
|
||||
* method. If it throws a {@link ClassNotFoundException}, the
|
||||
* search continues with the next ClassLoader. If it throws
|
||||
* another exception, the exception is propagated from this
|
||||
* method. If the search reaches <code>stop</code> or the end of
|
||||
* the list, a {@link ClassNotFoundException} is thrown.</p>
|
||||
*
|
||||
* <p>Typically this method is called from the {@link
|
||||
* ClassLoader#loadClass(String) loadClass} method of
|
||||
* <code>stop</code>, to consult loaders that appear before it
|
||||
* in the <code>ClassLoaderRepository</code>. By stopping the
|
||||
* search as soon as <code>stop</code> is reached, a potential
|
||||
* deadlock with concurrent class loading is avoided.</p>
|
||||
*
|
||||
* @param className The name of the class to be loaded.
|
||||
* @param stop The class loader at which to stop. May be null, in
|
||||
* which case this method is equivalent to {@link #loadClass(String)
|
||||
* loadClass(className)}.
|
||||
*
|
||||
* @return the loaded class.
|
||||
*
|
||||
* @exception ClassNotFoundException The specified class could not
|
||||
* be found.
|
||||
*
|
||||
*/
|
||||
public Class<?> loadClassBefore(ClassLoader stop,
|
||||
String className)
|
||||
throws ClassNotFoundException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package javax.management.loading;
|
||||
|
||||
import static com.sun.jmx.defaults.JmxProperties.MBEANSERVER_LOGGER;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.MBeanServerFactory;
|
||||
|
||||
/**
|
||||
* <p>Keeps the list of Class Loaders registered in the MBean Server.
|
||||
* It provides the necessary methods to load classes using the registered
|
||||
* Class Loaders.</p>
|
||||
*
|
||||
* <p>This deprecated class is maintained for compatibility. In
|
||||
* previous versions of JMX, there was one
|
||||
* <code>DefaultLoaderRepository</code> shared by all MBean servers.
|
||||
* As of JMX 1.2, that functionality is approximated by using {@link
|
||||
* MBeanServerFactory#findMBeanServer} to find all known MBean
|
||||
* servers, and consulting the {@link ClassLoaderRepository} of each
|
||||
* one. It is strongly recommended that code referencing
|
||||
* <code>DefaultLoaderRepository</code> be rewritten.</p>
|
||||
*
|
||||
* @deprecated Use
|
||||
* {@link javax.management.MBeanServer#getClassLoaderRepository()}}
|
||||
* instead.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
@Deprecated
|
||||
public class DefaultLoaderRepository {
|
||||
|
||||
/**
|
||||
* Go through the list of class loaders and try to load the requested
|
||||
* class.
|
||||
* The method will stop as soon as the class is found. If the class
|
||||
* is not found the method will throw a <CODE>ClassNotFoundException</CODE>
|
||||
* exception.
|
||||
*
|
||||
* @param className The name of the class to be loaded.
|
||||
*
|
||||
* @return the loaded class.
|
||||
*
|
||||
* @exception ClassNotFoundException The specified class could not be
|
||||
* found.
|
||||
*/
|
||||
public static Class<?> loadClass(String className)
|
||||
throws ClassNotFoundException {
|
||||
MBEANSERVER_LOGGER.logp(Level.FINEST,
|
||||
DefaultLoaderRepository.class.getName(),
|
||||
"loadClass", className);
|
||||
return load(null, className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Go through the list of class loaders but exclude the given
|
||||
* class loader, then try to load
|
||||
* the requested class.
|
||||
* The method will stop as soon as the class is found. If the class
|
||||
* is not found the method will throw a <CODE>ClassNotFoundException</CODE>
|
||||
* exception.
|
||||
*
|
||||
* @param className The name of the class to be loaded.
|
||||
* @param loader The class loader to be excluded.
|
||||
*
|
||||
* @return the loaded class.
|
||||
*
|
||||
* @exception ClassNotFoundException The specified class could not be
|
||||
* found.
|
||||
*/
|
||||
public static Class<?> loadClassWithout(ClassLoader loader,
|
||||
String className)
|
||||
throws ClassNotFoundException {
|
||||
MBEANSERVER_LOGGER.logp(Level.FINEST,
|
||||
DefaultLoaderRepository.class.getName(),
|
||||
"loadClassWithout", className);
|
||||
return load(loader, className);
|
||||
}
|
||||
|
||||
private static Class<?> load(ClassLoader without, String className)
|
||||
throws ClassNotFoundException {
|
||||
final List<MBeanServer> mbsList = MBeanServerFactory.findMBeanServer(null);
|
||||
|
||||
for (MBeanServer mbs : mbsList) {
|
||||
ClassLoaderRepository clr = mbs.getClassLoaderRepository();
|
||||
try {
|
||||
return clr.loadClassWithout(without, className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
// OK : Try with next one...
|
||||
}
|
||||
}
|
||||
throw new ClassNotFoundException(className);
|
||||
}
|
||||
|
||||
}
|
||||
1338
jdkSrc/jdk8/javax/management/loading/MLet.java
Normal file
1338
jdkSrc/jdk8/javax/management/loading/MLet.java
Normal file
File diff suppressed because it is too large
Load Diff
239
jdkSrc/jdk8/javax/management/loading/MLetContent.java
Normal file
239
jdkSrc/jdk8/javax/management/loading/MLetContent.java
Normal file
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package javax.management.loading;
|
||||
|
||||
|
||||
// java import
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class represents the contents of the <CODE>MLET</CODE> tag.
|
||||
* It can be consulted by a subclass of {@link MLet} that overrides
|
||||
* the {@link MLet#check MLet.check} method.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public class MLetContent {
|
||||
|
||||
|
||||
/**
|
||||
* A map of the attributes of the <CODE>MLET</CODE> tag
|
||||
* and their values.
|
||||
*/
|
||||
private Map<String,String> attributes;
|
||||
|
||||
/**
|
||||
* An ordered list of the TYPE attributes that appeared in nested
|
||||
* <PARAM> tags.
|
||||
*/
|
||||
private List<String> types;
|
||||
|
||||
/**
|
||||
* An ordered list of the VALUE attributes that appeared in nested
|
||||
* <PARAM> tags.
|
||||
*/
|
||||
private List<String> values;
|
||||
|
||||
/**
|
||||
* The MLet text file's base URL.
|
||||
*/
|
||||
private URL documentURL;
|
||||
/**
|
||||
* The base URL.
|
||||
*/
|
||||
private URL baseURL;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an <CODE>MLet</CODE> instance initialized with attributes read
|
||||
* from an <CODE>MLET</CODE> tag in an MLet text file.
|
||||
*
|
||||
* @param url The URL of the MLet text file containing the
|
||||
* <CODE>MLET</CODE> tag.
|
||||
* @param attributes A map of the attributes of the <CODE>MLET</CODE> tag.
|
||||
* The keys in this map are the attribute names in lowercase, for
|
||||
* example <code>codebase</code>. The values are the associated attribute
|
||||
* values.
|
||||
* @param types A list of the TYPE attributes that appeared in nested
|
||||
* <PARAM> tags.
|
||||
* @param values A list of the VALUE attributes that appeared in nested
|
||||
* <PARAM> tags.
|
||||
*/
|
||||
public MLetContent(URL url, Map<String,String> attributes,
|
||||
List<String> types, List<String> values) {
|
||||
this.documentURL = url;
|
||||
this.attributes = Collections.unmodifiableMap(attributes);
|
||||
this.types = Collections.unmodifiableList(types);
|
||||
this.values = Collections.unmodifiableList(values);
|
||||
|
||||
// Initialize baseURL
|
||||
//
|
||||
String att = getParameter("codebase");
|
||||
if (att != null) {
|
||||
if (!att.endsWith("/")) {
|
||||
att += "/";
|
||||
}
|
||||
try {
|
||||
baseURL = new URL(documentURL, att);
|
||||
} catch (MalformedURLException e) {
|
||||
// OK : Move to next block as baseURL could not be initialized.
|
||||
}
|
||||
}
|
||||
if (baseURL == null) {
|
||||
String file = documentURL.getFile();
|
||||
int i = file.lastIndexOf('/');
|
||||
if (i >= 0 && i < file.length() - 1) {
|
||||
try {
|
||||
baseURL = new URL(documentURL, file.substring(0, i + 1));
|
||||
} catch (MalformedURLException e) {
|
||||
// OK : Move to next block as baseURL could not be initialized.
|
||||
}
|
||||
}
|
||||
}
|
||||
if (baseURL == null)
|
||||
baseURL = documentURL;
|
||||
|
||||
}
|
||||
|
||||
// GETTERS AND SETTERS
|
||||
//--------------------
|
||||
|
||||
/**
|
||||
* Gets the attributes of the <CODE>MLET</CODE> tag. The keys in
|
||||
* the returned map are the attribute names in lowercase, for
|
||||
* example <code>codebase</code>. The values are the associated
|
||||
* attribute values.
|
||||
* @return A map of the attributes of the <CODE>MLET</CODE> tag
|
||||
* and their values.
|
||||
*/
|
||||
public Map<String,String> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the MLet text file's base URL.
|
||||
* @return The MLet text file's base URL.
|
||||
*/
|
||||
public URL getDocumentBase() {
|
||||
return documentURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the code base URL.
|
||||
* @return The code base URL.
|
||||
*/
|
||||
public URL getCodeBase() {
|
||||
return baseURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of <CODE>.jar</CODE> files specified by the <CODE>ARCHIVE</CODE>
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
* @return A comma-separated list of <CODE>.jar</CODE> file names.
|
||||
*/
|
||||
public String getJarFiles() {
|
||||
return getParameter("archive");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the <CODE>CODE</CODE>
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
* @return The value of the <CODE>CODE</CODE>
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
*/
|
||||
public String getCode() {
|
||||
return getParameter("code");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the <CODE>OBJECT</CODE>
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
* @return The value of the <CODE>OBJECT</CODE>
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
*/
|
||||
public String getSerializedObject() {
|
||||
return getParameter("object");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the <CODE>NAME</CODE>
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
* @return The value of the <CODE>NAME</CODE>
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
*/
|
||||
public String getName() {
|
||||
return getParameter("name");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value of the <CODE>VERSION</CODE>
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
* @return The value of the <CODE>VERSION</CODE>
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
*/
|
||||
public String getVersion() {
|
||||
return getParameter("version");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of values of the <code>TYPE</code> attribute in
|
||||
* each nested <PARAM> tag within the <code>MLET</code>
|
||||
* tag.
|
||||
* @return the list of types.
|
||||
*/
|
||||
public List<String> getParameterTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of values of the <code>VALUE</code> attribute in
|
||||
* each nested <PARAM> tag within the <code>MLET</code>
|
||||
* tag.
|
||||
* @return the list of values.
|
||||
*/
|
||||
public List<String> getParameterValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the specified
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
*
|
||||
* @param name A string representing the name of the attribute.
|
||||
* @return The value of the specified
|
||||
* attribute of the <CODE>MLET</CODE> tag.
|
||||
*/
|
||||
private String getParameter(String name) {
|
||||
return attributes.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
186
jdkSrc/jdk8/javax/management/loading/MLetMBean.java
Normal file
186
jdkSrc/jdk8/javax/management/loading/MLetMBean.java
Normal file
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package javax.management.loading;
|
||||
|
||||
import java.net.URL;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.management.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Exposes the remote management interface of the MLet
|
||||
* MBean.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public interface MLetMBean {
|
||||
|
||||
|
||||
/**
|
||||
* Loads a text file containing MLET tags that define the MBeans
|
||||
* to be added to the MBean server. The location of the text file is
|
||||
* specified by a URL. The text file is read using the UTF-8
|
||||
* encoding. The MBeans specified in the MLET file will be
|
||||
* instantiated and registered in the MBean server.
|
||||
*
|
||||
* @param url The URL of the text file to be loaded as String object.
|
||||
*
|
||||
* @return A set containing one entry per MLET tag in the m-let
|
||||
* text file loaded. Each entry specifies either the
|
||||
* ObjectInstance for the created MBean, or a throwable object
|
||||
* (that is, an error or an exception) if the MBean could not be
|
||||
* created.
|
||||
*
|
||||
* @exception ServiceNotFoundException One of the following errors
|
||||
* has occurred: The m-let text file does not contain an MLET tag,
|
||||
* the m-let text file is not found, a mandatory attribute of the
|
||||
* MLET tag is not specified, the value of url is malformed.
|
||||
*/
|
||||
public Set<Object> getMBeansFromURL(String url)
|
||||
throws ServiceNotFoundException;
|
||||
|
||||
/**
|
||||
* Loads a text file containing MLET tags that define the MBeans
|
||||
* to be added to the MBean server. The location of the text file is
|
||||
* specified by a URL. The text file is read using the UTF-8
|
||||
* encoding. The MBeans specified in the MLET file will be
|
||||
* instantiated and registered in the MBean server.
|
||||
*
|
||||
* @param url The URL of the text file to be loaded as URL object.
|
||||
*
|
||||
* @return A set containing one entry per MLET tag in the m-let
|
||||
* text file loaded. Each entry specifies either the
|
||||
* ObjectInstance for the created MBean, or a throwable object
|
||||
* (that is, an error or an exception) if the MBean could not be
|
||||
* created.
|
||||
*
|
||||
* @exception ServiceNotFoundException One of the following errors
|
||||
* has occurred: The m-let text file does not contain an MLET tag,
|
||||
* the m-let text file is not found, a mandatory attribute of the
|
||||
* MLET tag is not specified, the value of url is null.
|
||||
*/
|
||||
public Set<Object> getMBeansFromURL(URL url)
|
||||
throws ServiceNotFoundException;
|
||||
|
||||
/**
|
||||
* Appends the specified URL to the list of URLs to search for classes and
|
||||
* resources.
|
||||
*
|
||||
* @param url the URL to add.
|
||||
*/
|
||||
public void addURL(URL url) ;
|
||||
|
||||
/**
|
||||
* Appends the specified URL to the list of URLs to search for classes and
|
||||
* resources.
|
||||
*
|
||||
* @param url the URL to add.
|
||||
*
|
||||
* @exception ServiceNotFoundException The specified URL is malformed.
|
||||
*/
|
||||
public void addURL(String url) throws ServiceNotFoundException;
|
||||
|
||||
/**
|
||||
* Returns the search path of URLs for loading classes and resources.
|
||||
* This includes the original list of URLs specified to the constructor,
|
||||
* along with any URLs subsequently appended by the addURL() method.
|
||||
*
|
||||
* @return the list of URLs.
|
||||
*/
|
||||
public URL[] getURLs();
|
||||
|
||||
/** Finds the resource with the given name.
|
||||
* A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is
|
||||
* independent of the location of the code.
|
||||
* The name of a resource is a "/"-separated path name that identifies the resource.
|
||||
*
|
||||
* @param name The resource name
|
||||
*
|
||||
* @return An URL for reading the resource, or null if the resource could not be found or the caller doesn't have adequate privileges to get the
|
||||
* resource.
|
||||
*/
|
||||
public URL getResource(String name);
|
||||
|
||||
/** Returns an input stream for reading the specified resource. The search order is described in the documentation for
|
||||
* getResource(String).
|
||||
*
|
||||
* @param name The resource name
|
||||
*
|
||||
* @return An input stream for reading the resource, or null if the resource could not be found
|
||||
*
|
||||
*/
|
||||
public InputStream getResourceAsStream(String name);
|
||||
|
||||
/**
|
||||
* Finds all the resources with the given name. A resource is some
|
||||
* data (images, audio, text, etc) that can be accessed by class
|
||||
* code in a way that is independent of the location of the code.
|
||||
* The name of a resource is a "/"-separated path name that
|
||||
* identifies the resource.
|
||||
*
|
||||
* @param name The resource name.
|
||||
*
|
||||
* @return An enumeration of URL to the resource. If no resources
|
||||
* could be found, the enumeration will be empty. Resources that
|
||||
* cannot be accessed will not be in the enumeration.
|
||||
*
|
||||
* @exception IOException if an I/O exception occurs when
|
||||
* searching for resources.
|
||||
*/
|
||||
public Enumeration<URL> getResources(String name) throws IOException;
|
||||
|
||||
/**
|
||||
* Gets the current directory used by the library loader for
|
||||
* storing native libraries before they are loaded into memory.
|
||||
*
|
||||
* @return The current directory used by the library loader.
|
||||
*
|
||||
* @see #setLibraryDirectory
|
||||
*
|
||||
* @throws UnsupportedOperationException if this implementation
|
||||
* does not support storing native libraries in this way.
|
||||
*/
|
||||
public String getLibraryDirectory();
|
||||
|
||||
/**
|
||||
* Sets the directory used by the library loader for storing
|
||||
* native libraries before they are loaded into memory.
|
||||
*
|
||||
* @param libdir The directory used by the library loader.
|
||||
*
|
||||
* @see #getLibraryDirectory
|
||||
*
|
||||
* @throws UnsupportedOperationException if this implementation
|
||||
* does not support storing native libraries in this way.
|
||||
*/
|
||||
public void setLibraryDirectory(String libdir);
|
||||
|
||||
}
|
||||
122
jdkSrc/jdk8/javax/management/loading/MLetObjectInputStream.java
Normal file
122
jdkSrc/jdk8/javax/management/loading/MLetObjectInputStream.java
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package javax.management.loading;
|
||||
|
||||
|
||||
// java import
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
|
||||
/**
|
||||
* This subclass of ObjectInputStream delegates loading of classes to
|
||||
* an existing MLetClassLoader.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class MLetObjectInputStream extends ObjectInputStream {
|
||||
|
||||
private MLet loader;
|
||||
|
||||
/**
|
||||
* Loader must be non-null;
|
||||
*/
|
||||
public MLetObjectInputStream(InputStream in, MLet loader)
|
||||
throws IOException, StreamCorruptedException {
|
||||
|
||||
super(in);
|
||||
if (loader == null) {
|
||||
throw new IllegalArgumentException("Illegal null argument to MLetObjectInputStream");
|
||||
}
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
private Class<?> primitiveType(char c) {
|
||||
switch(c) {
|
||||
case 'B':
|
||||
return Byte.TYPE;
|
||||
|
||||
case 'C':
|
||||
return Character.TYPE;
|
||||
|
||||
case 'D':
|
||||
return Double.TYPE;
|
||||
|
||||
case 'F':
|
||||
return Float.TYPE;
|
||||
|
||||
case 'I':
|
||||
return Integer.TYPE;
|
||||
|
||||
case 'J':
|
||||
return Long.TYPE;
|
||||
|
||||
case 'S':
|
||||
return Short.TYPE;
|
||||
|
||||
case 'Z':
|
||||
return Boolean.TYPE;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the given ClassLoader rather than using the system class
|
||||
*/
|
||||
@Override
|
||||
protected Class<?> resolveClass(ObjectStreamClass objectstreamclass)
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
String s = objectstreamclass.getName();
|
||||
if (s.startsWith("[")) {
|
||||
int i;
|
||||
for (i = 1; s.charAt(i) == '['; i++);
|
||||
Class<?> class1;
|
||||
if (s.charAt(i) == 'L') {
|
||||
class1 = loader.loadClass(s.substring(i + 1, s.length() - 1));
|
||||
} else {
|
||||
if (s.length() != i + 1)
|
||||
throw new ClassNotFoundException(s);
|
||||
class1 = primitiveType(s.charAt(i));
|
||||
}
|
||||
int ai[] = new int[i];
|
||||
for (int j = 0; j < i; j++)
|
||||
ai[j] = 0;
|
||||
|
||||
return Array.newInstance(class1, ai).getClass();
|
||||
} else {
|
||||
return loader.loadClass(s);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ClassLoader being used
|
||||
*/
|
||||
public ClassLoader getClassLoader() {
|
||||
return loader;
|
||||
}
|
||||
}
|
||||
287
jdkSrc/jdk8/javax/management/loading/MLetParser.java
Normal file
287
jdkSrc/jdk8/javax/management/loading/MLetParser.java
Normal file
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package javax.management.loading;
|
||||
|
||||
import static com.sun.jmx.defaults.JmxProperties.MLET_LOGGER;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* This class is used for parsing URLs.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class MLetParser {
|
||||
|
||||
/*
|
||||
* ------------------------------------------
|
||||
* PRIVATE VARIABLES
|
||||
* ------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* The current character
|
||||
*/
|
||||
private int c;
|
||||
|
||||
/**
|
||||
* Tag to parse.
|
||||
*/
|
||||
private static String tag = "mlet";
|
||||
|
||||
|
||||
/*
|
||||
* ------------------------------------------
|
||||
* CONSTRUCTORS
|
||||
* ------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create an MLet parser object
|
||||
*/
|
||||
public MLetParser() {
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------------------------
|
||||
* PUBLIC METHODS
|
||||
* ------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Scan spaces.
|
||||
*/
|
||||
public void skipSpace(Reader in) throws IOException {
|
||||
while ((c >= 0) && ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'))) {
|
||||
c = in.read();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan identifier
|
||||
*/
|
||||
public String scanIdentifier(Reader in) throws IOException {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
while (true) {
|
||||
if (((c >= 'a') && (c <= 'z')) ||
|
||||
((c >= 'A') && (c <= 'Z')) ||
|
||||
((c >= '0') && (c <= '9')) || (c == '_')) {
|
||||
buf.append((char)c);
|
||||
c = in.read();
|
||||
} else {
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan tag
|
||||
*/
|
||||
public Map<String,String> scanTag(Reader in) throws IOException {
|
||||
Map<String,String> atts = new HashMap<String,String>();
|
||||
skipSpace(in);
|
||||
while (c >= 0 && c != '>') {
|
||||
if (c == '<')
|
||||
throw new IOException("Missing '>' in tag");
|
||||
String att = scanIdentifier(in);
|
||||
String val = "";
|
||||
skipSpace(in);
|
||||
if (c == '=') {
|
||||
int quote = -1;
|
||||
c = in.read();
|
||||
skipSpace(in);
|
||||
if ((c == '\'') || (c == '\"')) {
|
||||
quote = c;
|
||||
c = in.read();
|
||||
}
|
||||
StringBuilder buf = new StringBuilder();
|
||||
while ((c > 0) &&
|
||||
(((quote < 0) && (c != ' ') && (c != '\t') &&
|
||||
(c != '\n') && (c != '\r') && (c != '>'))
|
||||
|| ((quote >= 0) && (c != quote)))) {
|
||||
buf.append((char)c);
|
||||
c = in.read();
|
||||
}
|
||||
if (c == quote) {
|
||||
c = in.read();
|
||||
}
|
||||
skipSpace(in);
|
||||
val = buf.toString();
|
||||
}
|
||||
atts.put(att.toLowerCase(), val);
|
||||
skipSpace(in);
|
||||
}
|
||||
return atts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan an html file for {@literal <mlet>} tags.
|
||||
*/
|
||||
public List<MLetContent> parse(URL url) throws IOException {
|
||||
String mth = "parse";
|
||||
// Warning Messages
|
||||
String requiresTypeWarning = "<arg type=... value=...> tag requires type parameter.";
|
||||
String requiresValueWarning = "<arg type=... value=...> tag requires value parameter.";
|
||||
String paramOutsideWarning = "<arg> tag outside <mlet> ... </mlet>.";
|
||||
String requiresCodeWarning = "<mlet> tag requires either code or object parameter.";
|
||||
String requiresJarsWarning = "<mlet> tag requires archive parameter.";
|
||||
|
||||
URLConnection conn;
|
||||
|
||||
conn = url.openConnection();
|
||||
Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream(),
|
||||
"UTF-8"));
|
||||
|
||||
// The original URL may have been redirected - this
|
||||
// sets it to whatever URL/codebase we ended up getting
|
||||
//
|
||||
url = conn.getURL();
|
||||
|
||||
List<MLetContent> mlets = new ArrayList<MLetContent>();
|
||||
Map<String,String> atts = null;
|
||||
|
||||
List<String> types = new ArrayList<String>();
|
||||
List<String> values = new ArrayList<String>();
|
||||
|
||||
// debug("parse","*** Parsing " + url );
|
||||
while(true) {
|
||||
c = in.read();
|
||||
if (c == -1)
|
||||
break;
|
||||
if (c == '<') {
|
||||
c = in.read();
|
||||
if (c == '/') {
|
||||
c = in.read();
|
||||
String nm = scanIdentifier(in);
|
||||
if (c != '>')
|
||||
throw new IOException("Missing '>' in tag");
|
||||
if (nm.equalsIgnoreCase(tag)) {
|
||||
if (atts != null) {
|
||||
mlets.add(new MLetContent(url, atts, types, values));
|
||||
}
|
||||
atts = null;
|
||||
types = new ArrayList<String>();
|
||||
values = new ArrayList<String>();
|
||||
}
|
||||
} else {
|
||||
String nm = scanIdentifier(in);
|
||||
if (nm.equalsIgnoreCase("arg")) {
|
||||
Map<String,String> t = scanTag(in);
|
||||
String att = t.get("type");
|
||||
if (att == null) {
|
||||
MLET_LOGGER.logp(Level.FINER,
|
||||
MLetParser.class.getName(),
|
||||
mth, requiresTypeWarning);
|
||||
throw new IOException(requiresTypeWarning);
|
||||
} else {
|
||||
if (atts != null) {
|
||||
types.add(att);
|
||||
} else {
|
||||
MLET_LOGGER.logp(Level.FINER,
|
||||
MLetParser.class.getName(),
|
||||
mth, paramOutsideWarning);
|
||||
throw new IOException(paramOutsideWarning);
|
||||
}
|
||||
}
|
||||
String val = t.get("value");
|
||||
if (val == null) {
|
||||
MLET_LOGGER.logp(Level.FINER,
|
||||
MLetParser.class.getName(),
|
||||
mth, requiresValueWarning);
|
||||
throw new IOException(requiresValueWarning);
|
||||
} else {
|
||||
if (atts != null) {
|
||||
values.add(val);
|
||||
} else {
|
||||
MLET_LOGGER.logp(Level.FINER,
|
||||
MLetParser.class.getName(),
|
||||
mth, paramOutsideWarning);
|
||||
throw new IOException(paramOutsideWarning);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (nm.equalsIgnoreCase(tag)) {
|
||||
atts = scanTag(in);
|
||||
if (atts.get("code") == null && atts.get("object") == null) {
|
||||
MLET_LOGGER.logp(Level.FINER,
|
||||
MLetParser.class.getName(),
|
||||
mth, requiresCodeWarning);
|
||||
throw new IOException(requiresCodeWarning);
|
||||
}
|
||||
if (atts.get("archive") == null) {
|
||||
MLET_LOGGER.logp(Level.FINER,
|
||||
MLetParser.class.getName(),
|
||||
mth, requiresJarsWarning);
|
||||
throw new IOException(requiresJarsWarning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
return mlets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the document pointed by the URL urlname
|
||||
*/
|
||||
public List<MLetContent> parseURL(String urlname) throws IOException {
|
||||
// Parse the document
|
||||
//
|
||||
URL url;
|
||||
if (urlname.indexOf(':') <= 1) {
|
||||
String userDir = System.getProperty("user.dir");
|
||||
String prot;
|
||||
if (userDir.charAt(0) == '/' ||
|
||||
userDir.charAt(0) == File.separatorChar) {
|
||||
prot = "file:";
|
||||
} else {
|
||||
prot = "file:/";
|
||||
}
|
||||
url =
|
||||
new URL(prot + userDir.replace(File.separatorChar, '/') + "/");
|
||||
url = new URL(url, urlname);
|
||||
} else {
|
||||
url = new URL(urlname);
|
||||
}
|
||||
// Return list of parsed MLets
|
||||
//
|
||||
return parse(url);
|
||||
}
|
||||
|
||||
}
|
||||
37
jdkSrc/jdk8/javax/management/loading/PrivateClassLoader.java
Normal file
37
jdkSrc/jdk8/javax/management/loading/PrivateClassLoader.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package javax.management.loading;
|
||||
|
||||
/**
|
||||
* Marker interface indicating that a ClassLoader should not be added
|
||||
* to the {@link ClassLoaderRepository}. When a ClassLoader is
|
||||
* registered as an MBean in the MBean server, it is added to the
|
||||
* MBean server's ClassLoaderRepository unless it implements this
|
||||
* interface.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public interface PrivateClassLoader {}
|
||||
99
jdkSrc/jdk8/javax/management/loading/PrivateMLet.java
Normal file
99
jdkSrc/jdk8/javax/management/loading/PrivateMLet.java
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package javax.management.loading;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLStreamHandlerFactory;
|
||||
|
||||
/**
|
||||
* An MLet that is not added to the {@link ClassLoaderRepository}.
|
||||
* This class acts exactly like its parent class, {@link MLet}, with
|
||||
* one exception. When a PrivateMLet is registered in an MBean
|
||||
* server, it is not added to that MBean server's {@link
|
||||
* ClassLoaderRepository}. This is true because this class implements
|
||||
* the interface {@link PrivateClassLoader}.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public class PrivateMLet extends MLet implements PrivateClassLoader {
|
||||
private static final long serialVersionUID = 2503458973393711979L;
|
||||
|
||||
/**
|
||||
* Constructs a new PrivateMLet for the specified URLs using the
|
||||
* default delegation parent ClassLoader. The URLs will be
|
||||
* searched in the order specified for classes and resources
|
||||
* after first searching in the parent class loader.
|
||||
*
|
||||
* @param urls The URLs from which to load classes and resources.
|
||||
* @param delegateToCLR True if, when a class is not found in
|
||||
* either the parent ClassLoader or the URLs, the MLet should delegate
|
||||
* to its containing MBeanServer's {@link ClassLoaderRepository}.
|
||||
*
|
||||
*/
|
||||
public PrivateMLet(URL[] urls, boolean delegateToCLR) {
|
||||
super(urls, delegateToCLR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new PrivateMLet for the given URLs. The URLs will
|
||||
* be searched in the order specified for classes and resources
|
||||
* after first searching in the specified parent class loader.
|
||||
* The parent argument will be used as the parent class loader
|
||||
* for delegation.
|
||||
*
|
||||
* @param urls The URLs from which to load classes and resources.
|
||||
* @param parent The parent class loader for delegation.
|
||||
* @param delegateToCLR True if, when a class is not found in
|
||||
* either the parent ClassLoader or the URLs, the MLet should delegate
|
||||
* to its containing MBeanServer's {@link ClassLoaderRepository}.
|
||||
*
|
||||
*/
|
||||
public PrivateMLet(URL[] urls, ClassLoader parent, boolean delegateToCLR) {
|
||||
super(urls, parent, delegateToCLR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new PrivateMLet for the specified URLs, parent
|
||||
* class loader, and URLStreamHandlerFactory. The parent argument
|
||||
* will be used as the parent class loader for delegation. The
|
||||
* factory argument will be used as the stream handler factory to
|
||||
* obtain protocol handlers when creating new URLs.
|
||||
*
|
||||
* @param urls The URLs from which to load classes and resources.
|
||||
* @param parent The parent class loader for delegation.
|
||||
* @param factory The URLStreamHandlerFactory to use when creating URLs.
|
||||
* @param delegateToCLR True if, when a class is not found in
|
||||
* either the parent ClassLoader or the URLs, the MLet should delegate
|
||||
* to its containing MBeanServer's {@link ClassLoaderRepository}.
|
||||
*
|
||||
*/
|
||||
public PrivateMLet(URL[] urls,
|
||||
ClassLoader parent,
|
||||
URLStreamHandlerFactory factory,
|
||||
boolean delegateToCLR) {
|
||||
super(urls, parent, factory, delegateToCLR);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user