com.northconcepts.datapipeline.core
Class DataWriter

java.lang.Object
  extended by com.northconcepts.datapipeline.core.DataEndpoint
      extended by com.northconcepts.datapipeline.core.DataWriter
Direct Known Subclasses:
AbstractWriter, FileWriter, JdbcWriter, MemoryWriter, MultiWriter, NullWriter, ProxyWriter, StreamWriter

public abstract class DataWriter
extends DataEndpoint

Abstract super-class for writing records. The only method that a subclass must implement is writeImpl(Record), however, most subclasses will also override DataEndpoint.open() and DataEndpoint.close().


Nested Class Summary
 
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State
 
Field Summary
 
Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
BUFFER_SIZE, log
 
Constructor Summary
DataWriter()
           
 
Method Summary
 DataException addExceptionProperties(DataException exception)
          Adds this endpoint's current state to a DataException.
 DataWriter getNestedWriter()
          Returns the DataWriter held inside this one or null if there isn't one.
 DataWriter getRootWriter()
          Returns the deepest, nested DataWriter held inside this one, otherwise this instance is returned if there aren't any nested DataWriters.
 void write(Record record)
          Writes the specified record to this DataWriter and increases the record-count by 1.
protected abstract  void writeImpl(Record record)
          Overridden by subclasses to write the specified record to this DataWriter.
 
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, open, resetRecordCount, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataWriter

public DataWriter()
Method Detail

getNestedWriter

public DataWriter getNestedWriter()
Returns the DataWriter held inside this one or null if there isn't one.


getRootWriter

public DataWriter getRootWriter()
Returns the deepest, nested DataWriter held inside this one, otherwise this instance is returned if there aren't any nested DataWriters.


writeImpl

protected abstract void writeImpl(Record record)
                           throws Throwable
Overridden by subclasses to write the specified record to this DataWriter.

Throws:
Throwable

write

public void write(Record record)
           throws DataException
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 writeImpl(Record).

Throws:
DataException

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 DataEndpoint


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