com.northconcepts.datapipeline.core
Class AbstractWriter

java.lang.Object
  extended by com.northconcepts.datapipeline.core.DataEndpoint
      extended by com.northconcepts.datapipeline.core.DataWriter
          extended by com.northconcepts.datapipeline.core.AbstractWriter
Direct Known Subclasses:
BinaryWriter, ExcelWriter, TextWriter

public abstract class AbstractWriter
extends DataWriter

Abstract super-class, with some common logic, for writing records. The only method subclasses must implement is writeRecord(Record).


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
AbstractWriter()
           
 
Method Summary
 DataException addExceptionProperties(DataException exception)
          Adds this endpoint's current state to a DataException.
 boolean isFieldNamesInFirstRow()
           
 void open()
          Makes this endpoint ready for reading or writing.
 AbstractWriter setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
           
 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.
protected abstract  void writeRecord(Record record)
           
 
Methods inherited from class com.northconcepts.datapipeline.core.DataWriter
getNestedWriter, getRootWriter
 
Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
assertNotOpened, assertOpened, close, 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

AbstractWriter

public AbstractWriter()
Method Detail

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

setFieldNamesInFirstRow

public AbstractWriter setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)

isFieldNamesInFirstRow

public boolean isFieldNamesInFirstRow()

open

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

Overrides:
open in class DataEndpoint

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

writeRecord

protected abstract void writeRecord(Record record)
                             throws Throwable
Throws:
Throwable


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