if (xmlFile != null)
{
// Transform the XML database schema into
// data model object.
xmlParser = new XmlToAppData();
AppData ad = xmlParser.parseFile(xmlFile);
xmlParser.parseFile(xmlFile);
ad.setName(grokName(xmlFile));
dataModels.addElement(ad);
}
else
{
// Deal with the filesets.
for (int i = 0; i < filesets.size(); i++)
{
FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
File srcDir = fs.getDir(project);
String[] dataModelFiles = ds.getIncludedFiles();
// Make a transaction for each file
for (int j = 0; j < dataModelFiles.length; j++)
{
File f = new File(srcDir, dataModelFiles[j]);
xmlParser = new XmlToAppData();
AppData ad = xmlParser.parseFile(f.toString());
xmlParser.parseFile(f.toString());
ad.setName(grokName(f.toString()));
dataModels.addElement(ad);
}
}
}
Iterator i = dataModels.iterator();
databaseNames = new Hashtable();
dataModelDbMap = new Hashtable();
// Different datamodels may state the same database
// names, we just want the unique names of databases.
while (i.hasNext())
{
AppData ad = (AppData) i.next();
Database database = ad.getDatabase();
databaseNames.put(database.getName(), database.getName());
dataModelDbMap.put(ad.getName(), database.getName());
}
// Create a new Velocity context.
context = new VelocityContext();