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.
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 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 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 specification below.
Each job consists of the following attributes:
Job Type
The job type specifies whether this job is executed
only once per code generation,
once per MIB module in the module set defined in steps two and three respectively, or
once per context generated by a specified selection template or whether it is executed for each MIB module.
File Name Generation Template
The file name generation template specifies a Velocity template that generates a file name. This file name is then appended to the input and output directories respectively to determine the file name that is subject to the code generation actually done by running the File Generation template.
File Generation
The File Generation Velocity template is the template that actually is responsible for generating the program code. It generates the content of the file(s) whose name(s) has been determined by the File Name Generation Template of this job.
Selection Template
The optional selection template will be executed when the job's type is . A selection template specified for any other job type will be ignored. A selection template has to produce an output text of the following format:
<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.
Input Directory (Optional)
The input directory can be the same as the output directory or may be left empty. If the input directory is set to an valid directory, files in that directory will be parsed for AgenPro tags of the following form:
//--AgentGen BEGIN=<class>[::<method>]
<any program code that is protected during a (re)generation>
//--AgentGen END
where <class> denotes the class the code belongs to and the optional parameter <method> denotes the method the enclosed program 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 preserved when an agent is regenerated. This is standard behavior with the AGENT++ and SNMP4J-Agent templates.
Output Directory
The output directory specifies the directory where the generated files should be written to. If the input directory is the same as the output directory, existing files will be overwritten without further notice. So backup your agent sources before you run AgenPro.
6.4.2 AGENT-CAPABILITIES Selection
If at least one of the loaded MIB modules contains an AGENT-CAPABILITIES statement, you may select the 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.
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:
To generate code for a MIB module, that module has to be added to the table on the right by selecting it and using the button.
To disable code generation for a MIB module, remove it from the right table by selecting it and then using the button.
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.