net.sourceforge.jdbcimporter
Interface ImportEngine

All Known Implementing Classes:
BasicEngine, UpdateEngine

public interface ImportEngine

The ImportEngine defines the methods needed to import a row into a database.

Version:
0.6
Author:
Chris Nagy

Field Summary
static int BATCH_SUCCESS_ROWS_UNKNOWN
          Static variable that is equal to constant java.sql.Statement.SUCCESS_NO_INFO (from jdk1.4)
 
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 entityDef)
          Sets the entity definition to use for importing the row
 

Field Detail

BATCH_SUCCESS_ROWS_UNKNOWN

public static final int BATCH_SUCCESS_ROWS_UNKNOWN
Static variable that is equal to constant java.sql.Statement.SUCCESS_NO_INFO (from jdk1.4)

See Also:
Constant Field Values
Method Detail

setConnection

public void setConnection(java.sql.Connection con)
Sets the database connection to use for importing the row.

Parameters:
con - database connection

getConnection

public java.sql.Connection getConnection()
Returns the database connection to use for importing the row.

Returns:
database connection

setEntityDef

public void setEntityDef(ImportEntityDef entityDef)
Sets the entity definition to use for importing the row

Parameters:
entityDef - entity definition

init

public void init()
          throws java.sql.SQLException
Initializes the import engine with the current entity definition.

Throws:
java.sql.SQLException - if a database error occurs during initialization

cleanup

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

Throws:
java.sql.SQLException - if a database error occurs during cleanup

importRow

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

Parameters:
values - the column values for the row
Throws:
java.sql.SQLException - if a database error occurs during the import
MalformedDataException

setBatchMode

public void setBatchMode(boolean flag)
Sets whether the import will use batch mode.

Parameters:
flag - true if the import will use batch mode

executeBatch

public void executeBatch()
                  throws java.sql.BatchUpdateException
Call executeBatch on the allocated statements.

Throws:
java.sql.BatchUpdateException - If not all rows were imported then throw a BatchUpdateException