Solaris WBEM Services Administrator's Guide

Chapter 4 MOF Compiler

This chapter describes the Managed Object Format (MOF) Compiler, including the following topics.

About the MOF Compiler

The Managed Object Format (MOF) Compiler parses a file containing MOF statements, converts the classes and instances defined in the file to Java classes, and adds the Java classes to the CIM Object Manager Repository, a central storage area for management data. The compiler loads the Java classes into the default namespace, root\cimv2, unless a #pragma namespace("namespace_path") statement appears in the MOF file.

The mofcomp command, which starts the MOF compiler, is executed before installation to compile MOF files that describe the CIM and Solaris Schemas. The CIM Schema is a collection of class definitions used to represent managed objects that occur in every management environment. The Solaris Schema is a collection of class definitions that extend the CIM Schema and represent managed objects in a typical Solaris operating environment.

MOF is a language for defining CIM classes and instances. MOF files are ASCII text files that use the MOF language to describe CIM objects. A CIM object is a computer representation or model of a managed resource, such as a printer, disk drive, or CPU.

Many sites store information about managed resources in MOF files. Because MOF can be converted to Java, Java applications that can run on any system with a Java Virtual Machine can interpret and exchange this information. You can also use the mofcomp command to compile MOF files at any time after installation.


Note -

If you recompile the CIM_Schema23.mof file or the Solaris_Schema1.0.mof file, you must change to become root user before compiling. For example:

% /usr/sadm/bin/mofcomp -v -u root -p [root-password] /usr/sadm/mof/Solaris_Schema1.0.mof


The mofcomp Command

The mofcomp command compiles the specified MOF file into CIM classes and instances that are stored in the CIM Object Manager Repository as Java classes and passed to the CIM Object Manager.

You must run the mofcomp command as root or as a user with write access to the namespace in which you are compiling.

/usr/sadm/bin/mofcomp [-help] [-v] [-sc] [-si] [-sq] [-version] [-c cimom_hostname ] [-u username] [-p password] file
-help

List the arguments to the mofcomp command.

-c cimom_hostname

Specify a system running the CIM Object Manager.

-p password

Specify a password for connecting to the CIM Object Manager. Use this option for compilations that require privileged access to the CIM Object Manager. If you specify both -p and -u, you must type the password on the command line, which can pose a security risk. A more secure way to specify a password is to specify -u but not -p, so that the compiler will prompt for the password.

-sc

Run the compiler with the set class option, which updates a class if it exists and contains no instances, and returns an error if the class does not exist. If you do not specify this option, the compiler adds a CIM class to the connected namespace, and returns an error if the class already exists.

-si

Run the compiler with the set instance option, which updates an instance if it exists, and returns an error if the instance does not exist. If you do not specify this option, the compiler adds a CIM instance to the connected namespace, and returns an error if the instance already exists.

-sq

Run the compiler with the set qualifier types option, which updates a qualifier type if it exists, and returns an error if the qualifier type does not exist. If you do not specify this option, the compiler adds a CIM qualifier type to the connected namespace, and returns an error if the qualifier type already exists.

-u username

Specify user name for connecting to the CIM Object Manager. Use this option for compilations that require privileged access to the CIM Object Manager. If you specify both -p and -u, you must type the password on the command line, which can pose a security risk. A more secure way to specify a password is to specify -u but not -p, so that the compiler will prompt for the password.

-v

Run the compiler in verbose mode, which displays compiler messages.

-version

Display the version of the MOF compiler.

The mofcomp command will exit with 0 upon success and a positive integer upon failure.

Compiling a MOF File

You can compile a MOF file with or without a .mof extension. The MOF files that describe the CIM and Solaris Schemas are located in /usr/sadm/mof.

How to Compile a MOF File
  1. To run the MOF Compiler with no options, type the following:

    # mofcomp filename

    For example,# mofcomp /usr/sadm/mof/Solaris_Application1.0.mof

    The MOF file is compiled into the CIM Object Manager Repository.

Security Advisory

If you run the mofcomp command with the -p option or -u and -p options, and you include a password on the command line, another user can run the ps command or the history command to see your password.


Note -

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


The following examples show unsafe (insecure) usage, running the mofcomp command with its -p option and then with its -up options:

% mofcomp -p Log8Rif

% mofcomp -up molly Log8Rif

You should change your password immediately after running the mofcomp command in this way.