Solaris WBEM Developer's Guide

Generating JavaBeans Components Using mofcomp

In the context of WBEM, JavaBeans components, or beans, define methods for accessing and manipulating CIM classes and data. To simplify your development efforts, you can use the -j option to the mofcomp command to generate beans from the CIM classes in your MOF files. These automatically-generated beans define the interfaces. You must add the implementation code.

Note –

To safeguard your program from changes that you make to the underlying JavaBeans implementation, use the interfaces rather than the original JavaBeans components.

When you specify the -j option with mofcomp, a Java interface,, and a bean that implements that interface,, are generated. CIMBeanImpl.javacontains all of the code that is common to the generated beans. All generated Java interfaces extend from All generated beans extend, and inherit the base implementation.

For each CIM class that is defined in a MOF file, the MOF compiler JavaBeans generation feature generates a Java programming language interface that contains the following methods:

The Java interfaces are named Bean classes that implement those Java interfaces are named In addition, accessor methods for properties that contain the CIM DisplayName, Units, and Version qualifiers are generated.

For each invokeMethod that contains an OUT qualified parameter in a CIM class, a container interface that holds the output that the invoking of the method generates is generated. These interfaces are named An instance of this container interface is required as the last parameter of the bean's method. This container interface is required because the object datatype or datatypes that the bean's method takes as parameters are not mutable. Therefore these data types cannot be used to hold both input and output data.

MOF File Elements

You must include the PACKAGE element in your MOF file to take advantage of the -j option. In addition, you can specify the IMPORTS and EXCEPTIONS elements in the following format:


The following table describes these elements.

Table 7–1 MOF File Elements




Required. Specifies the name of the Java package that contains the source files generated by the MOF compiler. 


Optional. Specifies the names of the Java classes to import into the generated source files. These classes are separated with a colon (:). You can specify as many Java classes as you want, on as many lines as you want. 


Optional. Specifies the names of the Java exceptions that are included in the generated source files. These exceptions are separated with a colon (:). You can specify as many Java class exceptions as you want, on as many lines as you want. 

Note –

If you specify EXCEPTIONS, you must specify IMPORTS.