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 |
where options includes:
Parses the MIB files without generating code.
Generates code in the specified target directory.
Generates code within the specified Java package.
Includes the DESCRIPTION clause of OBJECT-TYPE as comment in generated code.
(manager-only)
Generates code for the SNMP manager only, that is 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.
(MIB-CORE)
Does not use the default MIB-CORE definitions file provided with the 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).
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 simply used to resolve some definitions of the first MIB file.
Uses the specified prefix for naming generated classes.
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.
Uses the specified prefix to name the generic metadata classes. For example, the metadata class for group system will be named SystemprefixMeta. Default is no 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.
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:
The user MIB_CORE definitions file specified in the MIB files using the -mc mibgen option.
The user command line parameter specified using the -Dmibcore.file Java property.
The default MIB_CORE definitions file provided with 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 will look for the mib_core.txt file in currentDir/etc/mibgen.
When using generic metadata (-g option), backward compatibility is not ensured. Using the -g option has generic advantages (MBeans are accessed through the MBean server, and any kind of MBeans can be plugged in), but slightly reduces the overall performance.
SNMP MIB implementations generated using the mibgen compiler from Java DMK 4.2 can run and recompile on Java DMK 5.0 without modification.