+ "a fileset of XML data files!");
}
try
{
Database db = (Database) getDataModels().get(0);
List data;
if (dataXmlFile != null)
{
XmlToData dataXmlParser = new XmlToData(db, dataDTD);
data = dataXmlParser.parseFile(dataXmlFile);
}
else
{
data = new ArrayList();
// Deal with the filesets.
for (int i = 0; i < filesets.size(); i++)
{
FileSet fs = (FileSet) filesets.get(i);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
File srcDir = fs.getDir(getProject());
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]);
XmlToData dataXmlParser = new XmlToData(db, dataDTD);
List newData = dataXmlParser.parseFile(f.toString());
for (Iterator it = newData.iterator(); it.hasNext();)
{
data.add(it.next());
}
}
}
}
context.put("data", data);
// Place our model in the context.
context.put("appData", db);
// Place the target database in the context.
context.put("targetDatabase", targetDatabase);
Properties p = new Properties();
FileInputStream fis = new FileInputStream(getSqlDbMap());
p.load(fis);
fis.close();
p.setProperty(getOutputFile(), db.getName());
p.store(new FileOutputStream(getSqlDbMap()), "Sqlfile -> Database map");
}
catch (EngineException ee)
{
throw new BuildException(ee);