6.4   Project Wizard

With the Project Wizard you specify the Velocity templates that should be used for the code generation and the MIB modules that should be accessible to those templates.

The wizard is divided into three steps which are described by the following sections.

6.4.1   Job Configuration

Tip: In order to be able to merge existing code, make sure that the input directories (and file name templates respectively) are provided and point to (copies of) the existing source code.

The Job Configuration specifies the generation jobs to be processed for this project. If the "Do not merge with existing code" option is selected, any given input directory (see below) will be ignored and existing code will not be preserved.

Environment variables of the operating system can be used within the path strings too. Environment variables may be included in a path string by using the following format: ${<VARIABLE_NAME>}, whereas <VARIABLE_NAME> must contain letters, digits and the underscore ('_') character only.

With the Root Directories panel, you can specify root directories for relative template paths and input/ouput directories. You may leave these two root directories empty, if you intend to use only absolute paths in the Job specification below.

Each job consists of the following attributes:

<context1>:
[<Module1>=]<object1>[,[<ModuleN>=]<objectN>..];
<...>

where ModuleN is the module name of the MIB specification defining the MIB object with name objectNameN. There must be generated at least one context per selection template which has to contain at least one object name. Specifying a MIB module name for an object name is optional but recommended since it prevents incorrect mappings when a project's MIB modules do not have unique object names.
For each context generated by a selection template, an output file will be generated and the code generation job will be executed with the contexts described in the section “Customizing Code Generation” on page 32 for the job type 3. The contexts scalars, tables, traps, etc. will be filled with the selected objects for the respective context name as generated by the selection template.

//--AgentGen BEGIN=<class>[::<method>]
<any program code that is protected during a (re)gen­eration>
//--AgentGen END

where <class> denotes the class the code belongs to and the optional parameter <method> denotes the method the enclosed pro­gram code. In addition to this, the standard templates for AGENT++ are using some special "class" names, for example _INCLUDE and _END to identify code at the beginning and the end of a source file.

The program code protected by the above tags is then available to the generation template when it generates new code from a probably revised MIB module definition. Thus, the protected code may be pre­served when an agent is regenerated. This is standard behavior with the AGENT++ and SNMP4J-Agent templates.

6.4.2   AGENT-CAPABILITIES Selection

If at least one of the loaded MIB modules contains an AGENT-CAPABILITIES statement, you may select the „Use AGENT-CAPABILITIES Statement“ check box. Step two will then replace step three of the wizard.

Note: Only leafs in the displayed tree of available AGENT-CAPABILITIES statements can be selected, because folders (other than the root node) represent the MIB modules defining the AGENT-CAPABILITIES under them.

Instead of selecting the MIB modules with step three, using an AGENT-CAPABILITIES statement has the advantage, that you can specify the objects to be generated on the object level rather than on the module level. In addition, AGENT-CAPABILITIES can provide in depth documentation of an agent implementation.

6.4.3   MIB Module Selection

If you have not specified an AGENT-CAPABILITIES statement in step two, step three allows you to select a subset of the currently loaded MIB modules to be used for the code generation or to use all MIB modules available from the MIB repository at the time of code generation. If you want to select specific MIB modules deselect the checkbox at the top of the dialog and follow the steps below:

If a MIB module is selected for code generation, then it is a member of the current project.

MIB modules that are members of the current project are displayed with bold text in the open MIB modules list left to the MIB tree. By using the list‘s context menu, the membership of a particular MIB module in the current project can be changed.