MLet (Java SE 15 & JDK 15) (original) (raw)

All Implemented Interfaces:

[Closeable](../../../../java.base/java/io/Closeable.html "interface in java.io"), [Externalizable](../../../../java.base/java/io/Externalizable.html "interface in java.io"), [Serializable](../../../../java.base/java/io/Serializable.html "interface in java.io"), [AutoCloseable](../../../../java.base/java/lang/AutoCloseable.html "interface in java.lang"), [MLetMBean](MLetMBean.html "interface in javax.management.loading"), [MBeanRegistration](../MBeanRegistration.html "interface in javax.management")

Direct Known Subclasses:

[PrivateMLet](PrivateMLet.html "class in javax.management.loading")


public class MLet extends URLClassLoader implements MLetMBean, MBeanRegistration, Externalizable

Allows you to instantiate and register one or several MBeans in the MBean server coming from a remote URL. M-let is a shortcut for management applet. The m-let service does this by loading an m-let text file, which specifies information on the MBeans to be obtained. The information on each MBean is specified in a single instance of a tag, called the MLET tag. The location of the m-let text file is specified by a URL.

The MLET tag has the following syntax:

<MLET
CODE = class| OBJECT =serfile
ARCHIVE = "archiveList"
[CODEBASE = codebaseURL]
[NAME = mbeanname]
[VERSION = version]
>
[arglist]
</MLET>

where:

CODE = class

This attribute specifies the full Java class name, including package name, of the MBean to be obtained. The compiled .class file of the MBean must be contained in one of the .jar files specified by the ARCHIVE attribute. Either CODE or OBJECT must be present.

OBJECT = serfile

This attribute specifies the .ser file that contains a serialized representation of the MBean to be obtained. This file must be contained in one of the .jar files specified by the ARCHIVE attribute. If the .jar file contains a directory hierarchy, specify the path of the file within this hierarchy. Otherwise a match will not be found. Either CODE or OBJECT must be present.

ARCHIVE = "archiveList"

This mandatory attribute specifies one or more .jar files containing MBeans or other resources used by the MBean to be obtained. One of the .jar files must contain the file specified by the CODE or OBJECT attribute. If archivelist contains more than one file:

CODEBASE = codebaseURL

This optional attribute specifies the code base URL of the MBean to be obtained. It identifies the directory that contains the .jar files specified by the ARCHIVE attribute. Specify this attribute only if the .jar files are not in the same directory as the m-let text file. If this attribute is not specified, the base URL of the m-let text file is used.

NAME = mbeanname

This optional attribute specifies the object name to be assigned to the MBean instance when the m-let service registers it. Ifmbeanname starts with the colon character (:), the domain part of the object name is the default domain of the MBean server, as returned by MBeanServerConnection.getDefaultDomain().

VERSION = version

This optional attribute specifies the version number of the MBean and associated .jar files to be obtained. This version number can be used to specify that the .jar files are loaded from the server to update those stored locally in the cache the next time the m-let text file is loaded. version must be a series of non-negative decimal integers each separated by a period from the one that precedes it.

arglist

This optional attribute specifies a list of one or more parameters for the MBean to be instantiated. This list describes the parameters to be passed the MBean's constructor. Use the following syntax to specify each item inarglist:

<ARG TYPE=argumentType VALUE=value>

where:

The arguments' type in the argument list should be a Java primitive type or a Java basic type (java.lang.Boolean, java.lang.Byte, java.lang.Short, java.lang.Long, java.lang.Integer, java.lang.Float, java.lang.Double, java.lang.String).

When an m-let text file is loaded, an instance of each MBean specified in the file is created and registered.

The m-let service extends the java.net.URLClassLoader and can be used to load remote classes and jar files in the VM of the agent.

Note - The MLet class loader uses the MBeanServerFactory.getClassLoaderRepository(javax.management.MBeanServer) to load classes that could not be found in the loaded jar files.

Since:

1.5

See Also:

Serialized Form

Constructors

Constructor Description
MLet() Constructs a new MLet using the default delegation parent ClassLoader.
MLet​(URL[] urls) Constructs a new MLet for the specified URLs using the default delegation parent ClassLoader.
MLet​(URL[] urls, boolean delegateToCLR) Constructs a new MLet for the specified URLs using the default delegation parent ClassLoader.
MLet​(URL[] urls,ClassLoader parent) Constructs a new MLet for the given URLs.
MLet​(URL[] urls,ClassLoader parent, boolean delegateToCLR) Constructs a new MLet for the given URLs.
MLet​(URL[] urls,ClassLoader parent,URLStreamHandlerFactory factory) Constructs a new MLet for the specified URLs, parent class loader, and URLStreamHandlerFactory.
MLet​(URL[] urls,ClassLoader parent,URLStreamHandlerFactory factory, boolean delegateToCLR) Constructs a new MLet for the specified URLs, parent class loader, and URLStreamHandlerFactory.
Modifier and Type Method Description
void addURL​(String url) Appends the specified URL to the list of URLs to search for classes and resources.
void addURL​(URL url) Appends the specified URL to the list of URLs to search for classes and resources.
protected URL check​(String version,URL codebase,String jarfile,MLetContent mlet) This method is to be overridden when extending this service to support caching and versioning.
protected Class<?> findClass​(String name) This is the main method for class loaders that is being redefined.
protected String findLibrary​(String libname) Returns the absolute path name of a native library.
String getLibraryDirectory() Gets the current directory used by the library loader for storing native libraries before they are loaded into memory.
Set<Object> getMBeansFromURL​(String url) Loads a text file containing MLET tags that define the MBeans to be added to the MBean server.
Set<Object> getMBeansFromURL​(URL url) Loads a text file containing MLET tags that define the MBeans to be added to the MBean server.
URL[] getURLs() Returns the search path of URLs for loading classes and resources.
Class<?> loadClass​(String name,ClassLoaderRepository clr) Load a class, using the given ClassLoaderRepository if the class is not found in this MLet's URLs.
void postDeregister() Allows the m-let to perform any operations needed after having been unregistered in the MBean server.
void postRegister​(Boolean registrationDone) Allows the m-let to perform any operations needed after having been registered in the MBean server or after the registration has failed.
void preDeregister() Allows the m-let to perform any operations it needs before being unregistered by the MBean server.
ObjectName preRegister​(MBeanServer server,ObjectName name) Allows the m-let to perform any operations it needs before being registered in the MBean server.
void readExternal​(ObjectInput in) Restore this MLet's contents from the given ObjectInput.
void setLibraryDirectory​(String libdir) Sets the directory used by the library loader for storing native libraries before they are loaded into memory.
void writeExternal​(ObjectOutput out) Save this MLet's contents to the given ObjectOutput.

Methods declared in class java.lang.ClassLoader

[clearAssertionStatus](../../../../java.base/java/lang/ClassLoader.html#clearAssertionStatus%28%29), [defineClass](../../../../java.base/java/lang/ClassLoader.html#defineClass%28byte%5B%5D,int,int%29), [defineClass](../../../../java.base/java/lang/ClassLoader.html#defineClass%28java.lang.String,byte%5B%5D,int,int%29), [defineClass](../../../../java.base/java/lang/ClassLoader.html#defineClass%28java.lang.String,byte%5B%5D,int,int,java.security.ProtectionDomain%29), [defineClass](../../../../java.base/java/lang/ClassLoader.html#defineClass%28java.lang.String,java.nio.ByteBuffer,java.security.ProtectionDomain%29), [definePackage](../../../../java.base/java/lang/ClassLoader.html#definePackage%28java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.net.URL%29), [findClass](../../../../java.base/java/lang/ClassLoader.html#findClass%28java.lang.String,java.lang.String%29), [findLoadedClass](../../../../java.base/java/lang/ClassLoader.html#findLoadedClass%28java.lang.String%29), [findResource](../../../../java.base/java/lang/ClassLoader.html#findResource%28java.lang.String,java.lang.String%29), [findSystemClass](../../../../java.base/java/lang/ClassLoader.html#findSystemClass%28java.lang.String%29), [getClassLoadingLock](../../../../java.base/java/lang/ClassLoader.html#getClassLoadingLock%28java.lang.String%29), [getDefinedPackage](../../../../java.base/java/lang/ClassLoader.html#getDefinedPackage%28java.lang.String%29), [getDefinedPackages](../../../../java.base/java/lang/ClassLoader.html#getDefinedPackages%28%29), [getName](../../../../java.base/java/lang/ClassLoader.html#getName%28%29), [getPackage](../../../../java.base/java/lang/ClassLoader.html#getPackage%28java.lang.String%29), [getPackages](../../../../java.base/java/lang/ClassLoader.html#getPackages%28%29), [getParent](../../../../java.base/java/lang/ClassLoader.html#getParent%28%29), [getPlatformClassLoader](../../../../java.base/java/lang/ClassLoader.html#getPlatformClassLoader%28%29), [getResource](../../../../java.base/java/lang/ClassLoader.html#getResource%28java.lang.String%29), [getResources](../../../../java.base/java/lang/ClassLoader.html#getResources%28java.lang.String%29), [getSystemClassLoader](../../../../java.base/java/lang/ClassLoader.html#getSystemClassLoader%28%29), [getSystemResource](../../../../java.base/java/lang/ClassLoader.html#getSystemResource%28java.lang.String%29), [getSystemResourceAsStream](../../../../java.base/java/lang/ClassLoader.html#getSystemResourceAsStream%28java.lang.String%29), [getSystemResources](../../../../java.base/java/lang/ClassLoader.html#getSystemResources%28java.lang.String%29), [getUnnamedModule](../../../../java.base/java/lang/ClassLoader.html#getUnnamedModule%28%29), [isRegisteredAsParallelCapable](../../../../java.base/java/lang/ClassLoader.html#isRegisteredAsParallelCapable%28%29), [loadClass](../../../../java.base/java/lang/ClassLoader.html#loadClass%28java.lang.String%29), [loadClass](../../../../java.base/java/lang/ClassLoader.html#loadClass%28java.lang.String,boolean%29), [registerAsParallelCapable](../../../../java.base/java/lang/ClassLoader.html#registerAsParallelCapable%28%29), [resolveClass](../../../../java.base/java/lang/ClassLoader.html#resolveClass%28java.lang.Class%29), [resources](../../../../java.base/java/lang/ClassLoader.html#resources%28java.lang.String%29), [setClassAssertionStatus](../../../../java.base/java/lang/ClassLoader.html#setClassAssertionStatus%28java.lang.String,boolean%29), [setDefaultAssertionStatus](../../../../java.base/java/lang/ClassLoader.html#setDefaultAssertionStatus%28boolean%29), [setPackageAssertionStatus](../../../../java.base/java/lang/ClassLoader.html#setPackageAssertionStatus%28java.lang.String,boolean%29), [setSigners](../../../../java.base/java/lang/ClassLoader.html#setSigners%28java.lang.Class,java.lang.Object%5B%5D%29)

Methods declared in class java.lang.Object

[clone](../../../../java.base/java/lang/Object.html#clone%28%29), [equals](../../../../java.base/java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../../../java.base/java/lang/Object.html#finalize%28%29), [getClass](../../../../java.base/java/lang/Object.html#getClass%28%29), [hashCode](../../../../java.base/java/lang/Object.html#hashCode%28%29), [notify](../../../../java.base/java/lang/Object.html#notify%28%29), [notifyAll](../../../../java.base/java/lang/Object.html#notifyAll%28%29), [toString](../../../../java.base/java/lang/Object.html#toString%28%29), [wait](../../../../java.base/java/lang/Object.html#wait%28%29), [wait](../../../../java.base/java/lang/Object.html#wait%28long%29), [wait](../../../../java.base/java/lang/Object.html#wait%28long,int%29)