Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.management.loading
Class MLet

    java.lang.Object
      |
      +--java.lang.ClassLoader
            |
            +--java.security.SecureClassLoader
                  |
                  +--java.net.URLClassLoader
                        |
                        +--javax.management.loading.MLet

All Implemented Interfaces:
  MBeanRegistration, MLetMBean

public class MLet
extends java.net.URLClassLoader
implements MLetMBean, MBeanRegistration

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: [arglist] 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: Each file must be separated from the one that follows it by a comma (,). archivelist must be enclosed in double quote marks. All .jar files in archivelist must be stored in the directory specified by the code base URL. 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. If mbeanname starts with the colon character (:), the domain part of the object name is the domain of the agent. The m-let service invokes the getDomain() method of the Framework class to obtain this information. 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 in arglist: where: argumentType is the type of the argument that will be passed as parameter to the MBean's constructor. 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.

Author:
  Young Yang

Constructor Summary
`MLet()`
`MLet(java.net.URL[] urls)`
`MLet(java.net.URL[] urls, java.lang.ClassLoader parent)`
`MLet(java.net.URL[] urls, java.lang.ClassLoader parent, java.net.URLStreamHandlerFactory factory)`

Method Summary
`void` | `addURL(java.lang.String url)` Appends the specified URL to the list of URLs to search for classes and resources.
`void` | `addURL(java.net.URL url)` Appends the specified URL to the list of URLs to search for classes and resources.
`java.lang.String` | `getLibraryDirectory()` Gets the current directory used by the library loader for storing native libraries before they are loaded into memory.
`java.util.Set` | `getMBeansFromURL(java.lang.String url)` Loads a text file containing MLET tags that define the MBeans to be added to the agent.
`java.util.Set` | `getMBeansFromURL(java.net.URL url)` Loads a text file containing MLET tags that define the MBeans to be added to the agent.
`java.lang.Class` | `loadClass(java.lang.String name)`
`static void` | `main(java.lang.String[] args)`
`void` | `postDeregister()` Allows the MBean to perform any operations needed after having been de-registered in the MBean server.
`void` | `postRegister(java.lang.Boolean success)` Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.
`void` | `preDeregister()` Allows the MBean to perform any operations it needs before being de-registered by the MBean server.
`ObjectName` | `preRegister(MBeanServer server, ObjectName objName)` get server & objectName & classLoaderRepository
`void` | `setLibraryDirectory(java.lang.String ld)` Sets the directory used by the library loader for storing native libraries before they are loaded into memory.

Methods inherited from class java.net.URLClassLoader
`definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance`

Methods inherited from class java.security.SecureClassLoader
`defineClass`

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.management.loading.MLetMBean
`getResource, getResourceAsStream, getResources, getURLs`

Constructor Detail

### MLet

    public MLet()

### MLet

    public MLet(java.net.URL[] urls)

### MLet

    public MLet(java.net.URL[] urls,
                java.lang.ClassLoader parent)

### MLet

    public MLet(java.net.URL[] urls,
                java.lang.ClassLoader parent,
                java.net.URLStreamHandlerFactory factory)

Method Detail

### getMBeansFromURL

    public java.util.Set getMBeansFromURL(java.net.URL url)
                                   throws ServiceNotFoundException

  Description copied from interface: `MLetMBean`
  Loads a text file containing MLET tags that define the MBeans to be added to the agent. The location of the text file is specified by a URL. The MBeans specified in the MLET file will be instantiated and registered by the MBeanServer.

  Specified by:
    `getMBeansFromURL` in interface `MLetMBean`
  Parameters:
    `url` - The URL of the text file to be loaded as String object.
  Returns:
    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.
  Throws:
    `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.

### getMBeansFromURL

    public java.util.Set getMBeansFromURL(java.lang.String url)
                                   throws ServiceNotFoundException

  Description copied from interface: `MLetMBean`
  Loads a text file containing MLET tags that define the MBeans to be added to the agent. The location of the text file is specified by a URL. The MBeans specified in the MLET file will be instantiated and registered by the MBeanServer.

  Specified by:
    `getMBeansFromURL` in interface `MLetMBean`
  Parameters:
    `url` - The URL of the text file to be loaded as String object.
  Returns:
    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.
  Throws:
    `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.

### addURL

    public void addURL(java.net.URL url)

  Description copied from interface: `MLetMBean`
  Appends the specified URL to the list of URLs to search for classes and resources.

  Specified by:
    `addURL` in interface `MLetMBean`
  Overrides:
    `addURL` in class `java.net.URLClassLoader`

### addURL

    public void addURL(java.lang.String url)
                throws ServiceNotFoundException

  Description copied from interface: `MLetMBean`
  Appends the specified URL to the list of URLs to search for classes and resources.

  Specified by:
    `addURL` in interface `MLetMBean`
  Throws:
    `ServiceNotFoundException` - The specified URL is malformed.

### getLibraryDirectory

    public java.lang.String getLibraryDirectory()

  Description copied from interface: `MLetMBean`
  Gets the current directory used by the library loader for storing native libraries before they are loaded into memory.

  Specified by:
    `getLibraryDirectory` in interface `MLetMBean`
  Returns:
    The current directory used by the library loader.

### setLibraryDirectory

    public void setLibraryDirectory(java.lang.String ld)

  Description copied from interface: `MLetMBean`
  Sets the directory used by the library loader for storing native libraries before they are loaded into memory.

  Specified by:
    `setLibraryDirectory` in interface `MLetMBean`

### preRegister

    public ObjectName preRegister(MBeanServer server,
                                  ObjectName objName)
                           throws java.lang.Exception

  get server & objectName & classLoaderRepository

  Specified by:
    `preRegister` in interface `MBeanRegistration`
  Parameters:
    `server` -
    `objName` -
  Returns:
  Throws:
    `java.lang.Exception`

### postRegister

    public void postRegister(java.lang.Boolean success)

  Description copied from interface: `MBeanRegistration`
  Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

  Specified by:
    `postRegister` in interface `MBeanRegistration`
  Parameters:
    `success` - Indicates whether or not the MBean has been successfully registered in the MBean server. The value false means that the registration phase has failed.

### preDeregister

    public void preDeregister()
                       throws java.lang.Exception

  Description copied from interface: `MBeanRegistration`
  Allows the MBean to perform any operations it needs before being de-registered by the MBean server.

  Specified by:
    `preDeregister` in interface `MBeanRegistration`
  Throws:
    `java.lang.Exception` - This exception should be caught by the MBean server and re-thrown as an `MBeanRegistrationException`.

### postDeregister

    public void postDeregister()

  Description copied from interface: `MBeanRegistration`
  Allows the MBean to perform any operations needed after having been de-registered in the MBean server.

  Specified by:
    `postDeregister` in interface `MBeanRegistration`

### loadClass

    public java.lang.Class loadClass(java.lang.String name)
                              throws java.lang.ClassNotFoundException

  Overrides:
    `loadClass` in class `java.lang.ClassLoader`
    `java.lang.ClassNotFoundException`

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

    `java.lang.Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD