Class Export

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.dbunit.ant.AbstractStep
org.dbunit.ant.Export
All Implemented Interfaces:
Cloneable, DbUnitTaskStep

public class Export extends AbstractStep
The Export class is the step that facilitates exporting the contents of the database and/or it's corresponding DTD to a file. The export can be performed on a full dataset or a partial one if specific table names are identified.
Since:
Jun 10, 2002
Version:
$Revision$
Author:
Timothy Ruppert, Ben Cox
See Also:
  • Constructor Details

    • Export

      public Export()
      Default constructor.
  • Method Details

    • getDest

      public File getDest()
      Returns the destination file to export to.
      Returns:
      the destination file to export to.
    • getFormat

      public String getFormat()
      Returns the export format.
      Returns:
      the export format.
    • getTables

      public List getTables()
      Returns the tables and queries to export.
      Returns:
      the tables and queries to export.
    • setDest

      public void setDest(File dest)
      Sets the destination file to export to.
      Parameters:
      dest - the destination file to export to.
    • setFormat

      public void setFormat(String format)
      Sets the export format.
      Parameters:
      format - the export format.
    • getEncoding

      public Charset getEncoding()
      Encoding for XML-Output
      Returns:
      Returns the encoding.
    • setEncoding

      public void setEncoding(String encoding)
      Sets the encoding for XML output.
      Parameters:
      encoding - the name of the encoding for XML output.
    • setEncoding

      public void setEncoding(Charset encoding)
      Sets the encoding for XML output.
      Parameters:
      encoding - the encoding for XML output.
    • addTable

      public void addTable(Table table)
      Adds a table to export.
      Parameters:
      table - the table to export.
    • addQuery

      public void addQuery(Query query)
      Adds a query to export.
      Parameters:
      query - the query to export.
    • addQuerySet

      public void addQuerySet(QuerySet querySet)
      Adds a query set to export.
      Parameters:
      querySet - the query set to export.
    • getDoctype

      public String getDoctype()
      Returns the DOCTYPE to use for flat XML export.
      Returns:
      the DOCTYPE to use for flat XML export.
    • setDoctype

      public void setDoctype(String doctype)
      Sets the DOCTYPE to use for flat XML export.
      Parameters:
      doctype - the DOCTYPE to use for flat XML export.
    • execute

      public void execute(IDatabaseConnection connection) throws DatabaseUnitException
      Description copied from interface: DbUnitTaskStep
      Executes this step using the given database connection.
      Parameters:
      connection - the database connection to use.
      Throws:
      DatabaseUnitException - if the step fails.
    • getExportDataSet

      protected IDataSet getExportDataSet(IDatabaseConnection connection) throws DatabaseUnitException, SQLException
      Creates the dataset that is finally used for the export
      Parameters:
      connection - the database connection to export from.
      Returns:
      The final dataset used for the export
      Throws:
      DatabaseUnitException - if building the dataset fails.
      SQLException - if a database access error occurs.
    • getLogMessage

      public String getLogMessage()
      Description copied from interface: DbUnitTaskStep
      Returns a message describing this step, for logging purposes.
      Returns:
      a message describing this step.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractStep