Java Reference
In-Depth Information
Table 10.2
The methods declared by the MLetMBean interface
Declared method
Description
Appends the specified URL to the list of URLs to be
searched for classes and resources
addURL( String url )
Appends the specified URL to the list of URLs to be
searched for classes and resources
addURL( URL url )
Returns the directory in which native libraries are
stored before loading them into memory
getLibraryDirectory()
Tells the MBean to load an M-let file at the specified
URL
getMBeansFromURL( String url )
Tells the MBean to load an M-let file at the specified
URL
getMBeansFromURL( URL url )
Finds the specified resource
getResource( String name )
getResourceAsStream( String name ) Finds the specified resource and returns an Input-
Stream for reading it
Finds all the resources with the specified name
getResources( String name )
Returns the list of URLs being used to search for
classes and resources
getURLs()
setLibraryDirectory( String path ) Sets the native library directory
Adding URLs to the CLASSPATH
The MLetMBean interface declares two addURL() methods that add URL s to the
search list of URL s for finding classes and resources. These methods simply add
the specified URL to the internal list used by the MBean's class loader. These two
methods (each taking a different form of a URL ) add to the agent's codebase,
allowing it to find more classes. You can use these methods to make more classes
available to the agent.
Later, in the examples, we will demonstrate how you can use the URL list to
load MBean classes without using an M-let file.
Creating MBeans
The interface declares two getMBeansFromURL() methods for loading M-let files.
When the MBean loads an M-let file, it loads all the classes and resources con-
tained in the listed JAR files. Just like the addURL() methods, the createMBean()
method is overloaded to accept either a URL object or a String representation of
a URL .
Search WWH ::




Custom Search