VelocityHelper vh = new VelocityHelper(); vh.put("types",types); try { String file = _outputDir+File.separator+".."+File.separator+"data.sql"; writeToFile(vh, file, "ome/dsl/data.vm"); } catch (Exception e){ throw new BuildException("Error while writing data:",e); }
    execute()        throws BuildException    {        if(_fileSets.isEmpty())        {            throw new BuildException("No fileset specified");        }                Set types = new HashSet();                java.util.Iterator p = _fileSets.iterator();        while(p.hasNext())        {            FileSet fileset = (FileSet)p.next();            DirectoryScanner scanner = fileset.getDirectoryScanner(getProject());            scanner.scan();            String[] files = scanner.getIncludedFiles();            for(int i = 0; i < files.length; i++)            {            	String filename = fileset.getDir(getProject())+File.separator+files[i];            	File file = new File(filename);            	if (!file.exists()){            		log("File "+file+" not found.");            	} else {            		SaxReader sr = new SaxReader(file);            		types.addAll(sr.parse());            	}            }        }                for (Iterator it = types.iterator(); it.hasNext();) {			SemanticType st = (SemanticType) it.next();			VelocityHelper vh = new VelocityHelper();			vh.put("type",st);			try {                String file = _outputDir+File.separator+st.getId().replaceAll("[.]",File.separator)+".hbm.xml";                mkdir(file);                FileWriter fw = new FileWriter(file);				vh.invoke("ome/dsl/mapping.vm",fw);				fw.flush();				fw.close();			} catch (Exception e){				throw new BuildException("Error while writing type:"+st,e);			}		}            }