* @return Description of the Returned Value
*/
public Context initControlContext()
throws Exception
{
XmlToAppData xmlParser;
if (xmlFile == null && filesets.isEmpty())
{
throw new BuildException("You must specify an XML schema or " +
"fileset of XML schemas!");
}
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);
}
}
}