public class MultiSinkTap<Child extends Tap,Config,Output> extends SinkTap<Config,Output> implements CompositeTap<Child>
CompositeTap
and SinkTap
that can write to
multiple child Tap
instances simultaneously.
It is the counterpart to MultiSourceTap
.
Note all child Tap instances may or may not have the same declared Fields. In the case they do not, all
sink fields will be merged into a single Fields instance via Fields.merge(cascading.tuple.Fields...)
.Constructor and Description |
---|
MultiSinkTap(Child... taps)
Constructor MultiSinkTap creates a new MultiSinkTap instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
commitResource(Config conf)
Method commitResource allows the underlying resource to be notified when all write processing is
successful so that any additional cleanup or processing may be completed.
|
boolean |
createResource(Config conf)
Method createResource creates the underlying resource.
|
boolean |
deleteResource(Config conf)
Method deleteResource deletes the resource represented by this instance.
|
boolean |
equals(Object o) |
Iterator<Child> |
getChildTaps() |
String |
getIdentifier()
Method getIdentifier returns a String representing the resource this Tap instance represents.
|
long |
getModifiedTime(Config conf)
Method getModifiedTime returns the date this resource was last modified.
|
long |
getNumChildTaps() |
Scheme |
getScheme()
Method getScheme returns the scheme of this Tap object.
|
protected Child[] |
getTaps() |
int |
hashCode() |
TupleEntryCollector |
openForWrite(FlowProcess<? extends Config> flowProcess,
Output output)
Method openForWrite opens the resource represented by this Tap instance for writing.
|
void |
presentSinkFields(FlowProcess<? extends Config> flowProcess,
Fields fields) |
boolean |
resourceExists(Config conf)
Method resourceExists returns true if the path represented by this instance exists.
|
boolean |
rollbackResource(Config conf)
Method rollbackResource allows the underlying resource to be notified when any write processing has failed or
was stopped so that any cleanup may be started.
|
void |
sinkConfInit(FlowProcess<? extends Config> flowProcess,
Config conf)
Method sinkConfInit initializes this instance as a sink.
|
String |
toString() |
getSourceFields, isSource, openForRead, prepareResourceForRead, sourceConfInit
createResource, deleteResource, flowConfInit, getConfigDef, getFullIdentifier, getFullIdentifier, getModifiedTime, getNodeConfigDef, getSinkFields, getSinkMode, getStepConfigDef, getTrace, hasConfigDef, hasNodeConfigDef, hasStepConfigDef, id, isKeep, isReplace, isSink, isTemporary, isUpdate, openForRead, openForWrite, outgoingScopeFor, prepareResourceForWrite, presentSourceFields, resolveIncomingOperationArgumentFields, resolveIncomingOperationPassThroughFields, resourceExists, retrieveSinkFields, retrieveSourceFields, setScheme, taps
@ConstructorProperties(value="taps") public MultiSinkTap(Child... taps)
taps
- of type Tap...public Iterator<Child> getChildTaps()
getChildTaps
in interface CompositeTap<Child extends Tap>
public long getNumChildTaps()
getNumChildTaps
in interface CompositeTap<Child extends Tap>
public String getIdentifier()
Tap
getIdentifier
in class Tap<Config,Void,Output>
public void presentSinkFields(FlowProcess<? extends Config> flowProcess, Fields fields)
presentSinkFields
in class Tap<Config,Void,Output>
public TupleEntryCollector openForWrite(FlowProcess<? extends Config> flowProcess, Output output) throws IOException
Tap
SinkMode
setting. If SinkMode is
SinkMode.REPLACE
, this call may fail. See Tap.openForWrite(cascading.flow.FlowProcess)
.
output
value may be null, if so, sub-classes must inquire with the underlying Scheme
via Scheme.sinkConfInit(cascading.flow.FlowProcess, Tap, Object)
to get the proper
output type and instantiate it before calling super.openForWrite()
.openForWrite
in class Tap<Config,Void,Output>
flowProcess
- of type FlowProcessoutput
- of type OutputIOException
- when the resource cannot be openedpublic void sinkConfInit(FlowProcess<? extends Config> flowProcess, Config conf)
Tap
Flow
instance or if it participates in multiple times in a given Flow or across different Flows in
a Cascade
.
Note this method will be called in context of this Tap being used as a traditional 'sink' and as a 'trap'.
In the context of a Flow, it will be called after
FlowListener.onStarting(cascading.flow.Flow)
Note that no resources or services should be modified by this method. If this Tap instance returns true for
Tap.isReplace()
, then Tap.deleteResource(Object)
will be called by the parent Flow.sinkConfInit
in class Tap<Config,Void,Output>
flowProcess
- of type FlowProcessconf
- of type Configpublic boolean createResource(Config conf) throws IOException
Tap
createResource
in class Tap<Config,Void,Output>
conf
- of type ConfigIOException
- when there is an error making directoriespublic boolean deleteResource(Config conf) throws IOException
Tap
deleteResource
in class Tap<Config,Void,Output>
conf
- of type ConfigIOException
- when the resource cannot be deletedpublic boolean commitResource(Config conf) throws IOException
Tap
Tap.rollbackResource(Object)
to handle cleanup in the face of failures.
This method is invoked once client side and not in the cluster, if any.
If other sink Tap instance in a given Flow fail on commitResource after called on this instance,
rollbackResource will not be called.commitResource
in class Tap<Config,Void,Output>
conf
- of type ConfigIOException
public boolean rollbackResource(Config conf) throws IOException
Tap
Tap.commitResource(Object)
to handle cleanup when the write has successfully completed.
This method is invoked once client side and not in the cluster, if any.rollbackResource
in class Tap<Config,Void,Output>
conf
- of type ConfigIOException
public boolean resourceExists(Config conf) throws IOException
Tap
resourceExists
in class Tap<Config,Void,Output>
conf
- of type ConfigIOException
- when the status cannot be determinedpublic long getModifiedTime(Config conf) throws IOException
Tap
getModifiedTime
in class Tap<Config,Void,Output>
conf
- of type ConfigIOException
public Scheme getScheme()
Tap
Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.