M-Let Service Class Loader
The management applet or m-let service enables an agent to obtain m-beans from a remote .jar file. The agent does this by loading an m-let text file, which specifies information on the m-beans to be obtained. The information on each m-bean 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. When an m-let text file is loaded, an instance of each m-bean specified in the file is created. Bootstrap Service Class Loader
The bootstrap service simplifies the distribution of new releases of an application (namely an agent or a manager) from a central server. It is a standalone Java program that enables you to load an application from a remote .jar file. To obtain a new version of an application, all you have to do is run the bootstrap service on the system that requires the application to be loaded and run. Information on the application is contained in an m-let text file. You specify the URL of the m-let text file when you run the bootstrap service. Loader Repository
All Java Dynamic Management Kit class loaders running in the same Java virtual machine register with the loader repository. When an agent tries to load a class where no class loader has been specified, the agent looks in the framework's class loader, the system (using the class path) if no class loader is defined for the framework and finally in the loader repository. The loader repository contains pointers to all of the class loaders that have registered.
FIGURE 11-1 Operation of the Class Loaders
Instantiating a Remote M-Bean Using a Specific Class Loader
The Java Dynamic Management Kit allows an agent to contain several instances of a class loader, provided that every instance is registered with the repository. This enables, for example, each class loader to be connected to a different remote server. Therefore, by using a specific class loader, an application is able to specify the remote server to be used for loading a particular class. In this way, the application can load classes from a number of different servers.
The Java Dynamic Management Kit allows an agent to load only dynamic native libraries (.dll for Windows, .so for Solaris). An agent is not allowed to load static native libraries.
Including Native Code in an M-Bean
To enable an m-bean to use a native library, include in the m-bean a call to the static loadLibrary method of the LibLoader class (instead of System.loadLibrary). The caller must include a reference to its Java class when it invokes the loadLibrary method. Such information is used by the framework for identifying the class loader that loads the class. CODE EXAMPLE 11-1 shows the signature for the LibLoader.loadLibrary method.
| CODE EXAMPLE 11-1 Signature for the Libloader.loadLibrary method |
CODE EXAMPLE 11-2 shows the code to include in an m-bean to use the library loader service of the Java Dynamic Management Kit.
| CODE EXAMPLE 11-2 Including Native Code in an M-Bean |
Location of Native Libraries
The call to the static loadLibrary method of the LibLoader class also contains information on the location of the native library. This location depends on the operating system and architecture of the machine on which the library will run. The architecture-dependent location relative to the library base path is:
|
OSName/OSArch/OSVersion/lib/libraryName
|
The variable parts of this location are:
|
Solaris/sparc/2.x/lib/libstat.so
|
The stat native library for the Windows NT 4.0 operating system for an x86 processor would be:
|
WindowsNT/x86/4.0/lib/stat.dll
|
Security Manager
The Java Dynamic Management Kit provides an implementation of a security manager which allows the loading of native libraries coming from classes loaded over the network. The implementation is under com.sun.jaw.impl.agent.services.security.AgentSecurityManager.
Code Signing
The Java Dynamic Management Kit supports code signing using the javakey utility of the Java Development Kit (JDK). For further information, see the JDK product documentation.
|
import sun.security.provider.SystemSigner; import sun.security.provider.SystemIdentity; |