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
- Redefine the same methods as for the IlrVelocityGenerator class.
- Call the generateProjectContent method.
If the property is set correctly, the generator wizard page
automatically generates the trace filter properties file.
- 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.