Java Dynamic Management Kit 3.2 Programming Guide
[ Previous ][ Fast Back ]Chapter 2. Tutorial Example [ Next ]

Generating a C-Bean

A c-bean is a representation of an m-bean to a Java manager. The mogen tool provided with the Java Dynamic Management Kit enables a c-bean to be generated automatically from an m-bean.

The Java class definition of a simple m-bean is shown in Example 2-1. Use mogen to generate a c-bean from the SimpleBean.class m-bean. The m-bean class input to mogen must be in the form of a compiled Java class, not a source file. The c-bean that mogen generates is in the form of Java source code, which you have to compile.

Procedure To Generate the Example C-Bean

The SimpleBeanMO interface that mogen generates when compiling this simple m-bean is shown in Example 2-6. In addition, mogen generates the file SimpleBeanMOStub.java containing an implementation of the SimpleBeanMO interface.

Example 2-6. Simple C-Bean (SimpleBeanMO.java)
import com.sun.jaw.reference.client.mo.*;
import com.sun.jaw.reference.common.*;
import java.lang.*;
import java.lang.reflect.*;


/**
 * Generated by the mogen compiler version:
 *     Generator.java 3.2 10/29/98 SMI
 *
 * @see com.sun.jaw.tools.MoGen 
 */
public interface SimpleBeanMO extends ManagedObject {

  public Integer getNbChanges()
    throws InstanceNotFoundException, PropertyNotFoundException,
      InvocationTargetException;

  public String getState()
    throws InstanceNotFoundException, PropertyNotFoundException,
      InvocationTargetException;

  public  void setState(String value)
    throws InstanceNotFoundException, IllegalAccessException,
      PropertyNotFoundException, InvalidPropertyValueException,
      ClassNotFoundException, InstantiationException,
      InvocationTargetException;

  public  void SetState(String oper, String value)
    throws InstanceNotFoundException, IllegalAccessException,
      PropertyNotFoundException, InvalidPropertyValueException,
      ClassNotFoundException, InstantiationException,
      InvocationTargetException;

  public void performReset()
    throws InstanceNotFoundException, NoSuchMethodException,
      InvocationTargetException, IllegalAccessException;


}

Procedure To Compile the Example C-Bean


[ Previous ][ Home ][ Next ]
Developing an Agent[ Up ]Developing a Manager