SMILA (incubation) API documentation

org.eclipse.smila.taskworker.output
Class RecordOutput

java.lang.Object
  extended by org.eclipse.smila.taskworker.io.IODataObject
      extended by org.eclipse.smila.taskworker.output.Output
          extended by org.eclipse.smila.taskworker.output.RecordOutput

public class RecordOutput
extends Output

Provides simplified access for creating Record bulks by writing one Record (or Any) at a time. You can also directly access the underlying IpcStreamWriter BON writer, but you should not mix up direct access to the BON writer with the writeRecord(Record) and writeAny(Any) methods.


Field Summary
 
Fields inherited from class org.eclipse.smila.taskworker.io.IODataObject
_objectStore
 
Constructor Summary
RecordOutput(BulkInfo dataObject, ObjectStoreService objectStore)
           
 
Method Summary
 void abort()
          method for aborting the stream when not committing it.
 void commit()
          Commit the data object to objectstore.
 long getBytesWritten()
           
 java.util.Map<java.lang.String,java.lang.Number> getCounter()
          create basic counter map.
 long getRecordCount()
           
 IpcStreamWriter getStreamWriter()
           
 void writeAny(Any any)
           
 void writeRecord(Record record)
           
 
Methods inherited from class org.eclipse.smila.taskworker.io.IODataObject
ensureStore, getDataObject, getDurationOpen, getDurationPerform, getObjectName, getObjectStore, getStoreName, startTime, timeOpen, timePerform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordOutput

public RecordOutput(BulkInfo dataObject,
                    ObjectStoreService objectStore)
Parameters:
dataObject - The data object
objectStore - The reference to the object store service
Method Detail

writeRecord

public void writeRecord(Record record)
                 throws ObjectStoreException,
                        java.io.IOException
Parameters:
record - The record to write
Throws:
ObjectStoreException
java.io.IOException

writeAny

public void writeAny(Any any)
              throws ObjectStoreException,
                     java.io.IOException
Parameters:
any - The object to write
Throws:
ObjectStoreException
java.io.IOException

commit

public void commit()
            throws ObjectStoreException,
                   java.io.IOException
Commit the data object to objectstore. Called by the WorkerManager after the task was finished.

Specified by:
commit in class Output
Throws:
ObjectStoreException
java.io.IOException

abort

public void abort()
           throws java.io.IOException
method for aborting the stream when not committing it.

Specified by:
abort in class Output
Throws:
java.io.IOException

getStreamWriter

public IpcStreamWriter getStreamWriter()
                                throws ObjectStoreException,
                                       java.io.IOException
Returns:
the stream writer
Throws:
ObjectStoreException
java.io.IOException

getRecordCount

public long getRecordCount()
Returns:
number of records written so far using #writeRecord()

getBytesWritten

public long getBytesWritten()
See Also:
StreamOutput.getBytesWritten()

getCounter

public java.util.Map<java.lang.String,java.lang.Number> getCounter()
Description copied from class: IODataObject
create basic counter map.

Overrides:
getCounter in class IODataObject
Returns:
counter map of superclass extended by the number of records written to the stream.

SMILA (incubation) API documentation