{
ThreadLocalToolkit.log(new TemplateNotFound(templateName));
return null;
}
SourceCodeBuffer sourceCodeBuffer = new SourceCodeBuffer();
String genFileName = (configuration.getGeneratedDirectory() +
File.separatorChar +
styleModule.getName() +
"-generated.as");
Source source = compilationUnit.getSource();
DualModeLineNumberMap lineNumberMap = new DualModeLineNumberMap(source.getNameForReporting(), genFileName);
styleModule.setLineNumberMap(lineNumberMap);
try
{
VelocityUtil velocityUtil = new VelocityUtil(TEMPLATE_PATH, configuration.debug(),
sourceCodeBuffer, lineNumberMap);
VelocityContext velocityContext = VelocityManager.getCodeGenContext(velocityUtil);
velocityContext.put(STYLE_MODULE_KEY, styleModule);
template.merge(velocityContext, sourceCodeBuffer);
}
catch (Exception e)
{
ThreadLocalToolkit.log(new GenerateException(styleModule.getName(), e.getLocalizedMessage()));
return null;
}
String sourceCode = sourceCodeBuffer.toString();
if (configuration.keepGeneratedActionScript())
{
try
{