|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | 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:
<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 = mbeannamegetDomain() method of the Framework class to
obtain this information.
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
MBeanServerFactory.getClassLoaderRepository(javax.management.MBeanServer)
to load classes that could not be found in the loaded jar files.
| Inner classes inherited from class java.lang.ClassLoader |
java.lang.ClassLoader.NativeLibrary |
| Field Summary | |
(package private) java.util.Vector |
mletList
|
(package private) MBeanServer |
server
|
(package private) boolean |
useDefaultLoader
|
| Fields inherited from class java.lang.ClassLoader |
nocerts |
| 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,
boolean delegateToCLR)
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,
boolean delegateToCLR)
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. |
|
MLet(java.net.URL[] urls,
java.lang.ClassLoader parent,
java.net.URLStreamHandlerFactory factory,
boolean delegateToCLR)
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.net.URL |
check(java.lang.String version,
java.net.URL codebase,
java.lang.String jarfile,
MLetContent mlet)
This method is to be overridden when extending this service to support caching and versioning. |
protected java.lang.Class |
findClass(java.lang.String name)
This is the main method for class loaders that is being redefined. |
(package private) java.lang.Class |
findClass(java.lang.String name,
ClassLoaderRepository clr)
|
(package private) java.lang.Class |
findClassInMLet(java.lang.String name)
|
protected java.lang.String |
findLibrary(java.lang.String libname)
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.net.URL[] |
getURLs()
Returns the search path of URLs for loading classes and resources. |
java.lang.Class |
loadClass(java.lang.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 de-registered in the MBeanServer. |
void |
postRegister(java.lang.Boolean registrationDone)
Allows the m-let to perform any operations needed after having been registered in the MBeanServer or after the registration has failed. |
void |
preDeregister()
Allows the m-let to perform any operations it needs before being de-registered by the MBeanServer. |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Allows the m-let to perform any operations it needs before being registered in the MBeanServer. |
void |
readExternal(java.io.ObjectInput in)
Restore this MLet's contents from the given ObjectInput. |
void |
setLibraryDirectory(java.lang.String libDir)
Sets the directory used by the library loader for storing native libraries before they are loaded into memory. |
(package private) void |
setUseDefaultLoader(boolean flag)
|
void |
writeExternal(java.io.ObjectOutput out)
Save this MLet's contents to the given ObjectOutput. |
| Methods inherited from class java.net.URLClassLoader |
definePackage,
findResource,
findResources,
getPermissions,
newInstance,
newInstance |
| Methods inherited from class java.security.SecureClassLoader |
|
| Methods inherited from class java.lang.ClassLoader |
addClass,
defineClass,
defineClass,
defineClass,
definePackage,
findLoadedClass,
findNative,
findSystemClass,
getBootstrapClassPath,
getCallerClassLoader,
getGetClassLoaderPerm,
getPackage,
getPackages,
getParent,
getResource,
getResourceAsStream,
getResources,
getSystemClassLoader,
getSystemResource,
getSystemResourceAsStream,
getSystemResources,
isAncestor,
loadClass,
loadClass,
loadLibrary,
resolveClass,
setSigners |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
java.util.Vector mletList
MBeanServer server
boolean useDefaultLoader
| Constructor Detail |
public MLet()
public MLet(java.net.URL[] urls)
urls - the URLs from which to load classes and resources
public MLet(java.net.URL[] urls,
boolean delegateToCLR)
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.
public MLet(java.net.URL[] urls,
java.lang.ClassLoader parent)
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,
boolean delegateToCLR)
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.
public MLet(java.net.URL[] urls,
java.lang.ClassLoader parent,
java.net.URLStreamHandlerFactory factory)
urls - - the URLs from which to load classes and resourcesparent - - the parent class loader for delegationfactory - - the URLStreamHandlerFactory to use when creating URLs
public MLet(java.net.URL[] urls,
java.lang.ClassLoader parent,
java.net.URLStreamHandlerFactory factory,
boolean delegateToCLR)
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.| Method Detail |
public void addURL(java.lang.String url)
throws ServiceNotFoundException
url - The url from which to load the MBeans in a string format.public void addURL(java.net.URL url)
url - The url from which to load the MBeans in a string format.
protected java.lang.Class findClass(java.lang.String name)
throws java.lang.ClassNotFoundException
name - The name of the class.void setUseDefaultLoader(boolean flag)
java.lang.Class findClassInMLet(java.lang.String name)
throws java.lang.ClassNotFoundException
java.lang.Class findClass(java.lang.String name,
ClassLoaderRepository clr)
throws java.lang.ClassNotFoundException
protected java.net.URL check(java.lang.String version,
java.net.URL codebase,
java.lang.String jarfile,
MLetContent mlet)
throws java.lang.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.
This 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.getMBeansFromURL.protected java.lang.String findLibrary(java.lang.String libname)
the library stat on Solaris SPARC 5.7 will be searched in the JAR file as:
libname - the library name.public java.lang.String getLibraryDirectory()
public void setLibraryDirectory(java.lang.String libDir)
libDir - The directory used by the library loader.
public java.lang.Class loadClass(java.lang.String name,
ClassLoaderRepository clr)
throws java.lang.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.
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.
public java.util.Set getMBeansFromURL(java.lang.String url)
throws ServiceNotFoundException
url - - The URL of the text file to be loaded as String object.MLetMBean.getMBeansFromURL(String)
public java.util.Set getMBeansFromURL(java.net.URL url)
throws ServiceNotFoundException
url - - The URL of the text file to be loaded as URL object.MLetMBean.getMBeansFromURL(URL)public java.net.URL[] getURLs()
MLetMBean.getURLs()
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws java.lang.Exception
server - - The MBeanServer in which the m-let will be registered.name - - The object name of the m-let.MBeanRegistration.preRegister(MBeanServer, ObjectName)public void postRegister(java.lang.Boolean registrationDone)
registrationDone - - Indicates whether or not the m-let has been
successfully registered in the MBeanServer. The value false means that
either the registration phase has failed.MBeanRegistration.postRegister(Boolean)
public void preDeregister()
throws java.lang.Exception
MBeanRegistration.preDeregister()public void postDeregister()
MBeanRegistration.postDeregister()
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.UnsupportedOperationException
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(java.io.ObjectInput) it must also
support writeExternal(java.io.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.
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException,
java.lang.UnsupportedOperationException
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(java.io.ObjectOutput) it must
also support readExternal(java.io.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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||