Java Dynamic Management Kit 3.2 Programming Guide | ||||
---|---|---|---|---|
![]() | ![]() | Chapter 2. Tutorial Example | ![]() |
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.
In a Solaris operating environment:
prompt% installDir/SUNWconn/jaw/bin/mogen SimpleBean |
In a Windows NT operating environment:
C:\> "installDir\SUNWconn\jaw\bin\mogen" SimpleBean |
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; } |
![]() | ![]() | ![]() |
Developing an Agent | ![]() | Developing a Manager |