return;
//separator for file names
char fs = File.separatorChar;
//for each package
VelocityLogger vl = new VelocityLogger(logger);
VelocityEngine ve = new VelocityEngine();
ve.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM, vl);
AbstractVelocityGenerator[] vgs = getGenerators();
Logger[] loggers = new Logger[vgs.length];
String strlibs = "";
boolean first = true;
for (int i = 0; i < vgs.length; i++) {
vgs[i].setSpeedoCompilerParameter(scp);
vgs[i].init();
Collection col = vgs[i].getExternalsTemplate();
if (col != null && col.size() > 0) {
for (Iterator it = col.iterator(); it.hasNext();) {
strlibs += (first ? "" : ",") + it.next();
first = false;
}
}
vgs[i].setVelocityEngine(ve);
loggers[i] = scp.loggerFactory.getLogger(
vgs[i].getLogger().getName() + ".velocity");
}
ve.setProperty(Velocity.RESOURCE_LOADER, "class");
ve.setProperty(CLASS_RESOURCE_LOADER_DESCRIPTION_PROP,
CLASS_RESOURCE_LOADER_DESCRIPTION_VALUE);
ve.setProperty(CLASS_RESOURCE_LOADER_CLASS_PROP,
CLASS_RESOURCE_LOADER_CLASS_VALUE);
ve.setProperty(Velocity.VM_LIBRARY, strlibs);
try {
ve.init();
} catch (Exception e) {
throw new SpeedoException(
"Impossible to initialize the VelocityEngine", e);
}
for (Iterator itDesc = scp.getXmldescriptor().values().iterator(); itDesc.hasNext();) {
SpeedoXMLDescriptor desc = (SpeedoXMLDescriptor) itDesc.next();
for (Iterator itPack = desc.packages.values().iterator(); itPack.hasNext();) {
SpeedoPackage sp = (SpeedoPackage) itPack.next();
//base directory for new files
String baseDir = scp.output + fs + sp.name.replace('.', fs) + fs;
for (Iterator itclass = sp.classes.values().iterator(); itclass.hasNext();) {
SpeedoClass sClass = (SpeedoClass) itclass.next();
//asm has not failed on this class
if (sClass.enhancementFailed())
continue;
String[] filenames = {
baseDir + NamingRules.fieldsName(sClass.name) + ".java",
baseDir + NamingRules.homeName(sClass.name) + ".class",
baseDir + sClass.identity.objectidClass + ".java"};
try {
//fields
vl.setLog(loggers[0]);
vgs[0].generate(sClass, filenames[0]);
generatedFiles ++;
//home
vl.setLog(loggers[1]);
vgs[1].generate(sClass, filenames[1]);
generatedFiles ++;
//oid
if (sClass.identity.oidClassAutoCalculated) {
vl.setLog(loggers[2]);
vgs[2].generate(sClass, filenames[2]);
generatedFiles ++;
logger.log(BasicLevel.WARN,
"No object id class defined for the class '"
+ sClass.getFQName()