com.northconcepts.datapipeline.jdbc
Class JdbcWriter

java.lang.Object
  extended by com.northconcepts.datapipeline.core.DataEndpoint
      extended by com.northconcepts.datapipeline.core.DataWriter
          extended by com.northconcepts.datapipeline.jdbc.JdbcWriter

public class JdbcWriter
extends DataWriter

Writes records to a database table.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State
 
Field Summary
protected  Record currentRecord
           
 
Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
BUFFER_SIZE, log
 
Constructor Summary
JdbcWriter(Connection connection, String tableName)
           
 
Method Summary
 DataException addExceptionProperties(DataException exception)
          Adds this endpoint's current state to a DataException.
 void close()
          Indicates that this endpoint has finished reading or writing.
 boolean getAutoCloseConnection()
           
 void open()
          Makes this endpoint ready for reading or writing.
 JdbcWriter setAutoCloseConnection(boolean closeConnection)
           
 JdbcWriter setJdbcType(String fieldName, int jdbcType)
           The given Java object will be converted to the given targetSqlType before being sent to the database.
 void write(Record record)
          Writes the specified record to this DataWriter and increases the record-count by 1.
protected  void writeImpl(Record record)
          Overridden by subclasses to write the specified record to this DataWriter.
 
Methods inherited from class com.northconcepts.datapipeline.core.DataWriter
getNestedWriter, getRootWriter
 
Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
assertNotOpened, assertOpened, decrementRecordCount, exception, exception, exception, finalize, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, getState, incrementRecordCount, isClosed, isOpen, isRecordCountBigInteger, resetRecordCount, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentRecord

protected Record currentRecord
Constructor Detail

JdbcWriter

public JdbcWriter(Connection connection,
                  String tableName)
Method Detail

getAutoCloseConnection

public boolean getAutoCloseConnection()

setAutoCloseConnection

public JdbcWriter setAutoCloseConnection(boolean closeConnection)

setJdbcType

public JdbcWriter setJdbcType(String fieldName,
                              int jdbcType)

The given Java object will be converted to the given targetSqlType before being sent to the database.

Note that this method may be used to pass database-specific abstract data types.

Parameters:
fieldName -
x - the object containing the JDBC Type parameter value

addExceptionProperties

public DataException addExceptionProperties(DataException exception)
Description copied from class: DataEndpoint
Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.

Overrides:
addExceptionProperties in class DataWriter

write

public void write(Record record)
           throws DataException
Description copied from class: DataWriter
Writes the specified record to this DataWriter and increases the record-count by 1. Any exception raised while writing will be converted to a DataException using DataEndpoint.exception(Throwable).

Subclasses generally do not need to override this method, instead they should implement DataWriter.writeImpl(Record).

Overrides:
write in class DataWriter
Throws:
DataException

writeImpl

protected void writeImpl(Record record)
                  throws Throwable
Description copied from class: DataWriter
Overridden by subclasses to write the specified record to this DataWriter.

Specified by:
writeImpl in class DataWriter
Throws:
Throwable

open

public void open()
Description copied from class: DataEndpoint
Makes this endpoint ready for reading or writing.

Overrides:
open in class DataEndpoint

close

public void close()
Description copied from class: DataEndpoint
Indicates that this endpoint has finished reading or writing.

Overrides:
close in class DataEndpoint


Copyright (c) 2007-2009 North Concepts Inc. All Rights Reserved.