@InterfaceAudience.Private public class MetaBrowser extends Object
 Support class for the "Meta Entries" section in resources/hbase-webapps/master/table.jsp.
 
 Interface. This class's intended consumer is table.jsp. As such, it's primary
 interface is the active HttpServletRequest, from which it uses the scan_*
 request parameters. This class supports paging through an optionally filtered view of the
 contents of hbase:meta. Those filters and the pagination offset are specified via these
 request parameters. It provides helper methods for constructing pagination links.
 
hbase:meta; any other value is effectively ignored by the giant conditional in the
   jsp.RegionReplicaInfo objects produced by MetaBrowser.Results.iterator(). When a
   value for scan_limit is invalid or not specified, the default value of
   10 is used. In order to avoid excessive resource consumption, a
   maximum value of 10000 is enforced.RegionState.Scan, so in effect it can be used for simple namespace and multi-table matches.
 Pagination. A single page of results are made available via getResults() / an
 instance of MetaBrowser.Results. Callers use its Iterator consume the page of
 RegionReplicaInfo instances, each of which represents a region or region replica. Helper
 methods are provided for building page navigation controls preserving the user's selected filter
 set: buildFirstPageUrl(), buildNextPageUrl(byte[]). Pagination is implemented
 using a simple offset + limit system. Offset is provided by the "scan_start",
 limit via "scan_limit". Under the hood, the Scan is constructed with
 Scan.setMaxResultSize(long) set to ("scan_limit" +1), while the
 MetaBrowser.Results Iterator honors "scan_limit". The +1 allows the caller to
 know if a "next page" is available via MetaBrowser.Results.hasMoreResults(). Note that this
 pagination strategy is incomplete when it comes to region replicas and can potentially omit
 rendering replicas that fall between the last rowkey offset and replicaCount % page size.
 
 Error Messages. Any time there's an error parsing user input, a message will be populated
 in getErrorMessages(). Any fields which produce an error will have their filter values
 set to the default, except for a value of "scan_limit" that exceeds
 10000, in which case 10000 is used.
 
| Modifier and Type | Class and Description | 
|---|---|
| class  | MetaBrowser.ResultsEncapsulates the results produced by this  MetaBrowserinstance. | 
| Modifier and Type | Field and Description | 
|---|---|
| private AsyncConnection | connection | 
| private List<String> | errorMessages | 
| private String | name | 
| static String | NAME_PARAM | 
| private javax.servlet.http.HttpServletRequest | request | 
| static int | SCAN_LIMIT_DEFAULT | 
| static int | SCAN_LIMIT_MAX | 
| static String | SCAN_LIMIT_PARAM | 
| static String | SCAN_REGION_STATE_PARAM | 
| static String | SCAN_START_PARAM | 
| static String | SCAN_TABLE_PARAM | 
| private Integer | scanLimit | 
| private RegionState.State | scanRegionState | 
| private byte[] | scanStart | 
| private TableName | scanTable | 
| Constructor and Description | 
|---|
| MetaBrowser(AsyncConnection connection,
           javax.servlet.http.HttpServletRequest request) | 
| Modifier and Type | Method and Description | 
|---|---|
| private void | addParam(org.apache.hbase.thirdparty.io.netty.handler.codec.http.QueryStringEncoder encoder,
        String paramName,
        Object value)Adds  valuetoencoderunderparamNamewhenvalueis non-null. | 
| private org.apache.hbase.thirdparty.io.netty.handler.codec.http.QueryStringEncoder | buildFirstPageEncoder() | 
| String | buildFirstPageUrl() | 
| String | buildNextPageUrl(byte[] lastRow) | 
| private Scan | buildScan() | 
| private Filter | buildScanFilter() | 
| private static String | buildScanLimitExceededErrorMessage(int requestValue) | 
| private static String | buildScanLimitLTEQZero(int requestValue) | 
| private static String | buildScanLimitMalformedErrorMessage(String requestValue) | 
| private static Filter | buildScanRegionStateFilter(RegionState.State state) | 
| private static String | buildScanRegionStateMalformedErrorMessage(String requestValue) | 
| (package private) static String | buildStartParamFrom(byte[] lastRow) | 
| private static Filter | buildTableFilter(TableName tableName) | 
| List<String> | getErrorMessages() | 
| String | getName() | 
| MetaBrowser.Results | getResults() | 
| Integer | getScanLimit() | 
| RegionState.State | getScanRegionState() | 
| byte[] | getScanStart() | 
| TableName | getScanTable() | 
| private static String | resolveName(javax.servlet.http.HttpServletRequest request) | 
| private static String | resolveRequestParameter(javax.servlet.http.HttpServletRequest request,
                       String param) | 
| private Integer | resolveScanLimit(javax.servlet.http.HttpServletRequest request) | 
| private RegionState.State | resolveScanRegionState(javax.servlet.http.HttpServletRequest request) | 
| private static byte[] | resolveScanStart(javax.servlet.http.HttpServletRequest request) | 
| private static TableName | resolveScanTable(javax.servlet.http.HttpServletRequest request) | 
| String | toString() | 
| private static Integer | tryParseInt(String val) | 
| private static <T extends Enum<T>> | tryValueOf(Class<T> clazz,
          String value) | 
| private static String | urlDecode(String val) | 
| private static String | urlEncode(String val) | 
public static final String NAME_PARAM
public static final String SCAN_LIMIT_PARAM
public static final String SCAN_REGION_STATE_PARAM
public static final String SCAN_START_PARAM
public static final String SCAN_TABLE_PARAM
public static final int SCAN_LIMIT_DEFAULT
public static final int SCAN_LIMIT_MAX
private final AsyncConnection connection
private final javax.servlet.http.HttpServletRequest request
private final List<String> errorMessages
private final RegionState.State scanRegionState
private final byte[] scanStart
public MetaBrowser(AsyncConnection connection, javax.servlet.http.HttpServletRequest request)
public List<String> getErrorMessages()
public Integer getScanLimit()
public byte[] getScanStart()
public RegionState.State getScanRegionState()
public TableName getScanTable()
public MetaBrowser.Results getResults()
private static String resolveName(javax.servlet.http.HttpServletRequest request)
private Integer resolveScanLimit(javax.servlet.http.HttpServletRequest request)
private RegionState.State resolveScanRegionState(javax.servlet.http.HttpServletRequest request)
private static byte[] resolveScanStart(javax.servlet.http.HttpServletRequest request)
private static TableName resolveScanTable(javax.servlet.http.HttpServletRequest request)
private static String resolveRequestParameter(javax.servlet.http.HttpServletRequest request, String param)
private static Filter buildTableFilter(TableName tableName)
private static Filter buildScanRegionStateFilter(RegionState.State state)
private Filter buildScanFilter()
private void addParam(org.apache.hbase.thirdparty.io.netty.handler.codec.http.QueryStringEncoder encoder, String paramName, Object value)
value to encoder under paramName when value is non-null.private org.apache.hbase.thirdparty.io.netty.handler.codec.http.QueryStringEncoder buildFirstPageEncoder()
public String buildFirstPageUrl()
static String buildStartParamFrom(byte[] lastRow)
public String buildNextPageUrl(byte[] lastRow)
private static Integer tryParseInt(String val)
private static <T extends Enum<T>> T tryValueOf(Class<T> clazz, String value)
private static String buildScanLimitExceededErrorMessage(int requestValue)
private static String buildScanLimitMalformedErrorMessage(String requestValue)
private static String buildScanLimitLTEQZero(int requestValue)
private static String buildScanRegionStateMalformedErrorMessage(String requestValue)
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.