JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris WBEM Developer's Guide
search filter icon
search icon

Document Information

Preface

1.  Overview of Solaris Web-Based Enterprise Management

2.  Using the CIM Object Manager

3.  Using the Sample Programs

4.  Writing a Client Program

5.  Writing WBEM Queries

6.  Writing a Provider Program

7.  Creating JavaBeans Components Using the MOF Compiler

About the MOF Compiler

Generating JavaBeans Components Using mofcomp

MOF File Elements

How CIM Maps to the Java Programming Language

Example of Generating JavaBeans Components

8.  Administering Security

9.  Troubleshooting

A.  Solaris Platform Schema

Index

About the MOF Compiler

Managed Object Format (MOF) is a compiled language developed by the Distributed Management Task Force (DMTF). The MOF language defines static and dynamic classes and instances for CIM and WBEM. You can use the CIM and Solaris platform MOF files that are included with Solaris WBEM Services. You can also create your own MOF files. For more information on creating your own MOF files using the DMTF's MOF language, see the DMTF Web site at http://www.dmtf.org.

The MOF Compiler, mofcomp(1M) performs the following tasks:

You can easily convert MOF files to the Java programming language. As a result, applications based on Java technology can interpret and exchange data in MOF files on any machine that runs a Java Virtual Machine.

During a Solaris OS installation, the MOF compiler compiles the bundled MOF files that describe the CIM and Solaris platform schema and adds those files to the CIM Object Manager Repository.

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, CIMBean.java, and a bean that implements that interface, CIMBeanImpl.java, are generated. CIMBeanImpl.java contains all of the code that is common to the generated beans. All generated Java interfaces extend from CIMBean.java. All generated beans extend from CIMBeanImpl.java, 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 CIMClassBean.java. Bean classes that implement those Java interfaces are named CIMClassBeanImpl.java. 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 CIMClass_MethodNameOutput.java. An instance of this CIMClass_MethodNameOutput.java 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:

PACKAGE=NameOfJavaPackage
IMPORTS=JavaClassName1:JavaClassName2:...
EXCEPTIONS=Exception1:Exception2:...

The following table describes these elements.

Table 7-1 MOF File Elements

Element
Description
PACKAGE
Required. Specifies the name of the Java package that contains the source files generated by the MOF compiler.
IMPORTS
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.
EXCEPTIONS
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.