|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.ClassLoader | +--java.security.SecureClassLoader | +--java.net.URLClassLoader | +--javax.management.loading.MLet
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:
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:
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 @see javax.management.MBeanServerFactory#getClassLoaderRepository to load classes that could not be found in the loaded jar files.
Constructor Summary | |
---|---|
MLet()
Constructs a new MLet using the default delegation parent ClassLoader |
|
MLet(java.net.URL[] urls)
Constructs a new MLet for the specified URLs using the default delegation parent ClassLoader. |
|
MLet(java.net.URL[] urls,
java.lang.ClassLoader parent)
Constructs a new MLet for the given URLs. |
|
MLet(java.net.URL[] urls,
java.lang.ClassLoader parent,
java.net.URLStreamHandlerFactory factory)
Constructs a new MLet for the specified URLs, parent class loader, and URLStreamHandlerFactory. |
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 |
protected java.lang.Class |
findClass(java.lang.String name)
This is the main method for class loaders to load/find the class |
protected java.lang.String |
findLibrary(java.lang.String libraryName)
Returns the absolute path name of a native library. |
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,
ClassLoaderRepository repository)
Load a class using the given ClassLoaderRepository, iterating through the list of class loaders. |
void |
postDeregister()
Allows the m-let to perform any operations needed after having been de-registered in the MBean server |
void |
postRegister(java.lang.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 de-registered 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 |
setLibraryDirectory(java.lang.String libdir)
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, 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, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, 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 |
public MLet()
Constructs a new MLet using the default delegation parent ClassLoader
public MLet(java.net.URL[] urls)
Constructs a new MLet 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.
urls
- - the urls from which to load classes and resourcespublic MLet(java.net.URL[] urls, java.lang.ClassLoader parent)
Constructs a new MLet 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. The factory argument will be used as the stream handler factory to obtain protocol handlers when creating new URLs.
urls
- - the urls from which to load classes and resourcesparent
- - The parent class loader for delegation.public MLet(java.net.URL[] urls, java.lang.ClassLoader parent, java.net.URLStreamHandlerFactory factory)
Constructs a new MLet 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.
urls
- - the urls from which to load classes and resourcesparent
- - The parent class loader for delegation.factory
- - The URLStreamHandlerFactory to use when creating URLsMethod Detail |
public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception
Allows the m-let to perform any operations it needs before being registered in the MBean server. If the ObjectName is null, the m-let provides a default name for its registration :type=MLet
preRegister
in interface MBeanRegistration
server
- - the MBeanServer in which the MLet will be registered.name
- - the ObjectName of the MLet
java.lang.Exception
- - This exception should be caught by the MBean server and re-thrown as an MBeanRegistrationException.public void postRegister(java.lang.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.
postRegister
in interface MBeanRegistration
registrationDone
- - Indicates whether or not the m-let has been successfully registered in the MBean server. The value false means that either the registration phase has failed.public void preDeregister() throws java.lang.Exception
Allows the m-let to perform any operations it needs before being de-registered by the MBean server.
preDeregister
in interface MBeanRegistration
java.lang.Exception
- - This exception should be caught by the MBean server and re-thrown as an MBeanRegistrationExceptionpublic void postDeregister()
Allows the m-let to perform any operations needed after having been de-registered in the MBean server
postDeregister
in interface MBeanRegistration
public void addURL(java.lang.String url) throws ServiceNotFoundException
Appends the specified URL to the list of URLs to search for classes and resources.
addURL
in interface MLetMBean
url
- - the url represented as a string to add to the list of urls specified
-
- ServiceNotFoundException if the specified URL is malformed
ServiceNotFoundException
public void addURL(java.net.URL url)
Appends the specified URL to the list of URLs to search for classes and resources
addURL
in interface MLetMBean
addURL
in class java.net.URLClassLoader
url
- - the url as a URL to be added to the list of urls specifedpublic java.lang.Class loadClass(java.lang.String name, ClassLoaderRepository repository) throws java.lang.ClassNotFoundException
Load a class using the given ClassLoaderRepository, iterating through the list of class loaders. The given ClassLoaderRepository can be null, in which case it is equivalent to ClassLoader.loadClass(java.lang.String)
name
- - The name of the class we want to load.repository
- - The ClassLoaderRepository that will be used to search for the given class, if it is not found in this ClassLoader
-
- ClassNotFoundException if the specified class could not be found, neither in this ClassLoader nor in the given ClassLoaderRepository
java.lang.ClassNotFoundException
protected java.lang.Class findClass(java.lang.String name) throws java.lang.ClassNotFoundException
This is the main method for class loaders to load/find the class
findClass
in class java.net.URLClassLoader
name
- - the name of the class to load/find
java.lang.ClassNotFoundException
- - if the class was not foundpublic java.util.Set getMBeansFromURL(java.lang.String url) throws ServiceNotFoundException
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 MBean server.
getMBeansFromURL
in interface MLetMBean
url
- - The URL of the text Mlet file to be loaded as String object
ServiceNotFoundException
- - One of the following errors has occurred:
java.lang.IllegalStateException
- - MLet MBean is not registered with an MBeanServerpublic java.util.Set getMBeansFromURL(java.net.URL url) throws ServiceNotFoundException
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 MBean server
getMBeansFromURL
in interface MLetMBean
url
- - The URL of the file to loaded as a URL
java.lang.IllegalStateException
- - MLet MBean is not registered with an MBeanServer.
ServiceNotFoundException
protected java.lang.String findLibrary(java.lang.String libraryName)
Returns the absolute path name of a native library. The VM invokes this method to locate the native libraries that belong to classes loaded with this class loader. Libraries are searched in the JAR files using first just the native library name and if not found the native library name together with the architecture-specific path name (OSName/OSArch/OSVersion/lib/nativelibname), i.e.
the library stat on Solaris SPARC 5.7 will be searched in the JAR file as:
the library stat on Windows NT 4.0 will be searched in the JAR file as:
findLibrary
in class java.lang.ClassLoader
libraryName
- - the name of the library
public java.lang.String getLibraryDirectory()
Gets the current directory used by the library loader for storing native libraries before they are loaded into memory
getLibraryDirectory
in interface MLetMBean
public void setLibraryDirectory(java.lang.String libdir)
Sets the directory used by the library loader for storing native libraries before they are loaded into memory
setLibraryDirectory
in interface MLetMBean
libdir
- - the directory the library is stored in.
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |