org.apache.hadoop.hbase.protobuf
Class ResponseConverter

java.lang.Object
  extended by org.apache.hadoop.hbase.protobuf.ResponseConverter

@InterfaceAudience.Private
public final class ResponseConverter
extends Object

Helper utility to build protocol buffer responses, or retrieve data from protocol buffer responses.


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Method Summary
static ClientProtos.ActionResult buildActionResult(Throwable t)
          Wrap a throwable to an action result.
static MasterAdminProtos.CatalogScanResponse buildCatalogScanResponse(int numCleaned)
          Creates a response for the catalog scan request
static MasterAdminProtos.EnableCatalogJanitorResponse buildEnableCatalogJanitorResponse(boolean prevValue)
          Creates a response for the catalog scan request
static RegionServerStatusProtos.GetLastFlushedSequenceIdResponse buildGetLastFlushedSequenceIdResponse(long seqId)
          Creates a response for the last flushed sequence Id request
static AdminProtos.GetOnlineRegionResponse buildGetOnlineRegionResponse(List<HRegionInfo> regions)
          A utility to build a GetOnlineRegionResponse.
static AdminProtos.GetServerInfoResponse buildGetServerInfoResponse(ServerName serverName, int webuiPort)
          A utility to build a GetServerInfoResponse.
static AccessControlProtos.UserPermissionsResponse buildUserPermissionsResponse(List<UserPermission> permissions)
          Converts the permissions list into a protocol buffer UserPermissionsResponse
static List<HRegionInfo> getRegionInfos(AdminProtos.GetOnlineRegionResponse proto)
          Get the list of region info from a GetOnlineRegionResponse
static RegionOpeningState getRegionOpeningState(AdminProtos.OpenRegionResponse proto)
          Get the region opening state from a OpenRegionResponse
static List<RegionOpeningState> getRegionOpeningStateList(AdminProtos.OpenRegionResponse proto)
          Get a list of region opening state from a OpenRegionResponse
static byte[][] getRegions(AdminProtos.RollWALWriterResponse proto)
          Get the list of regions to flush from a RollLogWriterResponse
static Result[] getResults(CellScanner cellScanner, ClientProtos.ScanResponse response)
          Create Results from the cells using the cells meta data.
static List<Object> getResults(ClientProtos.MultiResponse proto, CellScanner cells)
          Get the results from a protocol buffer MultiResponse
static boolean isClosed(AdminProtos.CloseRegionResponse proto)
          Check if the region is closed from a CloseRegionResponse
static void setControllerException(com.google.protobuf.RpcController controller, IOException ioe)
          Stores an exception encountered during RPC invocation so it can be passed back through to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Method Detail

getResults

public static List<Object> getResults(ClientProtos.MultiResponse proto,
                                      CellScanner cells)
                               throws IOException
Get the results from a protocol buffer MultiResponse

Parameters:
proto - the protocol buffer MultiResponse to convert
cells - Cells to go with the passed in proto. Can be null.
Returns:
the results that were in the MultiResponse (a Result or an Exception).
Throws:
IOException

buildActionResult

public static ClientProtos.ActionResult buildActionResult(Throwable t)
Wrap a throwable to an action result.

Parameters:
t -
Returns:
an action result

buildUserPermissionsResponse

public static AccessControlProtos.UserPermissionsResponse buildUserPermissionsResponse(List<UserPermission> permissions)
Converts the permissions list into a protocol buffer UserPermissionsResponse


getRegions

public static byte[][] getRegions(AdminProtos.RollWALWriterResponse proto)
Get the list of regions to flush from a RollLogWriterResponse

Parameters:
proto - the RollLogWriterResponse
Returns:
the the list of regions to flush

getRegionInfos

public static List<HRegionInfo> getRegionInfos(AdminProtos.GetOnlineRegionResponse proto)
Get the list of region info from a GetOnlineRegionResponse

Parameters:
proto - the GetOnlineRegionResponse
Returns:
the list of region info

getRegionOpeningState

public static RegionOpeningState getRegionOpeningState(AdminProtos.OpenRegionResponse proto)
Get the region opening state from a OpenRegionResponse

Parameters:
proto - the OpenRegionResponse
Returns:
the region opening state

getRegionOpeningStateList

public static List<RegionOpeningState> getRegionOpeningStateList(AdminProtos.OpenRegionResponse proto)
Get a list of region opening state from a OpenRegionResponse

Parameters:
proto - the OpenRegionResponse
Returns:
the list of region opening state

isClosed

public static boolean isClosed(AdminProtos.CloseRegionResponse proto)
Check if the region is closed from a CloseRegionResponse

Parameters:
proto - the CloseRegionResponse
Returns:
the region close state

buildGetServerInfoResponse

public static AdminProtos.GetServerInfoResponse buildGetServerInfoResponse(ServerName serverName,
                                                                           int webuiPort)
A utility to build a GetServerInfoResponse.

Parameters:
serverName -
webuiPort -
Returns:
the response

buildGetOnlineRegionResponse

public static AdminProtos.GetOnlineRegionResponse buildGetOnlineRegionResponse(List<HRegionInfo> regions)
A utility to build a GetOnlineRegionResponse.

Parameters:
regions -
Returns:
the response

buildCatalogScanResponse

public static MasterAdminProtos.CatalogScanResponse buildCatalogScanResponse(int numCleaned)
Creates a response for the catalog scan request

Returns:
A CatalogScanResponse

buildEnableCatalogJanitorResponse

public static MasterAdminProtos.EnableCatalogJanitorResponse buildEnableCatalogJanitorResponse(boolean prevValue)
Creates a response for the catalog scan request

Returns:
A EnableCatalogJanitorResponse

buildGetLastFlushedSequenceIdResponse

public static RegionServerStatusProtos.GetLastFlushedSequenceIdResponse buildGetLastFlushedSequenceIdResponse(long seqId)
Creates a response for the last flushed sequence Id request

Returns:
A GetLastFlushedSequenceIdResponse

setControllerException

public static void setControllerException(com.google.protobuf.RpcController controller,
                                          IOException ioe)
Stores an exception encountered during RPC invocation so it can be passed back through to the client.

Parameters:
controller - the controller instance provided by the client when calling the service
ioe - the exception encountered

getResults

public static Result[] getResults(CellScanner cellScanner,
                                  ClientProtos.ScanResponse response)
                           throws IOException
Create Results from the cells using the cells meta data.

Parameters:
cellScanner -
response -
Returns:
results
Throws:
IOException


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