Java Dynamic Management Kit 5.1 Tools Reference Guide

1.3 mibgen Options

To invoke the java.com.sun.jdmk.tools.MibGen class, you need to invoke java.com.sun.jdmk.tools.MibGen options mib files.


mibgen options mib files

The options are listed below.

-n

Parses the MIB files without generating code.

-d dir

Generates code in the specified target directory.

-tp pkgName

Generates code within the specified Java package (target package).

-desc

Includes the DESCRIPTION clause of OBJECT-TYPE as comment in generated code.

-mo

(manager-only)

Generates code for the SNMP manager only, namely the metadata file for the MIB variables (SnmpOidTable file). By default, the mibgen compiler generates code for both SNMP agents and managers. By selecting the -mo option, you enable the mibgen compiler to generate code for only the manager and not for agents. The -mo option is incompatible with the -n option.

-mc

(MIB-CORE)

Does not use the default MIB-CORE definitions file provided with Java DMK. In this case, the user must specify the MIB-CORE definitions file as one of the MIB files. For example, java.com.sun.jdmk.tools.MibGen -mc mib my_mib_core.

-a

Generates code for all the MIB files. Without this option, the Java code is generated only for the first MIB file. In this case, the following MIB files are used to resolve some definitions of the first MIB file.

-p prefix

Uses the specified prefix for naming generated classes.

-g

Generates a generic version of the metadata that will access the MBeans through the MBean server instead of using a direct reference. This enables you to plug in dynamic MBeans, instead of the generated standard MBean skeletons.

-gp prefix

Uses the specified prefix to name the generic metadata classes. For example, the metadata class for group System will be named SystemprefixMeta. The default is no prefix.

-sp prefix

Uses the specified prefix to name the standard metadata classes. For example: the metadata class for group system will be named SystemprefixMeta. Default is no prefix.

-help

Prints a usage message explaining how to invoke the compiler, as follows:

<mib files>: By default mibgen generates code only for the modules specified in the first file. The other files are only used for closure analysis except when the -a is specified.

The order followed by the mibgen compiler to find the MIB_CORE definitions file is as follows:

  1. The user MIB_CORE definitions file specified in the MIB files using the -mc mibgen option.

  2. The command line parameter specified using the -Dmibcore.file Java property.

  3. The default MIB_CORE definitions file provided with the Java DMK in installDir/etc/mibgen (mib_core.txt). To succeed, you must be able to derive the installation directory from the CLASSPATH environment variable. Otherwise, the mibgen compiler looks for the mib_core.txt file in currentDir/etc/mibgen.

  4. When using generic metadata (-g option), backward compatibility is not ensured. Using the -g option has generic advantages, whereby MBeans are accessed through the MBean server, any kind of MBeans can be plugged in, but this option slightly reduces the overall performance.


Note –

SNMP MIB implementations generated using the mibgen compiler from Java DMK 5.0 can run and recompile on Java DMK 5.1 without modification.


1.3.1 Advanced mibgen Options

Advanced mibgen options are specified with a -X prefix, as shown in the following list.


mibgen -X:advanced options mib files

-X:advanced options includes the following options.

-X:define

Defines a valid mibgen property in the form name=value

-X:use-display-hint[:on|:off]

Uses DISPLAY-HINT.

When on, this option instructs mibgen to generate an attribute of type String for any object using a textual convention whose DISPLAY-HINT is 255a [com.sun.jdmk.tools.mibgen.options .use.display.hint=true]

-X:abstract-mib[:on|:off]

Generate abstract MIB.

When on, this option instructs mibgen to generate an abstract MIB. The MIB class is an abstract class when the MBean factory methods are abstract. [com.sun.jdmk.tools.mibgen.options .mib.factory.abstract=true]

-X:no-table-access[:on|:off]

No table accessor.

When on, this option instructs mibgen not to generate any table accessors in the group of MBean interfaces. [com.sun.jdmk.tools.mibgen.options .mbean.table.accessor=false].

-X:use-unsigned-long[:on|:off]

Handles unsigned long values.

-X:target:5.0

Generates MIBs compatible with the Java DMK 5.0 implementation of SNMP.

-X:help

Print this help message.