Platform           platform = getPlatform(); DataToDatabaseSink sink     = new DataToDatabaseSink(platform, model); DataReader         reader   = new DataReader();  sink.setEnsureForeignKeyOrder(_ensureFKOrder); if (_useBatchMode != null) { sink.setUseBatchMode(_useBatchMode.booleanValue()); if (_batchSize != null) { sink.setBatchSize(_batchSize.intValue()); } }  reader.setModel(model); reader.setSink(sink); registerConverters(reader.getConverterConfiguration()); if ((_singleDataFile != null) && !_fileSets.isEmpty()) { throw new BuildException("Please use either the datafile attribute or the sub fileset element, but not both"); }
dataReader = getDataIO().getConfiguredDataReader(getPlatform(), model); dataReader.getSink().start();
    public void execute(Task task, Database model) throws BuildException    {        try        {            Platform           platform = getPlatform();            DataToDatabaseSink sink     = new DataToDatabaseSink(platform, model);            DataReader         reader   = new DataReader();            sink.setEnsureForeignKeyOrder(_ensureFKOrder);            if (_useBatchMode != null)            {                sink.setUseBatchMode(_useBatchMode.booleanValue());                if (_batchSize != null)                {                    sink.setBatchSize(_batchSize.intValue());                }            }                        reader.setModel(model);            reader.setSink(sink);            registerConverters(reader.getConverterConfiguration());            if ((_singleDataFile != null) && !_fileSets.isEmpty())            {                throw new BuildException("Please use either the datafile attribute or the sub fileset element, but not both");            }            if (_singleDataFile != null)            {                readSingleDataFile(task, reader, _singleDataFile);            }            else            {                for (Iterator it = _fileSets.iterator(); it.hasNext();)                {                    FileSet          fileSet    = (FileSet)it.next();                    File             fileSetDir = fileSet.getDir(task.getProject());                    DirectoryScanner scanner    = fileSet.getDirectoryScanner(task.getProject());                    String[]         files      = scanner.getIncludedFiles();                        for (int idx = 0; (files != null) && (idx < files.length); idx++)                    {                        readSingleDataFile(task, reader, new File(fileSetDir, files[idx]));                    }                }            }        }        catch (Exception ex)        {            if (ex instanceof BuildException)            {                throw (BuildException)ex;            }            else            {                throw new BuildException(ex);            }        }    }