Skip Navigation Links | |
Exit Print View | |
Oracle Solaris WBEM Developer's Guide Oracle Solaris 11 Express 11/10 |
1. Overview of Solaris Web-Based Enterprise Management
2. Using the CIM Object Manager
7. Creating JavaBeans Components Using the MOF Compiler
How CIM Maps to the Java Programming Language
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 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 dmtf.org.
The MOF Compiler, mofcomp(1M) performs the following tasks:
Parses MOF files
Converts the classes and instances to Java programming language classes
Adds the classes to the CIM Object Manager Repository in the default (root\cimv2) or other specified namespace
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 installation, the MOF compiler compiles the bundled MOF files that describe the CIM and Solaris Schema and adds those files to the CIM Object Manager Repository.
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.javacontains all of the code that is common to the generated beans. All generated Java interfaces extend from CIMBean.java. All generated beans extend fromCIMBeanImpl.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:
Accessor and mutator methods for the properties that are defined in the MOF file
Methods that are comparable to the invokeMethods that are defined in the MOF file
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.
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
|