public class Outputs extends IODataObjects
TaskContext.getOutputs() this class provides access to the data
objects associated by a task to the output slots of a worker. It can create different kinds of Output
wrappers on these data objects that make access for the workers easier. You can create only a single output wrapper
for each data object. On the second call, only null will be returned.StreamOutput,
RecordOutput,
KvoOutput,
AppendableOutput_dataObjects, _ioData| Constructor and Description |
|---|
Outputs(java.util.Map<java.lang.String,java.util.List<BulkInfo>> dataObjects,
ObjectStoreService objectStore) |
| Modifier and Type | Method and Description |
|---|---|
void |
abortAll()
Abort all open data objects, if necessary.
|
void |
addOutputCounters(java.util.Map<java.lang.String,java.lang.Number> counters)
aggregate counters of output slots.
|
protected boolean |
canCreate(java.lang.String slotName,
int index)
check if index is valid for slotname and no input object has yet been created for this object.
|
void |
commitAll()
Commit all open data objects, if necessary.
|
<T extends Output> |
getAsOutput(java.lang.String slotName,
java.lang.Class<T> inputClass)
Generic method to create output wrapper for the first data object in a slot.
|
<T extends Output> |
getAsOutput(java.lang.String slotName,
int index,
java.lang.Class<T> outputClass)
Generic method to create output wrappers.
|
RecordOutput |
getAsRecordOutput(java.lang.String slotName) |
RecordOutput |
getAsRecordOutput(java.lang.String slotName,
int index) |
StreamOutput |
getAsStreamOutput(java.lang.String slotName) |
StreamOutput |
getAsStreamOutput(java.lang.String slotName,
int index) |
BulkInfo |
getDataObject(java.lang.String slotName,
int index) |
protected boolean |
isMultiple(java.lang.String slotName) |
void |
setOutputModes(java.util.Map<java.lang.String,java.util.Collection<OutputMode>> outputModes) |
addCounters, getDataObject, getDataObjectCount, getIOData, getObjectStore, getSlotNames, putIODatapublic Outputs(java.util.Map<java.lang.String,java.util.List<BulkInfo>> dataObjects, ObjectStoreService objectStore)
dataObjects - The data objectsobjectStore - The reference to the object store servicepublic void setOutputModes(java.util.Map<java.lang.String,java.util.Collection<OutputMode>> outputModes)
outputModes - the output modes for the output slots.public <T extends Output> T getAsOutput(java.lang.String slotName, java.lang.Class<T> inputClass)
getAsOutput(String, int, Class) for details, this method just calls this method with
index = 0java.lang.IllegalArgumentException - if the outputClass cannot be instantiated.public <T extends Output> T getAsOutput(java.lang.String slotName, int index, java.lang.Class<T> outputClass)
Output can be used as well as custom
defined class if you need it (be sure to implement the necessary constructor). For example, to get an
Key-Value-Object wrapper for the first object in slot "kvoOutputSlot", use
KvoOutput kvo = taskContext.getOutputs().getAsOutput("kvoOutputSlot", KvoOutput.class);java.lang.IllegalArgumentException - if the outputClass cannot be instantiated.StreamOutput,
RecordOutput,
KvoOutput,
AppendableOutputpublic StreamOutput getAsStreamOutput(java.lang.String slotName, int index)
slotName - The slot nameindex - The indexStreamOutput with given slot name and indexpublic StreamOutput getAsStreamOutput(java.lang.String slotName)
slotName - The slot nameStreamOutput with given slot namepublic RecordOutput getAsRecordOutput(java.lang.String slotName, int index)
slotName - The slot nameindex - The indexRecordOutput with given slot name and indexpublic RecordOutput getAsRecordOutput(java.lang.String slotName)
slotName - The slot nameRecordOutput with given slot namepublic void commitAll()
throws ObjectStoreException,
java.io.IOException
ObjectStoreExceptionjava.io.IOExceptionpublic void abortAll()
throws ObjectStoreException,
java.io.IOException
ObjectStoreExceptionjava.io.IOExceptionpublic void addOutputCounters(java.util.Map<java.lang.String,java.lang.Number> counters)
protected boolean isMultiple(java.lang.String slotName)
protected boolean canCreate(java.lang.String slotName,
int index)
IODataObjectscanCreate in class IODataObjectspublic BulkInfo getDataObject(java.lang.String slotName, int index)
getDataObject in class IODataObjects