Most components of the Java DMK product are MBeans and can therefore also be managed through local or remote proxies. Nearly all are standard MBeans, so their corresponding standard proxies are provided with the product. The Java source code for all component proxy classes can be found in the /legacy/JdmkProxyMBeans directory located in the main examplesDir (see “Directories and Classpath” in the Preface).
The HTML protocol adaptor is implemented as a dynamic MBean and therefore cannot have a standard proxy. You must use a generic proxy to access the HTML adaptor through a proxy object.
Of course, all other Java DMK MBean components can also be accessed through generic proxies, although their standard proxies provide more abstraction of the MBean server and a greater simplification of your application's code.
The proxy classes have been generated by the proxygen tool with full read-write access of all attributes. Refer to the chapter on the proxygen tool in the Java Dynamic Management Kit 5.1 Tools Reference Guide.
Like all other classes, proxies can contain a package statement. The package for a component proxy class depends upon the package of the component:
The proxy classes for Java DMK components in the javax.management package and its javax.management.* subpackages do not have a package statement.
Their class files can be located in any directory that can then be added to your application's classpath.
The proxy classes for all other components belong to the same class as the component itself. For example, the proxy classes for the RmiConnectorServer component are declared in the com.sun.jdmk.comm package.
Their class files are contained in the corresponding file hierarchy, whose root can be added to your application's classpath. Therefore, the class files of the RmiConnectorServerProxy are located in a directory called packageRoot/com/sun/jdmk/comm/.
To use the standard proxies for the product components, you must first compile them with the javac command and then place the classes you need in the classpath of your agent or management application. If you compile the proxy classes individually, be sure to compile the proxy's MBean interface before its corresponding proxy class.
Because of the package statement in proxy classes, use the following commands:
$ cd examplesDir/legacy/JdmkProxyMBeans/ $ javac -d packageRoot -classpath classpath *ProxyMBean.java *Proxy.java |
In this command, the classpath must contain the current directory and the classpath of the Java DMK runtime libraries (jdmkrt.jar and legacysnmp.jar). See “Directories and Classpath” in the Preface). The -d option of the javac compiler creates the necessary directories in the given packageRoot for each class's package. The packageRoot is usually the current directory (.) or you can specify a target directory in your application's classpath directly.