From the IlrTraceFileGenerator class

You can write a new generator class that inherits from the IlrTraceFileGenerator class.

About this task

You can write a new generator class that inherits from the IlrTraceFileGenerator class, use velocity as the engine to write the generated files and use the trace filter properties file.

Procedure

  1. Redefine the same methods as for the IlrVelocityGenerator class.
  2. Call the generateProjectContent method.

    If the property is set correctly, the generator wizard page automatically generates the trace filter properties file.

  3. To set the parameter values in the generated file, change your initializeContext method, as follows:
    protected VelocityContext initializeContext(Object userData,
              VelocityContext context) { 
       if ( userData instanceof String ) { 
          String templateFile = (String) userData; 
          if ( templateFile.equals("myTemplate.vm") ) {  
             context.put("package", getPackagePrefix());   
             context.put("header", getFileHeader());    
             context.put("ruleapp-name",
                getRuleAppProject().getDescriptor().getName());   
             context.put("ruleapp-version", 
                getRuleAppProject().getDescriptor().getVersion());
          }
       }  else { 
          context = super.initializeContext(userData, context);
       } 
       return context;
    }
    
    A wizard page is also provided to manage the trace filter properties file. For more information, see Writing a new nested wizard.