|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ddlutils.io.DatabaseDataIO
public class DatabaseDataIO
Provides basic live database data <-> XML functionality.
Constructor Summary | |
---|---|
DatabaseDataIO()
|
Method Summary | |
---|---|
java.lang.Integer |
getBatchSize()
Returns the batch size override. |
DataReader |
getConfiguredDataReader(Platform platform,
Database model)
Returns a data reader instance configured for the given platform (which needs to be connected to a live database) and model. |
DataWriter |
getConfiguredDataWriter(java.io.OutputStream output,
java.lang.String xmlEncoding)
Returns a data writer instance configured to write to the given output stream in the specified encoding. |
DataWriter |
getConfiguredDataWriter(java.lang.String path,
java.lang.String xmlEncoding)
Returns a data writer instance configured to write to the indicated file in the specified encoding. |
DataWriter |
getConfiguredDataWriter(java.io.Writer output,
java.lang.String xmlEncoding)
Returns a data writer instance configured to write to the given output writer in the specified encoding. |
boolean |
getUseBatchMode()
Determines whether batch mode is used for inserting data into the database. |
boolean |
isEnsureFKOrder()
Determines whether the sink delays the insertion of beans so that the beans referenced by it via foreignkeys are already inserted into the database. |
boolean |
isFailOnError()
Determines whether data io is stopped when an error happens. |
void |
registerConverter(DataConverterRegistration converterRegistration)
Registers a converter. |
void |
setBatchSize(java.lang.Integer batchSize)
Sets the batch size to be used by this object. |
void |
setDetermineSchema(boolean determineSchema)
Deprecated. Will be removed once proper schema support is in place |
void |
setEnsureFKOrder(boolean ensureFKOrder)
Specifies whether the sink shall delay the insertion of beans so that the beans referenced by it via foreignkeys are already inserted into the database. Note that you should careful with setting haltOnErrors to false as this might
result in beans not inserted at all. |
void |
setFailOnError(boolean failOnError)
Specifies whether data io shall be stopped when an error happens. |
void |
setSchemaPattern(java.lang.String schemaPattern)
Deprecated. Will be removed once proper schema support is in place |
void |
setUseBatchMode(boolean useBatchMode)
Specifies whether batch mode should be used for inserting data into the database. |
void |
writeDataToDatabase(DataReader dataReader,
java.io.InputStream input)
Reads the data from the given input stream and writes it to the database via the given data reader. |
void |
writeDataToDatabase(DataReader dataReader,
java.io.InputStream[] inputs)
Reads the data from the given input stream and writes it to the database via the given data reader. |
void |
writeDataToDatabase(DataReader dataReader,
java.io.Reader input)
Reads the data from the given input stream and writes it to the database via the given data reader. |
void |
writeDataToDatabase(DataReader dataReader,
java.io.Reader[] inputs)
Reads the data from the given input stream and writes it to the database via the given data reader. |
void |
writeDataToDatabase(DataReader dataReader,
java.lang.String path)
Reads the data from the indicated XML file and writes it to the database via the given data reader. |
void |
writeDataToDatabase(DataReader dataReader,
java.lang.String[] files)
Reads the data from the specified files and writes it to the database via the given data reader. |
void |
writeDataToDatabase(Platform platform,
Database model,
java.io.InputStream[] inputs)
Reads the data from the given input streams and writes it to the database to which the given platform is connected. |
void |
writeDataToDatabase(Platform platform,
Database model,
java.io.Reader[] inputs)
Reads the data from the given input readers and writes it to the database to which the given platform is connected. |
void |
writeDataToDatabase(Platform platform,
Database model,
java.lang.String[] files)
Reads the data from the indicated files and writes it to the database to which the given platform is connected. |
void |
writeDataToDatabase(Platform platform,
java.io.InputStream[] inputs)
Reads the data from the given input streams and writes it to the database to which the given platform is connected. |
void |
writeDataToDatabase(Platform platform,
java.io.Reader[] inputs)
Reads the data from the given input readers and writes it to the database to which the given platform is connected. |
void |
writeDataToDatabase(Platform platform,
java.lang.String[] files)
Reads the data from the specified files and writes it to the database to which the given platform is connected. |
void |
writeDataToXML(Platform platform,
Database model,
DataWriter writer)
Writes the data contained in the database to which the given platform is connected, as XML to the given data writer. |
void |
writeDataToXML(Platform platform,
Database model,
java.io.OutputStream output,
java.lang.String xmlEncoding)
Writes the data contained in the database to which the given platform is connected, as XML to the given output stream (which won't be closed by this method). |
void |
writeDataToXML(Platform platform,
Database model,
java.lang.String path,
java.lang.String xmlEncoding)
Writes the data contained in the database to which the given platform is connected, as XML to the given output stream (which won't be closed by this method). |
void |
writeDataToXML(Platform platform,
Database model,
java.io.Writer output,
java.lang.String xmlEncoding)
Writes the data contained in the database to which the given platform is connected, as XML to the given output writer (which won't be closed by this method). |
void |
writeDataToXML(Platform platform,
DataWriter writer)
Writes the data contained in the database to which the given platform is connected, as XML to the given data writer. |
void |
writeDataToXML(Platform platform,
java.io.OutputStream output,
java.lang.String xmlEncoding)
Writes the data contained in the database to which the given platform is connected, as XML to the given output stream (which won't be closed by this method). |
void |
writeDataToXML(Platform platform,
java.lang.String path,
java.lang.String xmlEncoding)
Writes the data contained in the database to which the given platform is connected, as XML to the given output stream (which won't be closed by this method). |
void |
writeDataToXML(Platform platform,
java.io.Writer output,
java.lang.String xmlEncoding)
Writes the data contained in the database to which the given platform is connected, as XML to the given output writer (which won't be closed by this method). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DatabaseDataIO()
Method Detail |
---|
public void registerConverter(DataConverterRegistration converterRegistration)
converterRegistration
- The registration infopublic boolean isFailOnError()
public void setFailOnError(boolean failOnError)
failOnError
- Whether io should stop when an error was detectedpublic boolean getUseBatchMode()
true
if batch mode is usedpublic void setUseBatchMode(boolean useBatchMode)
useBatchMode
- true
if batch mode shall be usedpublic java.lang.Integer getBatchSize()
null
otherwisepublic void setBatchSize(java.lang.Integer batchSize)
batchSize
- The batch size if different from the default, or null
if
the default shall be usedpublic boolean isEnsureFKOrder()
true
if beans are inserted after its foreignkey-referencespublic void setEnsureFKOrder(boolean ensureFKOrder)
haltOnErrors
to false as this might
result in beans not inserted at all. The sink will then throw an appropriate exception at the end
of the insertion process (method DataSink.end()
).
ensureFKOrder
- true
if beans shall be inserted after its foreignkey-referencespublic void setDetermineSchema(boolean determineSchema)
determineSchema
- Whether to try to find the table's schemaspublic void setSchemaPattern(java.lang.String schemaPattern)
schemaPattern
- The schema patternpublic DataWriter getConfiguredDataWriter(java.lang.String path, java.lang.String xmlEncoding) throws DdlUtilsException
path
- The path to the output XML data filexmlEncoding
- The encoding to use for writing the XML
DdlUtilsException
public DataWriter getConfiguredDataWriter(java.io.OutputStream output, java.lang.String xmlEncoding) throws DdlUtilsException
output
- The output streamxmlEncoding
- The encoding to use for writing the XML
DdlUtilsException
public DataWriter getConfiguredDataWriter(java.io.Writer output, java.lang.String xmlEncoding) throws DdlUtilsException
output
- The output writer; needs to be configured with the specified encodingxmlEncoding
- The encoding to use for writing the XML
DdlUtilsException
public void writeDataToXML(Platform platform, java.lang.String path, java.lang.String xmlEncoding) throws DdlUtilsException
platform
- The platform; needs to be connected to a live databasepath
- The path of the output filexmlEncoding
- The encoding to use for the XML
DdlUtilsException
public void writeDataToXML(Platform platform, Database model, java.lang.String path, java.lang.String xmlEncoding)
platform
- The platform; needs to be connected to a live databasemodel
- The model for which to retrieve and write the datapath
- The path of the output filexmlEncoding
- The encoding to use for the XMLpublic void writeDataToXML(Platform platform, java.io.OutputStream output, java.lang.String xmlEncoding)
platform
- The platform; needs to be connected to a live databaseoutput
- The output streamxmlEncoding
- The encoding to use for the XMLpublic void writeDataToXML(Platform platform, Database model, java.io.OutputStream output, java.lang.String xmlEncoding)
platform
- The platform; needs to be connected to a live databasemodel
- The model for which to retrieve and write the dataoutput
- The output streamxmlEncoding
- The encoding to use for the XMLpublic void writeDataToXML(Platform platform, java.io.Writer output, java.lang.String xmlEncoding)
platform
- The platform; needs to be connected to a live databaseoutput
- The output writer (which needs to be openend with the specified encoding)xmlEncoding
- The encoding to use for the XMLpublic void writeDataToXML(Platform platform, Database model, java.io.Writer output, java.lang.String xmlEncoding)
platform
- The platform; needs to be connected to a live databasemodel
- The model for which to retrieve and write the dataoutput
- The output writer (which needs to be openend with the specified encoding)xmlEncoding
- The encoding to use for the XMLpublic void writeDataToXML(Platform platform, DataWriter writer)
platform
- The platform; needs to be connected to a live databasewriter
- The data writerpublic void writeDataToXML(Platform platform, Database model, DataWriter writer)
platform
- The platform; needs to be connected to a live databasemodel
- The model for which to retrieve and write the datawriter
- The data writerpublic DataReader getConfiguredDataReader(Platform platform, Database model) throws DdlUtilsException
platform
- The databasemodel
- The model
DdlUtilsException
public void writeDataToDatabase(Platform platform, java.lang.String[] files) throws DdlUtilsException
platform
- The platform, must be connected to a live databasefiles
- The XML data files
DdlUtilsException
public void writeDataToDatabase(Platform platform, java.io.InputStream[] inputs) throws DdlUtilsException
platform
- The platform, must be connected to a live databaseinputs
- The input streams for the XML data
DdlUtilsException
public void writeDataToDatabase(Platform platform, java.io.Reader[] inputs) throws DdlUtilsException
platform
- The platform, must be connected to a live databaseinputs
- The input readers for the XML data
DdlUtilsException
public void writeDataToDatabase(Platform platform, Database model, java.lang.String[] files) throws DdlUtilsException
platform
- The platform, must be connected to a live databasemodel
- The model to which to constrain the written datafiles
- The XML data files
DdlUtilsException
public void writeDataToDatabase(Platform platform, Database model, java.io.InputStream[] inputs) throws DdlUtilsException
platform
- The platform, must be connected to a live databasemodel
- The model to which to constrain the written datainputs
- The input streams for the XML data
DdlUtilsException
public void writeDataToDatabase(Platform platform, Database model, java.io.Reader[] inputs) throws DdlUtilsException
platform
- The platform, must be connected to a live databasemodel
- The model to which to constrain the written datainputs
- The input readers for the XML data
DdlUtilsException
public void writeDataToDatabase(DataReader dataReader, java.lang.String[] files) throws DdlUtilsException
dataReader
- The data readerfiles
- The XML data files
DdlUtilsException
public void writeDataToDatabase(DataReader dataReader, java.io.InputStream[] inputs) throws DdlUtilsException
dataReader
- The data readerinputs
- The input streams for the XML data
DdlUtilsException
public void writeDataToDatabase(DataReader dataReader, java.io.Reader[] inputs) throws DdlUtilsException
dataReader
- The data readerinputs
- The input readers for the XML data
DdlUtilsException
public void writeDataToDatabase(DataReader dataReader, java.lang.String path) throws DdlUtilsException
dataReader
- The data readerpath
- The path to the XML data file
DdlUtilsException
public void writeDataToDatabase(DataReader dataReader, java.io.InputStream input) throws DdlUtilsException
dataReader
- The data readerinput
- The input stream for the XML data
DdlUtilsException
public void writeDataToDatabase(DataReader dataReader, java.io.Reader input) throws DdlUtilsException
dataReader
- The data readerinput
- The input reader for the XML data
DdlUtilsException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |