Java Dynamic Management Kit 3.2 Programming Guide
[ Previous ][ Fast Back ]Chapter 6. C-Beans[ Fast Forward ][ Next ]

Using the Generated Code

The mogen compiler generates Java source code that you use for developing Java managers. To develop a Java manager by using code generated by mogen, you use the AdaptorMO interface. For more information on the AdaptorMO interface, refer to Chapter 7. Using the AdaptorMO interface enables you to develop Java managers without having to modify the code that mogen generates. However, you can modify the code that mogen generates if you want to define a specific view of an m-bean.

The mogen compiler generates Java source code, not compiled Java classes. For your c-beans to be accessible to a Java manager, you have to compile the files that mogen generates, and make sure that the compiled Java classes are stored at a location specified in the CLASSPATH environment variable of the manager.

Developing Applications With Code From mogen

The applications you develop with the generated code are based on the Java interface that mogen generates. The stubs that mogen generates implement the methods defined in this interface. Options of the mogen compiler enable you to modify the characteristics of the stubs you generate from an m-bean for the same interface. For example, options are available that enable you to generate read-only or read-write stubs.

By generating from the same m-bean a set of stubs with different characteristics, you can develop a Java manager whose behavior is modified at runtime, depending on which stubs are loaded by the AdaptorMO. For example, you could develop an m-bean browser that behaves differently depending on whether the read-only or read-write stubs are loaded. When the read-only stubs are loaded, the m-bean browser will not be able to modify properties in the m-bean.

Modifying the Code Generated by mogen

If you want to define a specific view of an m-bean, you can modify the generated code. To ensure that the modified code remains consistent with the m-bean it represents, do not modify the interface; modify only the stub.


[ Previous ][ Home ][ Next ]
Output of the mogen Compiler[ Up ]Adaptor Clients