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:
<MLET
CODE =
class | OBJECT =
serfile
ARCHIVE = "
archiveList"
[CODEBASE =
codebaseURL]
[NAME =
mbeanname]
[VERSION =
version]
>
[
arglist]
</MLET
>
where:
CODE =
class.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.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"
.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:
.jar
files in archivelist must be stored in the directory specified by the code base URL.
CODEBASE =
codebaseURL.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 =
mbeannamegetDefaultDomain()
.
VERSION =
version.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.
ARG TYPE=
argumentType VALUE=
value>
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
).
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 getClassLoaderRepository(javax.management.MBeanServer)
to load classes that could not be found in the loaded jar files.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new MLet using the default delegation parent ClassLoader.
| |||||||||||
Constructs a new MLet for the specified URLs using the default
delegation parent ClassLoader.
| |||||||||||
Constructs a new MLet for the given URLs.
| |||||||||||
Constructs a new MLet for the specified URLs, parent class
loader, and URLStreamHandlerFactory.
| |||||||||||
Constructs a new MLet for the specified URLs using the default
delegation parent ClassLoader.
| |||||||||||
Constructs a new MLet for the given URLs.
| |||||||||||
Constructs a new MLet for the specified URLs, parent class
loader, and URLStreamHandlerFactory.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Appends the specified URL to the list of URLs to search for classes and
resources.
| |||||||||||
Appends the specified URL to the list of URLs to search for classes and
resources.
| |||||||||||
Gets the current directory used by the library loader for
storing native libraries before they are loaded into memory.
| |||||||||||
Loads a text file containing MLET tags that define the MBeans to
be added to the MBean server.
| |||||||||||
Loads a text file containing MLET tags that define the MBeans to
be added to the MBean server.
| |||||||||||
Returns the search path of URLs for loading classes and resources.
| |||||||||||
Load a class, using the given | |||||||||||
Allows the m-let to perform any operations needed after having been
unregistered in the MBean server.
| |||||||||||
Allows the m-let to perform any operations needed after having been
registered in the MBean server or after the registration has failed.
| |||||||||||
Allows the m-let to perform any operations it needs before being unregistered
by the MBean server.
| |||||||||||
Allows the m-let to perform any operations it needs before
being registered in the MBean server.
| |||||||||||
Restore this MLet's contents from the given | |||||||||||
Sets the directory used by the library loader for storing
native libraries before they are loaded into memory.
| |||||||||||
Save this MLet's contents to the given |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is to be overridden when extending this service to support caching and versioning. | |||||||||||
This is the main method for class loaders that is being redefined.
| |||||||||||
Returns the absolute path name of a native library.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Constructs a new MLet using the default delegation parent ClassLoader.
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 resources. |
---|
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.
urls | The URLs from which to load classes and resources. |
---|---|
parent | The parent class loader for delegation. |
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 resources. |
---|---|
parent | The parent class loader for delegation. |
factory | The URLStreamHandlerFactory to use when creating 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 resources. |
---|---|
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 ClassLoaderRepository .
|
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.
urls | The URLs from which to load classes and resources. |
---|---|
parent | The parent class loader for delegation. |
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 ClassLoaderRepository .
|
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 resources. |
---|---|
parent | The parent class loader for delegation. |
factory | The URLStreamHandlerFactory to use when creating URLs. |
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 ClassLoaderRepository .
|
Appends the specified URL to the list of URLs to search for classes and resources.
url | the URL to add. |
---|
ServiceNotFoundException | The specified URL is malformed. |
---|
Appends the specified URL to the list of URLs to search for classes and resources.
url | the URL to be added to the search path of URLs |
---|
Gets the current directory used by the library loader for storing native libraries before they are loaded into memory.
UnsupportedOperationException | if this implementation does not support storing native libraries in this way. |
---|
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 MBeans specified in the MLET file will be instantiated and registered in the MBean server.
url | The URL of the text file to be loaded as URL object. |
---|
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. |
---|---|
IllegalStateException | MLet MBean is not registered with an MBeanServer. |
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 MBeans specified in the MLET file will be instantiated and registered in the MBean server.
url | The URL of the text file to be loaded as String object. |
---|
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 url is malformed. |
---|---|
IllegalStateException | MLet MBean is not registered with an MBeanServer. |
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.
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.
name | The name of the class we want to load. |
---|---|
clr | The ClassLoaderRepository that will be used to search for the given class, if it is not found in this ClassLoader. May be null. |
ClassNotFoundException | The specified class could not be found in this ClassLoader nor in the given ClassLoaderRepository. |
---|
Allows the m-let to perform any operations needed after having been unregistered in the MBean server.
Allows the m-let to perform any operations needed after having been registered in the MBean server or after the registration has failed.
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. |
---|
Allows the m-let to perform any operations it needs before being unregistered by the MBean server.
This exception should be caught by the MBean server and re-thrown as an MBeanRegistrationException. | |
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 <defaultDomain>:type=MLet
server | The MBean server in which the m-let will be registered. |
---|---|
name | The object name of the m-let. |
Exception | This exception should be caught by the MBean server and re-thrown as an MBeanRegistrationException. |
---|
Restore this MLet's contents from the given ObjectInput
.
Not all implementations support this method. Those that do not
throw UnsupportedOperationException
. A subclass may
override this method to support it or to change the format of
the read data.
The format of the read data is not specified, but if an
implementation supports readExternal(ObjectInput)
it must also
support writeExternal(ObjectOutput)
in such a way that what is
written by the latter can be read by the former.
in | The object input stream to read from. |
---|
IOException | if a problem occurred while reading. |
---|---|
ClassNotFoundException | if the class for the object being restored cannot be found. |
UnsupportedOperationException | if this implementation does not support this operation. |
Sets the directory used by the library loader for storing native libraries before they are loaded into memory.
libdir | The directory used by the library loader. |
---|
UnsupportedOperationException | if this implementation does not support storing native libraries in this way. |
---|
Save this MLet's contents to the given ObjectOutput
.
Not all implementations support this method. Those that do not
throw UnsupportedOperationException
. A subclass may
override this method to support it or to change the format of
the written data.
The format of the written data is not specified, but if
an implementation supports writeExternal(ObjectOutput)
it must
also support readExternal(ObjectInput)
in such a way that what is
written by the former can be read by the latter.
out | The object output stream to write to. |
---|
IOException | If a problem occurred while writing. |
---|---|
UnsupportedOperationException | If this implementation does not support this operation. |
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.
version | The version number of the .jar
file stored locally. |
---|---|
codebase | The base URL of the remote .jar file. |
jarfile | The name of the .jar file to be loaded. |
mlet | The MLetContent instance that
represents the MLET tag. |
Exception | if the MBean is not to be loaded for some
reason. The exception will be added to the set returned by
getMBeansFromURL .
|
---|
This is the main method for class loaders that is being redefined.
name | The name of the class. |
---|
ClassNotFoundException | The specified class could not be found. |
---|
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:
More specifically, let nativelibname
be the result of
System.mapLibraryName
(libname)
. Then the following names are
searched in the JAR files, in order:
nativelibname
<os.name>/<os.arch>/<os.version>/lib/
nativelibname
where <X>
means System.getProperty(X)
with any
spaces in the result removed, and /
stands for the
file separator character (separator
).
If this method returns null
, i.e. the libraries
were not found in any of the JAR files loaded with this class
loader, the VM searches the library along the path specified
as the java.library.path
property.
libname | The library name. |
---|