Sun Microsystems
Products & Services
 
Support & Training
 
 

Previous Previous     Contents     Index     Next Next

3.5 Output of the proxygen Tool

For an MBean defined in the Java class BeanName, the proxygen tool generates the following.

  • A Java interface (BeanNameProxyMBean), which defines the methods of the MBean that are accessible to a Java manager

  • A Java proxy (BeanNameProxy), which implements the methods defined in the Java interface BeanNameProxyMBean

For example, when an MBean representing a Java class named Simple is compiled, the proxygen tool generates the source code for the following classes.

  • A Java interface named SimpleProxyMBean

  • A Java class named SimpleProxy, which implements the SimpleProxyMBean interface

3.6 Mapping Rules

The proxygen tool uses the Java Reflection API for analyzing an MBean and generating its associated proxy MBean. The proxygen tool parses an MBean using the JMX-specific design patterns. The mapping rules that proxygen uses for generating the proxy MBean are described in the following subsections.

3.6.1 Mapping of Attributes

The proxygen tool generates code only for exposed operations of the MBean itself. Each attribute of the MBean is present in the proxy MBean with the same accessor getter and setter methods. Therefore, if an attribute is read-only in the MBean, the property is read-only in the generated proxy MBean.

3.6.2 Mapping of Operations

In addition to the attribute accessors, the proxygen tool generates code only for exposed operations of the MBean itself.

3.6.3 Methods in the Proxy Interface

The proxy MBeans that the proxygen tool generates also contain methods that are not present in the MBean. These methods are defined in the Java interface com.sun.jdmk.Proxy. The proxy MBean that is generated implements this interface. These methods are public methods that do not follow the design patterns defined by the JavaBeans component model.

These methods provide additional functionality for proxy MBeans and the management applications that instantiate them. The purpose of these methods is twofold:

  • To make sure that the information provided by the proxy MBean is up-to-date. For example, methods are defined for binding and unbinding a proxy MBean from a remote MBean server.

  • To get the object name and class of the remote MBean represented by the proxy MBean.

3.7 Using the Generated Code

The proxygen tool generates Java source code that you can use for developing Java managers. To develop a Java manager with code generated by the proxygen tool, use the RemoteMBeanServer interface. By using this interface, you can develop Java managers without having to modify the code that the proxygen tool generates.

Nevertheless, if you want to define a specific view of an MBean, you can modify the code that the proxygen tool generates. To ensure that the modified code remains consistent with the MBean that it represents, modify only the proxy and not the interface.

Previous Previous     Contents     Index     Next Next