Class ScannerModel

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

@Private 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"/>
     <element name="filter" type="string" minOccurs="0" maxOccurs="1"></element>
   </sequence>
   <attribute name="startRow" type="base64Binary"></attribute>
   <attribute name="endRow" type="base64Binary"></attribute>
   <attribute name="batch" type="int"></attribute>
   <attribute name="caching" type="int"></attribute>
   <attribute name="startTime" type="int"></attribute>
   <attribute name="endTime" type="int"></attribute>
   <attribute name="maxVersions" type="int"></attribute>
 </complexType>
 
See Also:
  • Field Details

  • Constructor Details

    • ScannerModel

      public ScannerModel()
      Default constructor
    • ScannerModel

      public ScannerModel(byte[] startRow, byte[] endRow, List<byte[]> columns, int batch, int caching, 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
      caching - the number of rows that the scanner will fetch at once
      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, int caching, 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
      caching - the number of rows that the scanner will fetch at once
      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 Details

    • getJasonProvider

      private static org.apache.hbase.thirdparty.com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider getJasonProvider()
      Get the JacksonJaxbJsonProvider instance;
      Returns:
      A JacksonJaxbJsonProvider.
    • 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>)?
    • addLabel

      public void addLabel(String label)
      Add a visibility label to the scan
    • 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
    • getLabels

      public List<String> getLabels()
    • getBatch

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

      public int getCaching()
      Returns the number of rows that the scanner to fetch at once
    • getLimit

      public int getLimit()
      Returns the limit specification
    • getCacheBlocks

      public boolean getCacheBlocks()
      Returns true if HFile blocks should be cached on the servers for this scan, false otherwise
    • 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
    • setCaching

      public void setCaching(int caching)
      Parameters:
      caching - the number of rows to fetch at once
    • setCacheBlocks

      public void setCacheBlocks(boolean value)
      Parameters:
      value - true if HFile blocks should be cached on the servers for this scan, false otherwise
    • setLimit

      public void setLimit(int limit)
      Parameters:
      limit - the number of rows can fetch of each scanner at lifetime
    • 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
    • messageFromObject

      public org.apache.hbase.thirdparty.com.google.protobuf.Message messageFromObject()
      Description copied from interface: ProtobufMessageHandler
      Convert to model to a protobuf Message object
      Specified by:
      messageFromObject in interface ProtobufMessageHandler
      Returns:
      the protobuf Message object
    • getObjectFromMessage

      public ProtobufMessageHandler getObjectFromMessage(org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream cis) throws IOException
      Specified by:
      getObjectFromMessage in interface ProtobufMessageHandler
      Throws:
      IOException