Class FlatXmlDataSetBuilder

java.lang.Object
org.dbunit.dataset.xml.FlatXmlDataSetBuilder

public final class FlatXmlDataSetBuilder extends Object
Builder for the creation of FlatXmlDataSet instances.
Since:
2.4.7
Version:
$Revision$ $Date$
Author:
gommma (gommma AT users.sourceforge.net), Last changed by: $Author$
See Also:
  • Constructor Details

    • FlatXmlDataSetBuilder

      public FlatXmlDataSetBuilder()
      Default constructor
  • Method Details

    • build

      public FlatXmlDataSet build(InputSource inputSource) throws DataSetException
      Sets the flat XML input source from which the FlatXmlDataSet is to be built
      Parameters:
      inputSource - The flat XML input as InputSource
      Returns:
      The created FlatXmlDataSet
      Throws:
      DataSetException - if the dataset cannot be built.
    • build

      public FlatXmlDataSet build(File xmlInputFile) throws MalformedURLException, DataSetException
      Sets the flat XML input source from which the FlatXmlDataSet is to be built
      Parameters:
      xmlInputFile - The flat XML input as File
      Returns:
      The created FlatXmlDataSet
      Throws:
      MalformedURLException - if the file's path cannot be converted to a URL.
      DataSetException - if the dataset cannot be built.
    • build

      public FlatXmlDataSet build(URL xmlInputUrl) throws DataSetException
      Sets the flat XML input source from which the FlatXmlDataSet is to be built
      Parameters:
      xmlInputUrl - The flat XML input as URL
      Returns:
      The created FlatXmlDataSet
      Throws:
      DataSetException - if the dataset cannot be built.
    • build

      public FlatXmlDataSet build(Reader xmlReader) throws DataSetException
      Sets the flat XML input source from which the FlatXmlDataSet is to be built
      Parameters:
      xmlReader - The flat XML input as Reader
      Returns:
      The created FlatXmlDataSet
      Throws:
      DataSetException - if the dataset cannot be built.
    • build

      public FlatXmlDataSet build(InputStream xmlInputStream) throws DataSetException
      Sets the flat XML input source from which the FlatXmlDataSet is to be built
      Parameters:
      xmlInputStream - The flat XML input as InputStream
      Returns:
      The created FlatXmlDataSet
      Throws:
      DataSetException - if the dataset cannot be built.
    • setMetaDataSet

      public FlatXmlDataSetBuilder setMetaDataSet(IDataSet metaDataSet)
      Set the metadata information (column info etc.) to be used. May come from a DTD. This has precedence to the other builder's properties.
      Parameters:
      metaDataSet - the metadata source.
      Returns:
      this
    • setMetaDataSetFromDtd

      public FlatXmlDataSetBuilder setMetaDataSetFromDtd(Reader dtdReader) throws DataSetException, IOException
      Set the metadata information (column info etc.) to be used from the given DTD input. This has precedence to the other builder's properties.
      Parameters:
      dtdReader - A reader that provides the DTD content
      Returns:
      this
      Throws:
      DataSetException - if the DTD content is invalid.
      IOException - if the reader cannot be read.
    • setMetaDataSetFromDtd

      public FlatXmlDataSetBuilder setMetaDataSetFromDtd(InputStream dtdStream) throws DataSetException, IOException
      Set the metadata information (column info etc.) to be used from the given DTD input. This has precedence to the other builder's properties.
      Parameters:
      dtdStream - A stream that provides the DTD content
      Returns:
      this
      Throws:
      DataSetException - if the DTD content is invalid.
      IOException - if the stream cannot be read.
    • isDtdMetadata

      public boolean isDtdMetadata()
      Whether or not DTD metadata is available to parse via a DTD handler.
      Returns:
      whether or not DTD metadata is available to parse via a DTD handler.
    • setDtdMetadata

      public FlatXmlDataSetBuilder setDtdMetadata(boolean dtdMetadata)
      Whether or not DTD metadata is available to parse via a DTD handler.
      Parameters:
      dtdMetadata - whether or not DTD metadata is available to parse via a DTD handler.
      Returns:
      this
    • isColumnSensing

      public boolean isColumnSensing()
      Whether or not column sensing is enabled.
      Returns:
      whether or not column sensing is enabled.
    • setColumnSensing

      public FlatXmlDataSetBuilder setColumnSensing(boolean columnSensing)
      Since DBUnit 2.3.0 there is a functionality called "column sensing" which basically reads in the whole XML into a buffer and dynamically adds new columns as they appear.
      Parameters:
      columnSensing - whether or not column sensing is enabled.
      Returns:
      this
    • isCaseSensitiveTableNames

      public boolean isCaseSensitiveTableNames()
      Whether or not the created dataset should use case sensitive table names.
      Returns:
      whether or not the created dataset should use case sensitive table names.
    • setCaseSensitiveTableNames

      public FlatXmlDataSetBuilder setCaseSensitiveTableNames(boolean caseSensitiveTableNames)
      Whether or not the created dataset should use case sensitive table names
      Parameters:
      caseSensitiveTableNames - whether or not the created dataset should use case sensitive table names.
      Returns:
      this
    • createProducer

      protected FlatXmlProducer createProducer(InputSource inputSource)
      Creates the producer used to build the FlatXmlDataSet, using this builder's configured metadata source or properties.
      Parameters:
      inputSource - The XML input to be built
      Returns:
      The producer which is used to create the FlatXmlDataSet
    • toString

      public String toString()
      Overrides:
      toString in class Object