Package org.dbunit.ant
Class Export
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.dbunit.ant.AbstractStep
org.dbunit.ant.Export
- All Implemented Interfaces:
Cloneable,DbUnitTaskStep
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:
-
Field Summary
Fields inherited from class org.dbunit.ant.AbstractStep
FORMAT_CSV, FORMAT_DTD, FORMAT_FLAT, FORMAT_JSON, FORMAT_XLS, FORMAT_XML, FORMAT_YMLFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a query to export.voidaddQuerySet(QuerySet querySet) Adds a query set to export.voidAdds a table to export.voidexecute(IDatabaseConnection connection) Executes this step using the given database connection.getDest()Returns the destination file to export to.Returns the DOCTYPE to use for flat XML export.Encoding for XML-Outputprotected IDataSetgetExportDataSet(IDatabaseConnection connection) Creates the dataset that is finally used for the exportReturns the export format.Returns a message describing this step, for logging purposes.Returns the tables and queries to export.voidSets the destination file to export to.voidsetDoctype(String doctype) Sets the DOCTYPE to use for flat XML export.voidsetEncoding(String encoding) Sets the encoding for XML output.voidsetEncoding(Charset encoding) Sets the encoding for XML output.voidSets the export format.toString()Methods inherited from class org.dbunit.ant.AbstractStep
checkDataFormat, getDatabaseDataSet, getInputSource, getSrcDataSet, isDataFormat, isOrdered, setOrderedMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
-
Constructor Details
-
Export
public Export()Default constructor.
-
-
Method Details
-
getDest
Returns the destination file to export to.- Returns:
- the destination file to export to.
-
getFormat
Returns the export format.- Returns:
- the export format.
-
getTables
Returns the tables and queries to export.- Returns:
- the tables and queries to export.
-
setDest
Sets the destination file to export to.- Parameters:
dest- the destination file to export to.
-
setFormat
Sets the export format.- Parameters:
format- the export format.
-
getEncoding
Encoding for XML-Output- Returns:
- Returns the encoding.
-
setEncoding
Sets the encoding for XML output.- Parameters:
encoding- the name of the encoding for XML output.
-
setEncoding
Sets the encoding for XML output.- Parameters:
encoding- the encoding for XML output.
-
addTable
Adds a table to export.- Parameters:
table- the table to export.
-
addQuery
Adds a query to export.- Parameters:
query- the query to export.
-
addQuerySet
Adds a query set to export.- Parameters:
querySet- the query set to export.
-
getDoctype
Returns the DOCTYPE to use for flat XML export.- Returns:
- the DOCTYPE to use for flat XML export.
-
setDoctype
Sets the DOCTYPE to use for flat XML export.- Parameters:
doctype- the DOCTYPE to use for flat XML export.
-
execute
Description copied from interface:DbUnitTaskStepExecutes 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
Description copied from interface:DbUnitTaskStepReturns a message describing this step, for logging purposes.- Returns:
- a message describing this step.
-
toString
- Overrides:
toStringin classAbstractStep
-