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:
  Externalizable, MBeanRegistration, MLetMBean, Serializable

Direct Known Subclasses:
  PrivateMLet

public class MLet
extends URLClassLoader
implements MLetMBean, MBeanRegistration, Externalizable

URL classloader capable of parsing an MLet text file adhering to the file format defined in the JMX specification (v1.0).

Version:
  $Revision: 1.26 $
Author:
  Juha Lindfors.
See Also:
  `MLetMBean`, Serialized Form

Constructor Summary
`MLet()`
`MLet(URL[] urls)`
`MLet(URL[] urls, boolean delegateToCLR)`
`MLet(URL[] urls, ClassLoader parent)`
`MLet(URL[] urls, ClassLoader parent, boolean delegateToCLR)`
`MLet(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)`
`MLet(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory, boolean delegateToCLR)`

Method Summary
`void` | `addURL(String url)` Adds the given URL to the MLet's classpath.
`void` | `addURL(URL url)` Adds the given URL to the MLet's classpath.
`protected URL` | `check(String version, URL codebase, String jarfile, javax.management.loading.MLetContent mlet)` This method is to be overridden when extending this service to support caching and versioning.
`protected Class` | `findClass(String name)`
`protected String` | `findLibrary(String libname)`
`String` | `getLibraryDirectory()`
`Set` | `getMBeansFromURL(String url)` Loads an MLET text file from a given url.
`Set` | `getMBeansFromURL(URL url)` Loads an MLET text file from a given url.
`URL[]` | `getURLs()` Returns the search path of URLs for loading classes and resources.
`protected Class` | `loadClass(String name, boolean resolve)`
`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()` This method is called by the MBeanServer after deregistration takes place.
`void` | `postRegister(Boolean registrationDone)` This method is called by the MBeanServer after registration takes place or when registration fails.
`void` | `preDeregister()` This method is called by the MBeanServer before deregistration takes place.
`ObjectName` | `preRegister(MBeanServer server, ObjectName name)` This method is called by the MBeanServer before registration takes place.
`void` | `readExternal(ObjectInput in)` This implementation does not support externalizing an MLet.
`void` | `setLibraryDirectory(String libdir)`
`void` | `writeExternal(ObjectOutput out)` This implementation does not support externalizing an MLet.

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

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

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, 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`

Constructor Detail

### MLet

    public MLet()

### MLet

    public MLet(URL[] urls)

### MLet

    public MLet(URL[] urls,
                ClassLoader parent)

### MLet

    public MLet(URL[] urls,
                ClassLoader parent,
                URLStreamHandlerFactory factory)

### MLet

    public MLet(URL[] urls,
                boolean delegateToCLR)

### MLet

    public MLet(URL[] urls,
                ClassLoader parent,
                boolean delegateToCLR)

### MLet

    public MLet(URL[] urls,
                ClassLoader parent,
                URLStreamHandlerFactory factory,
                boolean delegateToCLR)

Method Detail

### preRegister

    public ObjectName preRegister(MBeanServer server,
                                  ObjectName name)
                           throws Exception

  Description copied from interface: `MBeanRegistration`
  This method is called by the MBeanServer before registration takes place. The MBean is passed a reference of the MBeanServer it is about to be registered with. The MBean must return the ObjectName it will be registered with. The MBeanServer can pass a suggested object depending upon how the MBean is registered.

  The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

  Specified by:
    `preRegister` in interface `MBeanRegistration`
  Returns:
    the actual ObjectName to register this MBean with.
  Throws:
    `Exception` - for any error, the MBean is not registered.

### postRegister

    public void postRegister(Boolean registrationDone)

  Description copied from interface: `MBeanRegistration`
  This method is called by the MBeanServer after registration takes place or when registration fails.

  Specified by:
    `postRegister` in interface `MBeanRegistration`
  Parameters:
    `registrationDone` - the MBeanServer passes true when the MBean was registered, false otherwise.

### preDeregister

    public void preDeregister()
                       throws Exception

  Description copied from interface: `MBeanRegistration`
  This method is called by the MBeanServer before deregistration takes place.

  The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

  Specified by:
    `preDeregister` in interface `MBeanRegistration`
  Throws:
    `Exception`

### postDeregister

    public void postDeregister()

  Description copied from interface: `MBeanRegistration`
  This method is called by the MBeanServer after deregistration takes place.

  Specified by:
    `postDeregister` in interface `MBeanRegistration`

### getMBeansFromURL

    public Set getMBeansFromURL(String url)
                         throws ServiceNotFoundException

  Description copied from interface: `MLetMBean`
  Loads an MLET text file from a given url. The MLET text file is parsed and the declared MBeans will be registered to the MBean server.

  Specified by:
    `getMBeansFromURL` in interface `MLetMBean`
  Parameters:
    `url` - url to load the MLET text file from
  Returns:
    A set of `ObjectInstance` instances for each registered MBean. If there was an error registering the MBean, a `Throwable` instance is added to the returned collection.
  Throws:
    `ServiceNotFoundException` - if the given URL is malformed, or the given MLET text file cannot be found, or the given text file does not contain an <MLET> tag or one of the specified mandatory attributes (see the JMX specification for a list of mandatory attributes in an MLET text file).

### getMBeansFromURL

    public Set getMBeansFromURL(URL url)
                         throws ServiceNotFoundException

  Description copied from interface: `MLetMBean`
  Loads an MLET text file from a given url. The MLET text file is parsed and the declared MBeans will be registered to the MBean server.

  Specified by:
    `getMBeansFromURL` in interface `MLetMBean`
  Parameters:
    `url` - url to load the MLET text file from
  Returns:
    A set of `ObjectInstance` instances for each registered MBean. If there was an error registering the MBean, a `Throwable` instance is added to the returned collection.
  Throws:
    `ServiceNotFoundException` - if the given MLET text file cannot be found, or the given text file does not contain an <MLET> tag or one of the specified mandatory attributes (see the JMX specification for a list of mandatory attributes in an MLET text file).

### addURL

    public void addURL(URL url)

  Description copied from interface: `MLetMBean`
  Adds the given URL to the MLet's classpath.

  Specified by:
    `addURL` in interface `MLetMBean`

### addURL

    public void addURL(String url)
                throws ServiceNotFoundException

  Description copied from interface: `MLetMBean`
  Adds the given URL to the MLet's classpath.

  Specified by:
    `addURL` in interface `MLetMBean`
  Parameters:
    `url` - url
  Throws:
    `ServiceNotFoundException` - if the given URL is malformed

### getURLs

    public URL[] getURLs()

  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.

  Specified by:
    `getURLs` in interface `MLetMBean`
  Returns:

### getLibraryDirectory

    public String getLibraryDirectory()

  Specified by:
    `getLibraryDirectory` in interface `MLetMBean`

### setLibraryDirectory

    public void setLibraryDirectory(String libdir)

  Specified by:
    `setLibraryDirectory` in interface `MLetMBean`

### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException,
                             UnsupportedOperationException

  This implementation does not support externalizing an MLet.

  Specified by:
    `readExternal` in interface `Externalizable`
  Throws:
    `UnsupportedOperationException`
    `IOException`
    `ClassNotFoundException`

### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException,
                              UnsupportedOperationException

  This implementation does not support externalizing an MLet.

  Specified by:
    `writeExternal` in interface `Externalizable`
  Throws:
    `UnsupportedOperationException`
    `IOException`

### loadClass

    public Class loadClass(String name,
                           ClassLoaderRepository clr)
                    throws ClassNotFoundException

  Load a class, using the given ClassLoaderRepository if the class is not found in this MLet's URLs. The given ClassLoaderRepository can be null, in which case a ClassNotFoundException occurs immediately if the class is not found in this MLet's URLs.

  Parameters:
    `name` -
    `clr` -
  Returns:
  Throws:
    `ClassNotFoundException`

### check

    protected URL check(String version,
                        URL codebase,
                        String jarfile,
                        javax.management.loading.MLetContent mlet)
                 throws Exception

  This method is to be overridden when extending this service to support caching and versioning. It is called from getMBeansFromURL when the version, codebase, and jarfile have been extracted from the MLet file, and can be used to verify that it is all right to load the given MBean, or to replace the given URL with a different one. The default implementation of this method returns codebase unchanged.

  Parameters:
    `version` -
    `codebase` -
    `jarfile` -
    `mlet` -
  Returns:
  Throws:
    `Exception`

### loadClass

    protected Class loadClass(String name,
                              boolean resolve)
                       throws ClassNotFoundException

  Throws:
    `ClassNotFoundException`

### findClass

    protected Class findClass(String name)
                       throws ClassNotFoundException

  Throws:
    `ClassNotFoundException`

### findLibrary

    protected String findLibrary(String libname)

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

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.