MCPcopy Create free account
hub / github.com/apache/pig / StoreFuncWrapper

Class StoreFuncWrapper

src/org/apache/pig/StoreFuncWrapper.java:35–122  ·  view source on GitHub ↗

Convenience class to extend when decorating a StoreFunc. It's not abstract so that it will fail to compile if new methods get added to StoreFuncInterface. Subclasses must call the setStoreFunc with an instance of StoreFuncInterface before other methods can be called. Not doing so will result in an I

Source from the content-addressed store, hash-verified

33 * result in an IllegalArgumentException when the method is called.
34 */
35public class StoreFuncWrapper implements StoreFuncInterface {
36
37 private StoreFuncInterface storeFunc;
38
39 protected StoreFuncWrapper() {}
40
41 /**
42 * The wrapped StoreFuncInterface object must be set before method calls are made on this object.
43 * Typically, this is done with via constructor, but often times the wrapped object can
44 * not be properly initialized until later in the lifecycle of the wrapper object.
45 * @param storeFunc
46 */
47 protected void setStoreFunc(StoreFuncInterface storeFunc) {
48 this.storeFunc = storeFunc;
49 }
50
51 @Override
52 public String relToAbsPathForStoreLocation(String location, Path path) throws IOException {
53 return storeFunc().relToAbsPathForStoreLocation(location, path);
54 }
55
56 @Override
57 public OutputFormat getOutputFormat() throws IOException {
58 return storeFunc().getOutputFormat();
59 }
60
61 @Override
62 public void setStoreLocation(String location, Job job) throws IOException {
63 storeFunc().setStoreLocation(location, job);
64 }
65
66 @Override
67 public void checkSchema(ResourceSchema resourceSchema) throws IOException {
68 storeFunc().checkSchema(resourceSchema);
69 }
70
71 @Override
72 public void prepareToWrite(RecordWriter recordWriter) throws IOException {
73 storeFunc().prepareToWrite(recordWriter);
74 }
75
76 @Override
77 public void putNext(Tuple tuple) throws IOException {
78 storeFunc().putNext(tuple);
79 }
80
81 @Override
82 public void setStoreFuncUDFContextSignature(String signature) {
83 storeFunc().setStoreFuncUDFContextSignature(signature);
84 }
85
86 @Override
87 public void cleanupOnFailure(String location, Job job) throws IOException {
88 storeFunc().cleanupOnFailure(location, job);
89 }
90
91 @Override
92 public void cleanupOnSuccess(String location, Job job) throws IOException {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected