|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcascading.tap.Tap<Properties,InputStream,OutputStream>
cascading.tap.local.FileTap
public class FileTap
Class FileTap is a Tap
sub-class that allows for direct local file access.
LocalFlowConnector
to create
Flow
instances that run in "local" mode.
Constructor Summary | |
---|---|
FileTap(Scheme<Properties,InputStream,OutputStream,?,?> scheme,
String path)
Constructor FileTap creates a new FileTap instance using the given Scheme and file path . |
|
FileTap(Scheme<Properties,InputStream,OutputStream,?,?> scheme,
String path,
SinkMode sinkMode)
Constructor FileTap creates a new FileTap instance using the given Scheme ,
file path , and SinkMode . |
Method Summary | |
---|---|
boolean |
commitResource(Properties 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(Properties conf)
Method createResource creates the underlying resource. |
boolean |
deleteResource(Properties conf)
Method deleteResource deletes the resource represented by this instance. |
String |
getIdentifier()
Method getIdentifier returns a String representing the resource this Tap instance represents. |
long |
getModifiedTime(Properties conf)
Method getModifiedTime returns the date this resource was last modified. |
long |
getSize(Properties conf)
Method getSize returns the size of the file referenced by this tap. |
TupleEntryIterator |
openForRead(FlowProcess<Properties> flowProcess,
InputStream input)
Method openForRead opens the resource represented by this Tap instance for reading. |
TupleEntryCollector |
openForWrite(FlowProcess<Properties> flowProcess,
OutputStream output)
Method openForWrite opens the resource represented by this Tap instance for writing. |
boolean |
resourceExists(Properties conf)
Method resourceExists returns true if the path represented by this instance exists. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileTap(Scheme<Properties,InputStream,OutputStream,?,?> scheme, String path)
Scheme
and file path
.
scheme
- of type LocalSchemepath
- of type Stringpublic FileTap(Scheme<Properties,InputStream,OutputStream,?,?> scheme, String path, SinkMode sinkMode)
Scheme
,
file path
, and SinkMode
.
scheme
- of type LocalSchemepath
- of type StringsinkMode
- of type SinkModeMethod Detail |
---|
public String getIdentifier()
Tap
getIdentifier
in class Tap<Properties,InputStream,OutputStream>
public TupleEntryIterator openForRead(FlowProcess<Properties> flowProcess, InputStream input) throws IOException
Tap
input
value may be null, if so, sub-classes must inquire with the underlying Scheme
via Scheme.sourceConfInit(cascading.flow.FlowProcess, Tap, Object)
to get the proper
input type and instantiate it before calling super.openForRead()
.
Note the returned iterator will return the same instance of TupleEntry
on every call,
thus a copy must be made of either the TupleEntry or the underlying Tuple
instance if they are to be
stored in a Collection.
openForRead
in class Tap<Properties,InputStream,OutputStream>
flowProcess
- of type FlowProcessinput
- of type Input
IOException
- when the resource cannot be openedpublic TupleEntryCollector openForWrite(FlowProcess<Properties> flowProcess, OutputStream 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<Properties,InputStream,OutputStream>
flowProcess
- of type FlowProcessoutput
- of type Output
IOException
- when the resource cannot be openedpublic long getSize(Properties conf) throws IOException
conf
- of type Properties
IOException
public boolean createResource(Properties conf) throws IOException
Tap
createResource
in class Tap<Properties,InputStream,OutputStream>
conf
- of type Config
IOException
- when there is an error making directoriespublic boolean deleteResource(Properties conf) throws IOException
Tap
deleteResource
in class Tap<Properties,InputStream,OutputStream>
conf
- of type Config
IOException
- when the resource cannot be deletedpublic boolean commitResource(Properties 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<Properties,InputStream,OutputStream>
conf
- of type Config
IOException
public boolean resourceExists(Properties conf) throws IOException
Tap
resourceExists
in class Tap<Properties,InputStream,OutputStream>
conf
- of type Config
IOException
- when the status cannot be determinedpublic long getModifiedTime(Properties conf) throws IOException
Tap
getModifiedTime
in class Tap<Properties,InputStream,OutputStream>
conf
- of type Config
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |