org.apache.lens.lib.query
Class AbstractFileFormatter

java.lang.Object
  extended by org.apache.lens.lib.query.AbstractOutputFormatter
      extended by org.apache.lens.lib.query.AbstractFileFormatter
All Implemented Interfaces:
FileFormatter, QueryOutputFormatter
Direct Known Subclasses:
HadoopFileFormatter, ZipFileFormatter

public abstract class AbstractFileFormatter
extends AbstractOutputFormatter
implements FileFormatter

Abstract implementation of FileFormatter, which gets column details from AbstractOutputFormatter.


Field Summary
 
Fields inherited from class org.apache.lens.lib.query.AbstractOutputFormatter
HEADER_TYPE
 
Constructor Summary
AbstractFileFormatter()
           
 
Method Summary
 String getFinalOutputPath()
          Get final location where formatted output is available
 int getNumRows()
          Get total number of rows in result.
 void init(QueryContext ctx, LensResultSetMetadata metadata)
          Initialize the formatter.
 void writeFooter()
          Write the footer.
 void writeHeader()
          Write the header.
 
Methods inherited from class org.apache.lens.lib.query.AbstractOutputFormatter
getMetadata
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.lens.lib.query.FileFormatter
getEncoding, getTmpPath, setupOutputs, writeFooter, writeHeader, writeRow
 
Methods inherited from interface org.apache.lens.server.api.query.QueryOutputFormatter
close, commit
 

Constructor Detail

AbstractFileFormatter

public AbstractFileFormatter()
Method Detail

init

public void init(QueryContext ctx,
                 LensResultSetMetadata metadata)
          throws IOException
Description copied from interface: QueryOutputFormatter
Initialize the formatter.

Specified by:
init in interface QueryOutputFormatter
Overrides:
init in class AbstractOutputFormatter
Parameters:
ctx - The QueryContext object
metadata - LensResultSetMetadata object
Throws:
IOException - Signals that an I/O exception has occurred.

getNumRows

public int getNumRows()
Description copied from interface: QueryOutputFormatter
Get total number of rows in result.

Specified by:
getNumRows in interface QueryOutputFormatter
Returns:
Total number of rows, return -1, if not known

writeHeader

public void writeHeader()
                 throws IOException
Description copied from interface: QueryOutputFormatter
Write the header.

Specified by:
writeHeader in interface QueryOutputFormatter
Throws:
IOException - Signals that an I/O exception has occurred.

writeFooter

public void writeFooter()
                 throws IOException
Description copied from interface: QueryOutputFormatter
Write the footer.

Specified by:
writeFooter in interface QueryOutputFormatter
Throws:
IOException - Signals that an I/O exception has occurred.

getFinalOutputPath

public String getFinalOutputPath()
Description copied from interface: QueryOutputFormatter
Get final location where formatted output is available

Specified by:
getFinalOutputPath in interface QueryOutputFormatter
Returns:


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.