WBEMfor Solaris on Sun Developer's Guide

Chapter 3 MOF Compiler

This chapter describes the MOF Compiler and explains how to use it. The following topics are covered.

About the MOF Compiler

The MOF Compiler parses files created in Managed Object Format, converts files to Java classes, and stores the extracted classes and instances in the CIM Repository.

MOF Compiler Location

During installation, the MOF Compiler is provided in the SUNWwbmof package. After installation, the MOF Compiler is located in the following path: /opt/SUNWconn/wbem/bin/.

MOF Compiler Parameters

The mofcomp command uses the following command-line parameters.

Parameter 

Description 

-help

Causes a man page to display with information about the MOF compiler command and parameters 

-version

Causes the build version of the MOF Compiler to display 

-v or -verbose

Turns on verbose mode, which displays compiler messages as the file compiles 

-c cimom_host

Enables you to specify the name of a host computer that is running the CIM Object Manager 

-u

Enables you to specify a user name when you want to compile a file that is protected by user name and password authentication 

-p

Enables you to provide a password when you want to compile a file that is protected by user name and password authentication 

Syntax of the MOF Compiler

The MOF Compiler uses the following command syntax:

% mofcomp filename.mof

where mofcomp is the command to run the MOF Compiler and filename.mof is the name of a MOF file to be compiled.

Security Advisory for Using Passwords

If you run a command with the -p or the -up parameters, and you include a password, another user can run the ps command or the history command to find out your password.


Note -

If you run a command that requires you to provide your password, immediately change your password after running the command.



Example 3-1 Example of Unsafe Syntax

The following examples show use of the mofcomp command with the -p parameter:

mofcomp -p Log8Rif
and the -up parameters:
mofcomp -up molly Log8Rif

Change your password immediately after running the mofcomp command with the option to specify a password.


Compiling a MOF File

Using the MOF Compiler, you can compile all MOF files with or without a .mof extension. You can start the compiler in any directory where you want to compile a file. All MOF files that make up the CIM and Solaris Schemas are located in the path: /opt/SUNWconn/wbem/schema.

How to Compile a MOF File
  1. Change directories to the location of the MOF Compiler.

    % cd /opt/SUNWconn/wbem/bin/ 
    
  2. To run the MOF Compiler without parameters, type the following command:

    % mofcomp <filename>
    

    At the prompt, type the path and name of the MOF file that you want to compile.

    For example, type: /opt/SUNWconn/wbem/schema/Solaris_Schema1.0.mof

    The MOF file is compiled.

Example of MOF Output

The following example shows MOF output after compiling the file:


Example 3-2 Sample MOF Output

Initializing CIMValue
Parsing input file
Parsing input file
Parsed input file
MofcBackend:
NamespaceTable:
{}End of NamespaceTable
QualifierTypesTable:
{}End of QualifierTypesTable
Syntax Errors: 0
Semantic Errors: 0
Warnings: 0
End of MofcBackend