net.sourceforge.jdbcimporter.engine
Class BasicEngine

java.lang.Object
  extended bynet.sourceforge.jdbcimporter.engine.BasicEngine
All Implemented Interfaces:
ImportEngine

public class BasicEngine
extends java.lang.Object
implements ImportEngine

The BasicEngine class implements the ImportEngine interface to provide basic import capability. The BasicEngine simply tries to insert the row into the current table. The following SQL Types are supported:

Version:
0.6
Author:
Chris Nagy

Field Summary
protected static org.apache.commons.logging.Log LOG
          The log for debug information.
 
Fields inherited from interface net.sourceforge.jdbcimporter.ImportEngine
BATCH_SUCCESS_ROWS_UNKNOWN
 
Constructor Summary
BasicEngine()
           
 
Method Summary
 void cleanup()
          Cleans up any resources that the import engine used to import data for the current entity definition.
 void executeBatch()
          Call executeBatch on the allocated statements.
 java.sql.Connection getConnection()
          Returns the database connection to use for importing the row.
 void importRow(ColumnValue[] values)
          Imports the given set of values as a row into the database
 void init()
          Initializes the import engine with the current entity definition.
 void setBatchMode(boolean flag)
          Sets whether the import will use batch mode.
 void setConnection(java.sql.Connection con)
          Sets the database connection to use for importing the row.
 void setEntityDef(ImportEntityDef newEntityDef)
          Sets the entity definition to use for importing the row
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static org.apache.commons.logging.Log LOG
The log for debug information.

Constructor Detail

BasicEngine

public BasicEngine()
Method Detail

setConnection

public void setConnection(java.sql.Connection con)
Description copied from interface: ImportEngine
Sets the database connection to use for importing the row.

Specified by:
setConnection in interface ImportEngine
Parameters:
con - database connection
See Also:
ImportEngine.setConnection(Connection)

getConnection

public java.sql.Connection getConnection()
Description copied from interface: ImportEngine
Returns the database connection to use for importing the row.

Specified by:
getConnection in interface ImportEngine
Returns:
database connection
See Also:
ImportEngine.getConnection()

setEntityDef

public void setEntityDef(ImportEntityDef newEntityDef)
Description copied from interface: ImportEngine
Sets the entity definition to use for importing the row

Specified by:
setEntityDef in interface ImportEngine
Parameters:
newEntityDef - entity definition
See Also:
ImportEngine.setEntityDef(ImportEntityDef)

init

public void init()
          throws java.sql.SQLException
Description copied from interface: ImportEngine
Initializes the import engine with the current entity definition.

Specified by:
init in interface ImportEngine
Throws:
java.sql.SQLException - if a database error occurs during initialization
See Also:
ImportEngine.init()

cleanup

public void cleanup()
             throws java.sql.SQLException
Description copied from interface: ImportEngine
Cleans up any resources that the import engine used to import data for the current entity definition.

Specified by:
cleanup in interface ImportEngine
Throws:
java.sql.SQLException - if a database error occurs during cleanup
See Also:
ImportEngine.cleanup()

importRow

public void importRow(ColumnValue[] values)
               throws java.sql.SQLException,
                      MalformedDataException
Description copied from interface: ImportEngine
Imports the given set of values as a row into the database

Specified by:
importRow in interface ImportEngine
Parameters:
values - the column values for the row
Throws:
java.sql.SQLException - if a database error occurs during the import
MalformedDataException
See Also:
ImportEngine.importRow(ColumnValue[])

setBatchMode

public void setBatchMode(boolean flag)
Description copied from interface: ImportEngine
Sets whether the import will use batch mode.

Specified by:
setBatchMode in interface ImportEngine
Parameters:
flag - true if the import will use batch mode
See Also:
ImportEngine.setBatchMode(boolean)

executeBatch

public void executeBatch()
                  throws java.sql.BatchUpdateException
Description copied from interface: ImportEngine
Call executeBatch on the allocated statements.

Specified by:
executeBatch in interface ImportEngine
Throws:
java.sql.BatchUpdateException - If not all rows were imported then throw a BatchUpdateException
See Also:
ImportEngine.executeBatch()