Package org.dbunit.dataset.xml
Class FlatDtdDataSet
java.lang.Object
org.dbunit.dataset.AbstractDataSet
org.dbunit.dataset.xml.FlatDtdDataSet
- All Implemented Interfaces:
IDataSet,IDataSetConsumer
IDataSet built by consuming table metadata declared
in a flat DTD document.- Since:
- 1.0 (Apr 4, 2002)
- Version:
- $Revision$ $Date$
- Author:
- Manuel Laflamme, Last changed by: $Author$
-
Field Summary
Fields inherited from class org.dbunit.dataset.AbstractDataSet
_orderedTableNameMap -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Creates a dataset from the DTD content of the given input stream.FlatDtdDataSet(Reader reader) Creates a dataset from the DTD content of the given reader.FlatDtdDataSet(IDataSetProducer producer) Creates a dataset that synchronously consumes the specified producer. -
Method Summary
Modifier and TypeMethodDescriptionprotected ITableIteratorcreateIterator(boolean reversed) Creates an iterator which provides access to all tables of this datasetvoidReceive notification of the end of a dataset.voidendTable()Receive notification of the end of a table.Returns the specified table.getTableMetaData(String tableName) Returns the specified table metadata.String[]Returns names of tables in this dataset in proper sequence.protected voidInitializes the tables of this datasetvoidReceive notification of a table row.voidReceive notification of the beginning of a dataset.voidstartTable(ITableMetaData metaData) Receive notification of the beginning of a table.toString()static voidwrite(IDataSet dataSet, OutputStream out) Writes the specified dataset to the specified output stream as DTD, encoded in UTF-8, matching what theInputStreamconstructor's SAX parsing assumes absent an explicit encoding declaration.static voidWrite the specified dataset to the specified writer as DTD.Methods inherited from class org.dbunit.dataset.AbstractDataSet
createTableNameMap, getTables, isCaseSensitiveTableNames, iterator, reverseIterator
-
Constructor Details
-
FlatDtdDataSet
public FlatDtdDataSet()Default constructor. -
FlatDtdDataSet
Creates a dataset from the DTD content of the given input stream.- Parameters:
in- the input stream to read the DTD from.- Throws:
DataSetException- if the DTD content is invalid.IOException- if the input stream cannot be read.
-
FlatDtdDataSet
Creates a dataset from the DTD content of the given reader.- Parameters:
reader- the reader to read the DTD from.- Throws:
DataSetException- if the DTD content is invalid.IOException- if the reader cannot be read.
-
FlatDtdDataSet
Creates a dataset that synchronously consumes the specified producer.- Parameters:
producer- the producer to consume.- Throws:
DataSetException- if consuming the producer fails.
-
-
Method Details
-
initialize
protected void initialize()Description copied from class:AbstractDataSetInitializes the tables of this dataset- Overrides:
initializein classAbstractDataSet
-
write
Writes the specified dataset to the specified output stream as DTD, encoded in UTF-8, matching what theInputStreamconstructor's SAX parsing assumes absent an explicit encoding declaration.- Parameters:
dataSet- the dataset to write a DTD for.out- the stream to write to.- Throws:
IOException- if writing fails.DataSetException- if reading the dataset fails.- See Also:
-
write
Write the specified dataset to the specified writer as DTD.- Parameters:
dataSet- the dataset to write a DTD for.out- the writer to write to.- Throws:
IOException- if writing fails.DataSetException- if reading the dataset fails.- See Also:
-
createIterator
Description copied from class:AbstractDataSetCreates an iterator which provides access to all tables of this dataset- Specified by:
createIteratorin classAbstractDataSet- Parameters:
reversed- Whether the created iterator should be a reversed one or not- Returns:
- The created
ITableIterator - Throws:
DataSetException- if the iterator cannot be created.
-
getTableNames
Description copied from interface:IDataSetReturns names of tables in this dataset in proper sequence. Multiple occurrence of the same name may be returned if multiple tables having the same name are present in the dataset.- Specified by:
getTableNamesin interfaceIDataSet- Overrides:
getTableNamesin classAbstractDataSet- Returns:
- the table names, in proper sequence.
- Throws:
DataSetException- if the table names cannot be determined.
-
getTableMetaData
Description copied from interface:IDataSetReturns the specified table metadata.- Specified by:
getTableMetaDatain interfaceIDataSet- Overrides:
getTableMetaDatain classAbstractDataSet- Parameters:
tableName- the name of the table to look up.- Returns:
- the metadata of the specified table.
- Throws:
DataSetException
-
getTable
Description copied from interface:IDataSetReturns the specified table.- Specified by:
getTablein interfaceIDataSet- Overrides:
getTablein classAbstractDataSet- Parameters:
tableName- the name of the table to look up.- Returns:
- the specified table.
- Throws:
DataSetException
-
startDataSet
Description copied from interface:IDataSetConsumerReceive notification of the beginning of a dataset. This method is invoked only once, before any other methods in this interface.- Specified by:
startDataSetin interfaceIDataSetConsumer- Throws:
DataSetException- if the notification cannot be processed.
-
endDataSet
Description copied from interface:IDataSetConsumerReceive notification of the end of a dataset. This method is invoked only once, and it will be the last method invoked in this interface.- Specified by:
endDataSetin interfaceIDataSetConsumer- Throws:
DataSetException- if the notification cannot be processed.
-
startTable
Description copied from interface:IDataSetConsumerReceive notification of the beginning of a table. This method is invoked at the beginning of every table in the dataset; there will be a correspondingIDataSetConsumer.endDataSet()event for everystartTableevent (even when the table is empty).- Specified by:
startTablein interfaceIDataSetConsumer- Parameters:
metaData- the table metadata- Throws:
DataSetException- if the notification cannot be processed.
-
endTable
Description copied from interface:IDataSetConsumerReceive notification of the end of a table.- Specified by:
endTablein interfaceIDataSetConsumer- Throws:
DataSetException- if the notification cannot be processed.
-
row
Description copied from interface:IDataSetConsumerReceive notification of a table row. This method is invoked to report each row of a table.- Specified by:
rowin interfaceIDataSetConsumer- Parameters:
values- The row values.- Throws:
DataSetException- if the notification cannot be processed.
-
toString
- Overrides:
toStringin classAbstractDataSet
-