Java Dynamic Management Kit 3.2 Programming Guide | ||||
---|---|---|---|---|
![]() | ![]() | Chapter 6. C-Beans | ![]() | ![]() |
To start mogen, type the command for your operating environment:
In a Solaris operating environment:
prompt% installDir/SUNWconn/bin/mogen [options] class1 ... classN |
In a Windows NT operating environment:
C:\> "installDir\SUNWconn\jaw\bin\mogen" [options] class1 ... classN |
The mogen compiler displays progress messages during compilation.
The mogen tool can be invoked with the following options:
mogen [-d dir][-ro][-f][-i][-iall][-l className] [-li className][-nl][-nlmo][-nlas][-tp pkgName] [-np][-ne][-nc][-classpath path][-help] class1 ... classN |
-d dir
Specifies the destination directory for the generated code.
-ro
Generates a read-only c-bean stub. The interface generated is complete but an exception is returned by the c-bean when an attempt is made to set a property.
-f
Generates a flattened c-bean, in which all inherited methods and attributes are included. For more information, see Generating a Flattened C-Bean.
-l className
Limits the flattening of a c-bean. Methods and attributes in classes in the inheritance tree up to and including the Java class specified by className are included in the c-bean. The c-bean does not extend the c-bean class corresponding to the superclass of className. For more information, see Limiting the Flattening of a C-Bean.
-li className
Limits the flattening of a c-bean and preserves inheritance. Methods and attributes in classes in the inheritance tree up to and including the Java class specified by className are included in the c-bean. The c-bean extends the c-bean class corresponding to the superclass of className. For more information, see Limiting the Flattening of a C-Bean.
-i
Generates a c-bean stub that implements the interfaceMO that extends the interfaces implemented in the m-bean. For more information, see Generating C-Beans from M-Beans Implementing Interfaces.
-iall
Generates a c-bean stub that implements the interfaceMO that extends all of the interfaces in the inheritance tree up to and including the Java class specified. The -iall option must be associated with the -f, -l, or -li otherwise the output is identical to that using the -i option.
For more information, see Generating C-Beans from M-Beans Implementing Interfaces.
-nl
Specifies that no code is generated in the c-bean for listeners, even if the m-bean contains listeners. For more information, see Output From mogen for an M-Bean With Listeners and Events in Chapter 15.
-nlmo
Specifies that no code is generated in the c-bean for the listener's Java interface. For more information, see Output From mogen for an M-Bean With Listeners and Events in Chapter 15.
-nlas
Specifies that no code is generated in the c-bean for the listener stub. For more information, see Output From mogen for an M-Bean With Listeners and Events in Chapter 15.
-tp pkgName
Generates code in the Java package specified by pkgName.
-np
Specifies that no code for actions is generated in the c-bean. For more information, see Methods.
-ne
Specifies that no code is generated in the c-bean for events, even if the m-bean contains code for handling events. For more information, see Output From mogen for an M-Bean With Listeners and Events in Chapter 15.
-nc
Specifies that no code is generated in the c-bean for cascading. For more information, see Chapter 16.
-classpath path
Specifies the class path to be used for locating the classes to be compiled. By default mogen searches in the class path specified in the environment.
-help
Prints a usage message describing the options for mogen.
class1 ... classN
Specifies the list of m-bean classes to be compiled. For each class you must specify the full class name, including any package prefix. Do not specify the.class extension. The m-bean classes supplied to mogen must be in the form of compiled Java classes, not source files. Each class in the list must be located in one of the directories specifed in the current value of the CLASSPATH environment variable or in the path specified by the -classpath option.
The example below shows how to generate the managed object for the Simple class which is provided as an example with the Java Dynamic Management Kit. You must first call the Java compiler on the source code to obtain its .class file before using mogen to generate the managed object. Finally, you must compile the Java code generated by mogen.
The source code for the Simpleclass is contained in the installDir/SUNWconn/jaw/examples/mo/Simple directory, where installDir is the directory under which the Java Dynamic Management Kit was installed.
Note - On the Solaris platform, the installDir file hierarchy is not writable by default. In this case, you will first have to copy the Simple.java file to a directory where you have write permissions.
prompt% javac Simple.java prompt% mogen -classpath . Simple Destination directory set to ./. Starting compilation of Simple. Starting to generate stub SimpleMOStub.java for class Simple Starting to generate MO interface SimpleMO.java for class Simple prompt% javac SimpleMO.java SimpleMOStub.java |
![]() | ![]() | ![]() |
Overview of the mogen Compiler | ![]() | Output of the mogen Compiler |