*/
@SuppressWarnings("rawtypes")
@Override
protected IDataSet loadDataSet(final File source) throws DataSetException,
IOException {
final CachedDataSet dataSet = new CachedDataSet();
dataSet.startDataSet();
final CsvParser parser = new CsvParserImpl();
final List readData = parser.parse(source);
final List readColumns = ((List) readData.get(0));
final Column[] columns = new Column[readColumns.size()];
for (int i = 0; i < readColumns.size(); i++) {
columns[i] = new Column((String) readColumns.get(i),
DataType.UNKNOWN);
}
final String tableName = source.getName().substring(0,
source.getName().indexOf(".csv"));
final ITableMetaData metaData = new DefaultTableMetaData(tableName,
columns);
dataSet.startTable(metaData);
for (int rowIndex = 1; rowIndex < readData.size(); rowIndex++) {
final List row = (List) readData.get(rowIndex);
final Object[] values = row.toArray();
for (int columnIndex = 0; columnIndex < values.length; columnIndex++) {
if (values[columnIndex].equals(CsvDataSetWriter.NULL)) {
values[columnIndex] = null;
}
}
dataSet.row(values);
}
dataSet.endTable();
dataSet.endDataSet();
return dataSet;
}