This page describes how-to generate Java code for SNMP4J-Agent with AgenPro

Generate Java Code

Prerequisites

  1. You have the MIB specifications you want to generate code for (if not see Create MIB Specification with MIB Designer)

  2. You have compiled and loaded those MIB module(s) (if not see Simulate MIB modules in AgenPro)

How-To Generate the Code

  1. Create or edit a code generation project with Project->Edit:

    You can skip this, if you did Simulate MIB modules in AgenPro already and configured the code generation templates there.
    1. Specifiy the root template folder where the code generation template directory is located. With standard AgenPro projects, the path to each template is relative to the installation directory. Thus here you specify the installation directory of the accompanied files like C:\Users\myuser\Documents\agenpro4. All template paths in the job table are specified then relative to this folder (you can use absolute paths only, if the root directory is left empty)
    2. Specify the input/ouput root directory. All input and ouput paths specified in the table with the code generation jobs are specified relative to this directory. A sample input/ouput path could be C:\Users\myuser\Documents\agenpro4\generated.  
    3. The standard SNMP4J-Agent project should already come with two generation jobs. Please check their paths to match with your requirements. Use the tooltip function to see the full path or click into the path cell to edit it.
      1. a job for generating the code for each MIB module
      2. a job for generating the code for the initialization of the MIB modules, which will generate the Modules.java file.
  2. Make sure that you provided the package property in the second wizard step to let AgenPro generate the directory structure needed for you Java package and the appropriate package statement in each Java source file:
  3. Select the MIB modules for which to run code generation in step 4:
  4. Finish the wizard (no code will be generated).
  5. Run the code generation with Project->Generate.

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Related issues