org.apache.hadoop.hbase.rest.model
Class ScannerModel

java.lang.Object
  extended by org.apache.hadoop.hbase.rest.model.ScannerModel
All Implemented Interfaces:
Serializable, ProtobufMessageHandler

public class ScannerModel
extends Object
implements ProtobufMessageHandler, Serializable

A representation of Scanner parameters.

 <complexType name="Scanner">
   <sequence>
     <element name="column" type="base64Binary" minOccurs="0" maxOccurs="unbounded"/>
   </sequence>
   <element name="filter" type="string" minOccurs="0" maxOccurs="1"></element>
   <attribute name="startRow" type="base64Binary"></attribute>
   <attribute name="endRow" type="base64Binary"></attribute>
   <attribute name="batch" type="int"></attribute>
   <attribute name="startTime" type="int"></attribute>
   <attribute name="endTime" type="int"></attribute>
   <attribute name="maxVersions" type="int"></attribute>
 </complexType>
 

See Also:
Serialized Form

Constructor Summary
ScannerModel()
          Default constructor
ScannerModel(byte[] startRow, byte[] endRow, List<byte[]> columns, int batch, long endTime, int maxVersions, String filter)
          Constructor
ScannerModel(byte[] startRow, byte[] endRow, List<byte[]> columns, int batch, long startTime, long endTime, String filter)
          Constructor
 
Method Summary
 void addColumn(byte[] column)
          Add a column to the column set
static Filter buildFilter(String s)
           
 byte[] createProtobufOutput()
           
static ScannerModel fromScan(Scan scan)
           
 int getBatch()
           
 List<byte[]> getColumns()
           
 byte[] getEndRow()
           
 long getEndTime()
           
 String getFilter()
           
 int getMaxVersions()
           
 ProtobufMessageHandler getObjectFromMessage(byte[] message)
          Initialize the model from a protobuf representation.
 byte[] getStartRow()
           
 long getStartTime()
           
 boolean hasEndRow()
           
 boolean hasStartRow()
           
 void setBatch(int batch)
           
 void setColumns(List<byte[]> columns)
           
 void setEndRow(byte[] endRow)
           
 void setEndTime(long endTime)
           
 void setFilter(String filter)
           
 void setMaxVersions(int maxVersions)
           
 void setStartRow(byte[] startRow)
           
 void setStartTime(long startTime)
           
static String stringifyFilter(Filter filter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScannerModel

public ScannerModel()
Default constructor


ScannerModel

public ScannerModel(byte[] startRow,
                    byte[] endRow,
                    List<byte[]> columns,
                    int batch,
                    long endTime,
                    int maxVersions,
                    String filter)
Constructor

Parameters:
startRow - the start key of the row-range
endRow - the end key of the row-range
columns - the columns to scan
batch - the number of values to return in batch
endTime - the upper bound on timestamps of values of interest
maxVersions - the maximum number of versions to return
filter - a filter specification (values with timestamps later than this are excluded)

ScannerModel

public ScannerModel(byte[] startRow,
                    byte[] endRow,
                    List<byte[]> columns,
                    int batch,
                    long startTime,
                    long endTime,
                    String filter)
Constructor

Parameters:
startRow - the start key of the row-range
endRow - the end key of the row-range
columns - the columns to scan
batch - the number of values to return in batch
startTime - the lower bound on timestamps of values of interest (values with timestamps earlier than this are excluded)
endTime - the upper bound on timestamps of values of interest (values with timestamps later than this are excluded)
filter - a filter specification
Method Detail

buildFilter

public static Filter buildFilter(String s)
                          throws Exception
Parameters:
s - the JSON representation of the filter
Returns:
the filter
Throws:
Exception

stringifyFilter

public static String stringifyFilter(Filter filter)
                              throws Exception
Parameters:
filter - the filter
Returns:
the JSON representation of the filter
Throws:
Exception

fromScan

public static ScannerModel fromScan(Scan scan)
                             throws Exception
Parameters:
scan - the scan specification
Throws:
Exception

addColumn

public void addColumn(byte[] column)
Add a column to the column set

Parameters:
column - the column name, as <column>(:<qualifier>)?

hasStartRow

public boolean hasStartRow()
Returns:
true if a start row was specified

getStartRow

public byte[] getStartRow()
Returns:
start row

hasEndRow

public boolean hasEndRow()
Returns:
true if an end row was specified

getEndRow

public byte[] getEndRow()
Returns:
end row

getColumns

public List<byte[]> getColumns()
Returns:
list of columns of interest in column:qualifier format, or empty for all

getBatch

public int getBatch()
Returns:
the number of cells to return in batch

getStartTime

public long getStartTime()
Returns:
the lower bound on timestamps of items of interest

getEndTime

public long getEndTime()
Returns:
the upper bound on timestamps of items of interest

getMaxVersions

public int getMaxVersions()
Returns:
maximum number of versions to return

getFilter

public String getFilter()
Returns:
the filter specification

setStartRow

public void setStartRow(byte[] startRow)
Parameters:
startRow - start row

setEndRow

public void setEndRow(byte[] endRow)
Parameters:
endRow - end row

setColumns

public void setColumns(List<byte[]> columns)
Parameters:
columns - list of columns of interest in column:qualifier format, or empty for all

setBatch

public void setBatch(int batch)
Parameters:
batch - the number of cells to return in batch

setMaxVersions

public void setMaxVersions(int maxVersions)
Parameters:
maxVersions - maximum number of versions to return

setStartTime

public void setStartTime(long startTime)
Parameters:
startTime - the lower bound on timestamps of values of interest

setEndTime

public void setEndTime(long endTime)
Parameters:
endTime - the upper bound on timestamps of values of interest

setFilter

public void setFilter(String filter)
Parameters:
filter - the filter specification

createProtobufOutput

public byte[] createProtobufOutput()
Specified by:
createProtobufOutput in interface ProtobufMessageHandler
Returns:
the protobuf represention of the model

getObjectFromMessage

public ProtobufMessageHandler getObjectFromMessage(byte[] message)
                                            throws IOException
Description copied from interface: ProtobufMessageHandler
Initialize the model from a protobuf representation.

Specified by:
getObjectFromMessage in interface ProtobufMessageHandler
Parameters:
message - the raw bytes of the protobuf message
Returns:
reference to self for convenience
Throws:
IOException


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.