org.apache.hadoop.hbase.protobuf
Class ProtobufUtil

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

@InterfaceAudience.Private
public final class ProtobufUtil
extends Object

Protobufs utility.


Field Summary
static byte[] PB_MAGIC
          Magic we put ahead of a serialized protobuf message.
 
Method Summary
static boolean bulkLoadHFile(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, List<Pair<byte[],String>> familyPaths, byte[] regionName, boolean assignSeqNum)
          A helper to bulk load a list of HFiles using client protocol.
static boolean bulkLoadHFile(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, List<Pair<byte[],String>> familyPaths, byte[] regionName, boolean assignSeqNum, PayloadCarryingRpcController controller)
          A helper to bulk load a list of HFiles using client protocol.
static void closeRegion(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, ServerName server, byte[] regionName, boolean transitionInZK)
          A helper to close a region given a region name using admin protocol.
static boolean closeRegion(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, ServerName server, byte[] regionName, int versionOfClosingNode, ServerName destinationServer, boolean transitionInZK)
          A helper to close a region given a region name using admin protocol.
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse execRegionServerService(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceCall call)
          Make a region server endpoint call
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse execService(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceCall call, byte[] regionName)
           
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse execService(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceCall call, byte[] regionName, PayloadCarryingRpcController controller)
           
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse execService(org.apache.hadoop.hbase.protobuf.generated.MasterProtos.MasterService.BlockingInterface client, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceCall call)
           
static void expectPBMagicPrefix(byte[] bytes)
           
static KeyValue.Type fromDeleteType(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.DeleteType type)
          Convert a protocol buffer DeleteType to delete KeyValue type.
static Result get(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, byte[] regionName, Get get)
          A helper to invoke a Get using client protocol.
static Result get(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, byte[] regionName, Get get, PayloadCarryingRpcController controller)
          A helper to invoke a Get using client protocol.
static HTableDescriptor[] getHTableDescriptorArray(org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetTableDescriptorsResponse proto)
          Get HTableDescriptor[] from GetTableDescriptorsResponse protobuf
static List<HRegionInfo> getOnlineRegions(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin)
          A helper to get the all the online regions on a region server using admin protocol.
static
<T extends com.google.protobuf.Message>
T
getParsedGenericInstance(Class<?> runtimeClass, int position, com.google.protobuf.ByteString b)
          Get an instance of the argument type declared in a class's signature.
static String getRegionEncodedName(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier regionSpecifier)
          Find the HRegion encoded name based on a region specifier
static HRegionInfo getRegionInfo(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, byte[] regionName)
          A helper to retrieve region info given a region name using admin protocol.
static IOException getRemoteException(com.google.protobuf.ServiceException se)
          Return the IOException thrown by the remote server wrapped in ServiceException as cause.
static Result getRowOrBefore(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, byte[] regionName, byte[] row, byte[] family)
          A helper to get a row of the closet one before using client protocol without setting any special (i.e.
static Result getRowOrBefore(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, byte[] regionName, byte[] row, byte[] family, PayloadCarryingRpcController payloadCarryingRpcController)
          A helper to get a row of the closet one before using client protocol.
static org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ServerInfo getServerInfo(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin)
          A helper to get the info of a region server using admin protocol.
static String getShortTextFormat(com.google.protobuf.Message m)
          Return short version of Message toString'd, shorter than TextFormat#shortDebugString.
static byte[][] getSplitKeysArray(org.apache.hadoop.hbase.protobuf.generated.MasterProtos.CreateTableRequest proto)
          get the split keys in form "byte [][]" from a CreateTableRequest proto
static List<String> getStoreFiles(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, byte[] regionName, byte[] family)
          A helper to get the list of files of a column family on a given region using admin protocol.
static TableName[] getTableNameArray(List<org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName> tableNamesList)
           
static long getTotalRequestsCount(org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad rl)
           
static List<UserPermission> getUserPermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol)
          A utility used to get user's global permissions.
static List<UserPermission> getUserPermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol, byte[] namespace)
          A utility used to get permissions for selected namespace.
static List<UserPermission> getUserPermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol, TableName t)
          A utility used to get user table permissions.
static org.apache.hadoop.hbase.protobuf.generated.RPCProtos.VersionInfo getVersionInfo()
          Get a protocol buffer VersionInfo
static void grant(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol, String userShortName, Permission.Action... actions)
          A utility used to grant a user global permissions.
static void grant(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol, String userShortName, String namespace, Permission.Action... actions)
          A utility used to grant a user namespace permissions.
static void grant(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol, String userShortName, TableName tableName, byte[] f, byte[] q, Permission.Action... actions)
          A utility used to grant a user table permissions.
static boolean isPBMagicPrefix(byte[] bytes)
           
static boolean isPBMagicPrefix(byte[] bytes, int offset, int len)
           
static int lengthOfPBMagic()
           
static void mergeDelimitedFrom(com.google.protobuf.Message.Builder builder, InputStream in)
          This version of protobuf's mergeDelimitedFrom avoids the hard-coded 64MB limit for decoding buffers
static void mergeFrom(com.google.protobuf.Message.Builder builder, byte[] b)
          This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers when working with byte arrays
static void mergeFrom(com.google.protobuf.Message.Builder builder, byte[] b, int offset, int length)
          This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers when working with byte arrays
static void mergeFrom(com.google.protobuf.Message.Builder builder, com.google.protobuf.ByteString bs)
          This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers when working with ByteStrings
static void mergeFrom(com.google.protobuf.Message.Builder builder, InputStream in)
          This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers where the message size is not known
static void mergeFrom(com.google.protobuf.Message.Builder builder, InputStream in, int size)
          This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers where the message size is known
static void mergeRegions(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, HRegionInfo region_a, HRegionInfo region_b, boolean forcible)
          A helper to merge regions using admin protocol.
static
<T extends com.google.protobuf.Service>
T
newServiceStub(Class<T> service, com.google.protobuf.RpcChannel channel)
           
static void openRegion(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, ServerName server, HRegionInfo region)
          A helper to open a region using admin protocol.
static byte[] prependPBMagic(byte[] bytes)
          Prepend the passed bytes with four bytes of magic, PB_MAGIC, to flag what follows as a protobuf in hbase.
static void revoke(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol, String userShortName, Permission.Action... actions)
          A utility used to revoke a user's global permissions.
static void revoke(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol, String userShortName, String namespace, Permission.Action... actions)
          A utility used to revoke a user's namespace permissions.
static void revoke(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol, String userShortName, TableName tableName, byte[] f, byte[] q, Permission.Action... actions)
          A utility used to revoke a user's table permissions.
static void split(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, HRegionInfo hri, byte[] splitPoint)
          A helper to split a region using admin protocol.
static Append toAppend(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto, CellScanner cellScanner)
          Convert a protocol buffer Mutate to an Append
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Authorizations toAuthorizations(Authorizations authorizations)
          Create a protocol buffer Authorizations based on a client Authorizations.
static Authorizations toAuthorizations(byte[] protoBytes)
          Convert a protocol buffer Authorizations bytes to a client Authorizations
static Authorizations toAuthorizations(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Authorizations proto)
          Convert a protocol buffer Authorizations to a client Authorizations
static org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell toCell(Cell kv)
           
static Cell toCell(org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell cell)
           
static CellVisibility toCellVisibility(byte[] protoBytes)
          Convert a protocol buffer CellVisibility bytes to a client CellVisibility
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility toCellVisibility(CellVisibility cellVisibility)
          Create a protocol buffer CellVisibility based on a client CellVisibility.
static CellVisibility toCellVisibility(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility proto)
          Convert a protocol buffer CellVisibility to a client CellVisibility
static org.apache.hadoop.hbase.protobuf.generated.WALProtos.CompactionDescriptor toCompactionDescriptor(HRegionInfo info, byte[] family, List<org.apache.hadoop.fs.Path> inputPaths, List<org.apache.hadoop.fs.Path> outputPaths, org.apache.hadoop.fs.Path storeDir)
           
static org.apache.hadoop.hbase.protobuf.generated.ComparatorProtos.Comparator toComparator(ByteArrayComparable comparator)
          Convert a ByteArrayComparable to a protocol buffer Comparator
static ByteArrayComparable toComparator(org.apache.hadoop.hbase.protobuf.generated.ComparatorProtos.Comparator proto)
          Convert a protocol buffer Comparator to a ByteArrayComparable
static Delete toDelete(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto)
          Convert a protocol buffer Mutate to a Delete
static Delete toDelete(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto, CellScanner cellScanner)
          Convert a protocol buffer Mutate to a Delete
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.DeleteType toDeleteType(KeyValue.Type type)
          Convert a delete KeyValue type to protocol buffer DeleteType.
static byte[] toDelimitedByteArray(com.google.protobuf.Message m)
           
static Durability toDurability(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Durability proto)
          Convert a protobuf Durability into a client Durability
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Durability toDurability(Durability d)
          Convert a client Durability into a protbuf Durability
static Throwable toException(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parameter)
          Convert a stringified protocol buffer exception Parameter to a Java Exception
static org.apache.hadoop.hbase.protobuf.generated.FilterProtos.Filter toFilter(Filter filter)
          Convert a client Filter to a protocol buffer Filter
static Filter toFilter(org.apache.hadoop.hbase.protobuf.generated.FilterProtos.Filter proto)
          Convert a protocol buffer Filter to a client Filter
static Get toGet(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Get proto)
          Convert a protocol buffer Get to a client Get
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Get toGet(Get get)
          Create a protocol buffer Get based on a client Get.
static Increment toIncrement(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto, CellScanner cellScanner)
          Convert a protocol buffer Mutate to an Increment
static void toIOException(com.google.protobuf.ServiceException se)
          Unwraps an exception from a protobuf service into the underlying (expected) IOException.
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type, Mutation mutation)
           
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type, Mutation mutation, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder)
           
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type, Mutation mutation, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder, long nonce)
           
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type, Mutation mutation, long nonce)
          Create a protocol buffer Mutate based on a client Mutation
static Mutation toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto)
          Convert a MutateRequest to Mutation
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(Increment increment, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder, long nonce)
          Convert a client Increment to a protobuf Mutate.
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutationNoData(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type, Mutation mutation)
          Create a protocol buffer MutationProto based on a client Mutation.
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutationNoData(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type, Mutation mutation, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder)
          Create a protocol buffer MutationProto based on a client Mutation.
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutationNoData(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type, Mutation mutation, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder, long nonce)
           
static NamespaceDescriptor toNamespaceDescriptor(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NamespaceDescriptor desc)
           
static Permission toPermission(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission proto)
          Converts a Permission proto to a client Permission object.
static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission toPermission(Permission perm)
          Convert a client Permission to a Permission proto
static Permission.Action toPermissionAction(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission.Action action)
          Converts a Permission.Action proto to a client Permission.Action object.
static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission.Action toPermissionAction(Permission.Action action)
          Convert a client Permission.Action to a Permission.Action proto
static List<Permission.Action> toPermissionActions(List<org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission.Action> protoActions)
          Converts a list of Permission.Action proto to a list of client Permission.Action objects.
static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NamespaceDescriptor toProtoNamespaceDescriptor(NamespaceDescriptor ns)
           
static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName toProtoTableName(TableName tableName)
           
static Put toPut(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto)
          Convert a protocol buffer Mutate to a Put.
static Put toPut(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto, CellScanner cellScanner)
          Convert a protocol buffer Mutate to a Put.
static ReplicationLoadSink toReplicationLoadSink(org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.ReplicationLoadSink cls)
           
static ReplicationLoadSource toReplicationLoadSource(org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.ReplicationLoadSource cls)
           
static List<ReplicationLoadSource> toReplicationLoadSourceList(List<org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.ReplicationLoadSource> clsList)
           
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result toResult(boolean existence)
          Convert a client Result to a protocol buffer Result
static Result toResult(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result proto)
          Convert a protocol buffer Result to a client Result
static Result toResult(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result proto, CellScanner scanner)
          Convert a protocol buffer Result to a client Result
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result toResult(Result result)
          Convert a client Result to a protocol buffer Result
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result toResultNoData(Result result)
          Convert a client Result to a protocol buffer Result.
static Scan toScan(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Scan proto)
          Convert a protocol buffer Scan to a client Scan
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Scan toScan(Scan scan)
          Convert a client Scan to a protocol buffer Scan
static ScanMetrics toScanMetrics(byte[] bytes)
           
static org.apache.hadoop.hbase.protobuf.generated.MapReduceProtos.ScanMetrics toScanMetrics(ScanMetrics scanMetrics)
           
static List<SecurityCapability> toSecurityCapabilityList(List<org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SecurityCapabilitiesResponse.Capability> capabilities)
          Convert SecurityCapabilitiesResponse.Capability to SecurityCapability
static ServerName toServerName(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName proto)
          Convert a protocol buffer ServerName to a ServerName
static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName toServerName(ServerName serverName)
          Convert a ServerName to a protocol buffer ServerName
static TableName toTableName(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName tableNamePB)
           
static TablePermission toTablePermission(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission proto)
          Converts a Permission proto to a client TablePermission object.
static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> toToken(org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.Token proto)
          Converts a protobuf Token message back into a Token instance.
static org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.Token toToken(org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> token)
          Converts a Token instance (with embedded identifier) to the protobuf representation.
static UserPermission toUserPermission(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UserPermission proto)
          Converts a user permission proto to a client user permission object.
static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UserPermission toUserPermission(UserPermission perm)
          Convert a client user permission to a user permission proto
static com.google.common.collect.ListMultimap<String,Permission> toUsersAndPermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions proto)
           
static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions toUsersAndPermissions(com.google.common.collect.ListMultimap<String,Permission> perms)
           
static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions toUsersAndPermissions(String user, Permission perms)
           
static com.google.common.collect.ListMultimap<String,TablePermission> toUserTablePermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions proto)
          Convert a protobuf UserTablePermissions to a ListMultimap where key is username.
static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions toUserTablePermissions(com.google.common.collect.ListMultimap<String,TablePermission> perm)
          Convert a ListMultimap where key is username to a protobuf UserPermission
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PB_MAGIC

public static final byte[] PB_MAGIC
Magic we put ahead of a serialized protobuf message. For example, all znode content is protobuf messages with the below magic for preamble.

Method Detail

prependPBMagic

public static byte[] prependPBMagic(byte[] bytes)
Prepend the passed bytes with four bytes of magic, PB_MAGIC, to flag what follows as a protobuf in hbase. Prepend these bytes to all content written to znodes, etc.

Parameters:
bytes - Bytes to decorate
Returns:
The passed bytes with magic prepended (Creates a new byte array that is bytes.length plus PB_MAGIC.length.

isPBMagicPrefix

public static boolean isPBMagicPrefix(byte[] bytes)
Parameters:
bytes - Bytes to check.
Returns:
True if passed bytes has PB_MAGIC for a prefix.

isPBMagicPrefix

public static boolean isPBMagicPrefix(byte[] bytes,
                                      int offset,
                                      int len)
Parameters:
bytes - Bytes to check.
Returns:
True if passed bytes has PB_MAGIC for a prefix.

expectPBMagicPrefix

public static void expectPBMagicPrefix(byte[] bytes)
                                throws DeserializationException
Parameters:
bytes -
Throws:
DeserializationException - if we are missing the pb magic prefix

lengthOfPBMagic

public static int lengthOfPBMagic()
Returns:
Length of PB_MAGIC

getRemoteException

public static IOException getRemoteException(com.google.protobuf.ServiceException se)
Return the IOException thrown by the remote server wrapped in ServiceException as cause.

Parameters:
se - ServiceException that wraps IO exception thrown by the server
Returns:
Exception wrapped in ServiceException or a new IOException that wraps the unexpected ServiceException.

toServerName

public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName toServerName(ServerName serverName)
Convert a ServerName to a protocol buffer ServerName

Parameters:
serverName - the ServerName to convert
Returns:
the converted protocol buffer ServerName
See Also:
toServerName(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName)

toServerName

public static ServerName toServerName(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName proto)
Convert a protocol buffer ServerName to a ServerName

Parameters:
proto - the protocol buffer ServerName to convert
Returns:
the converted ServerName

getHTableDescriptorArray

public static HTableDescriptor[] getHTableDescriptorArray(org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetTableDescriptorsResponse proto)
Get HTableDescriptor[] from GetTableDescriptorsResponse protobuf

Parameters:
proto - the GetTableDescriptorsResponse
Returns:
HTableDescriptor[]

getSplitKeysArray

public static byte[][] getSplitKeysArray(org.apache.hadoop.hbase.protobuf.generated.MasterProtos.CreateTableRequest proto)
get the split keys in form "byte [][]" from a CreateTableRequest proto

Parameters:
proto - the CreateTableRequest
Returns:
the split keys

toDurability

public static Durability toDurability(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Durability proto)
Convert a protobuf Durability into a client Durability


toDurability

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Durability toDurability(Durability d)
Convert a client Durability into a protbuf Durability


toGet

public static Get toGet(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Get proto)
                 throws IOException
Convert a protocol buffer Get to a client Get

Parameters:
proto - the protocol buffer Get to convert
Returns:
the converted client Get
Throws:
IOException

toPut

public static Put toPut(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto)
                 throws IOException
Convert a protocol buffer Mutate to a Put.

Parameters:
proto - The protocol buffer MutationProto to convert
Returns:
A client Put.
Throws:
IOException

toPut

public static Put toPut(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto,
                        CellScanner cellScanner)
                 throws IOException
Convert a protocol buffer Mutate to a Put.

Parameters:
proto - The protocol buffer MutationProto to convert
cellScanner - If non-null, the Cell data that goes with this proto.
Returns:
A client Put.
Throws:
IOException

toDelete

public static Delete toDelete(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto)
                       throws IOException
Convert a protocol buffer Mutate to a Delete

Parameters:
proto - the protocol buffer Mutate to convert
Returns:
the converted client Delete
Throws:
IOException

toDelete

public static Delete toDelete(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto,
                              CellScanner cellScanner)
                       throws IOException
Convert a protocol buffer Mutate to a Delete

Parameters:
proto - the protocol buffer Mutate to convert
cellScanner - if non-null, the data that goes with this delete.
Returns:
the converted client Delete
Throws:
IOException

toAppend

public static Append toAppend(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto,
                              CellScanner cellScanner)
                       throws IOException
Convert a protocol buffer Mutate to an Append

Parameters:
cellScanner -
proto - the protocol buffer Mutate to convert
Returns:
the converted client Append
Throws:
IOException

toMutation

public static Mutation toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto)
                           throws IOException
Convert a MutateRequest to Mutation

Parameters:
proto - the protocol buffer Mutate to convert
Returns:
the converted Mutation
Throws:
IOException

toIncrement

public static Increment toIncrement(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto proto,
                                    CellScanner cellScanner)
                             throws IOException
Convert a protocol buffer Mutate to an Increment

Parameters:
proto - the protocol buffer Mutate to convert
Returns:
the converted client Increment
Throws:
IOException

toScan

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Scan toScan(Scan scan)
                                                                           throws IOException
Convert a client Scan to a protocol buffer Scan

Parameters:
scan - the client Scan to convert
Returns:
the converted protocol buffer Scan
Throws:
IOException

toScan

public static Scan toScan(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Scan proto)
                   throws IOException
Convert a protocol buffer Scan to a client Scan

Parameters:
proto - the protocol buffer Scan to convert
Returns:
the converted client Scan
Throws:
IOException

toGet

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Get toGet(Get get)
                                                                         throws IOException
Create a protocol buffer Get based on a client Get.

Parameters:
get - the client Get
Returns:
a protocol buffer Get
Throws:
IOException

toMutation

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(Increment increment,
                                                                                               org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder,
                                                                                               long nonce)
Convert a client Increment to a protobuf Mutate.

Parameters:
increment -
Returns:
the converted mutate

toMutation

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type,
                                                                                               Mutation mutation)
                                                                                        throws IOException
Throws:
IOException

toMutation

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type,
                                                                                               Mutation mutation,
                                                                                               long nonce)
                                                                                        throws IOException
Create a protocol buffer Mutate based on a client Mutation

Parameters:
type -
mutation -
Returns:
a protobuf'd Mutation
Throws:
IOException

toMutation

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type,
                                                                                               Mutation mutation,
                                                                                               org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder)
                                                                                        throws IOException
Throws:
IOException

toMutation

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutation(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type,
                                                                                               Mutation mutation,
                                                                                               org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder,
                                                                                               long nonce)
                                                                                        throws IOException
Throws:
IOException

toMutationNoData

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutationNoData(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type,
                                                                                                     Mutation mutation,
                                                                                                     org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder)
                                                                                              throws IOException
Create a protocol buffer MutationProto based on a client Mutation. Does NOT include data. Understanding is that the Cell will be transported other than via protobuf.

Parameters:
type -
mutation -
builder -
Returns:
a protobuf'd Mutation
Throws:
IOException

toMutationNoData

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutationNoData(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type,
                                                                                                     Mutation mutation)
                                                                                              throws IOException
Create a protocol buffer MutationProto based on a client Mutation. Does NOT include data. Understanding is that the Cell will be transported other than via protobuf.

Parameters:
type -
mutation -
Returns:
a protobuf'd Mutation
Throws:
IOException

toMutationNoData

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto toMutationNoData(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType type,
                                                                                                     Mutation mutation,
                                                                                                     org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.Builder builder,
                                                                                                     long nonce)
                                                                                              throws IOException
Throws:
IOException

toResult

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result toResult(Result result)
Convert a client Result to a protocol buffer Result

Parameters:
result - the client Result to convert
Returns:
the converted protocol buffer Result

toResult

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result toResult(boolean existence)
Convert a client Result to a protocol buffer Result

Parameters:
existence - the client existence to send
Returns:
the converted protocol buffer Result

toResultNoData

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result toResultNoData(Result result)
Convert a client Result to a protocol buffer Result. The pb Result does not include the Cell data. That is for transport otherwise.

Parameters:
result - the client Result to convert
Returns:
the converted protocol buffer Result

toResult

public static Result toResult(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result proto)
Convert a protocol buffer Result to a client Result

Parameters:
proto - the protocol buffer Result to convert
Returns:
the converted client Result

toResult

public static Result toResult(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Result proto,
                              CellScanner scanner)
                       throws IOException
Convert a protocol buffer Result to a client Result

Parameters:
proto - the protocol buffer Result to convert
scanner - Optional cell scanner.
Returns:
the converted client Result
Throws:
IOException

toComparator

public static org.apache.hadoop.hbase.protobuf.generated.ComparatorProtos.Comparator toComparator(ByteArrayComparable comparator)
Convert a ByteArrayComparable to a protocol buffer Comparator

Parameters:
comparator - the ByteArrayComparable to convert
Returns:
the converted protocol buffer Comparator

toComparator

public static ByteArrayComparable toComparator(org.apache.hadoop.hbase.protobuf.generated.ComparatorProtos.Comparator proto)
                                        throws IOException
Convert a protocol buffer Comparator to a ByteArrayComparable

Parameters:
proto - the protocol buffer Comparator to convert
Returns:
the converted ByteArrayComparable
Throws:
IOException

toFilter

public static Filter toFilter(org.apache.hadoop.hbase.protobuf.generated.FilterProtos.Filter proto)
                       throws IOException
Convert a protocol buffer Filter to a client Filter

Parameters:
proto - the protocol buffer Filter to convert
Returns:
the converted Filter
Throws:
IOException

toFilter

public static org.apache.hadoop.hbase.protobuf.generated.FilterProtos.Filter toFilter(Filter filter)
                                                                               throws IOException
Convert a client Filter to a protocol buffer Filter

Parameters:
filter - the Filter to convert
Returns:
the converted protocol buffer Filter
Throws:
IOException

toDeleteType

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.DeleteType toDeleteType(KeyValue.Type type)
                                                                                                     throws IOException
Convert a delete KeyValue type to protocol buffer DeleteType.

Parameters:
type -
Returns:
protocol buffer DeleteType
Throws:
IOException

fromDeleteType

public static KeyValue.Type fromDeleteType(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.DeleteType type)
                                    throws IOException
Convert a protocol buffer DeleteType to delete KeyValue type.

Parameters:
protocol - buffer DeleteType
Returns:
type
Throws:
IOException

toException

public static Throwable toException(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parameter)
                             throws IOException
Convert a stringified protocol buffer exception Parameter to a Java Exception

Parameters:
parameter - the protocol buffer Parameter to convert
Returns:
the converted Exception
Throws:
IOException - if failed to deserialize the parameter

get

public static Result get(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
                         byte[] regionName,
                         Get get)
                  throws IOException
A helper to invoke a Get using client protocol. Uses the standard (i.e. not configured) PayloadCarryingRpcController semantics

Parameters:
client -
regionName -
get -
Returns:
the result of the Get
Throws:
IOException

get

public static Result get(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
                         byte[] regionName,
                         Get get,
                         PayloadCarryingRpcController controller)
                  throws IOException
A helper to invoke a Get using client protocol.

Parameters:
client -
regionName -
get -
controller - to use when writing the rpc
Returns:
the result of the Get
Throws:
IOException

getRowOrBefore

public static Result getRowOrBefore(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
                                    byte[] regionName,
                                    byte[] row,
                                    byte[] family)
                             throws IOException
A helper to get a row of the closet one before using client protocol without setting any special (i.e. configured) PayloadCarryingRpcController

Parameters:
client -
regionName -
row -
family -
Returns:
the row or the closestRowBefore if it doesn't exist
Throws:
IOException

getRowOrBefore

public static Result getRowOrBefore(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
                                    byte[] regionName,
                                    byte[] row,
                                    byte[] family,
                                    PayloadCarryingRpcController payloadCarryingRpcController)
                             throws IOException
A helper to get a row of the closet one before using client protocol.

Parameters:
client -
regionName -
row -
family -
payloadCarryingRpcController -
Returns:
the row or the closestRowBefore if it doesn't exist
Throws:
IOException

bulkLoadHFile

public static boolean bulkLoadHFile(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
                                    List<Pair<byte[],String>> familyPaths,
                                    byte[] regionName,
                                    boolean assignSeqNum)
                             throws IOException
A helper to bulk load a list of HFiles using client protocol.

Parameters:
client -
familyPaths -
regionName -
assignSeqNum -
Returns:
true if all are loaded
Throws:
IOException

bulkLoadHFile

public static boolean bulkLoadHFile(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
                                    List<Pair<byte[],String>> familyPaths,
                                    byte[] regionName,
                                    boolean assignSeqNum,
                                    PayloadCarryingRpcController controller)
                             throws IOException
A helper to bulk load a list of HFiles using client protocol.

Parameters:
client -
familyPaths -
regionName -
assignSeqNum -
controller -
Returns:
true if all are loaded
Throws:
IOException

execService

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse execService(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
                                                                                                             org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceCall call,
                                                                                                             byte[] regionName)
                                                                                                      throws IOException
Throws:
IOException

execService

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse execService(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
                                                                                                             org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceCall call,
                                                                                                             byte[] regionName,
                                                                                                             PayloadCarryingRpcController controller)
                                                                                                      throws IOException
Throws:
IOException

execService

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse execService(org.apache.hadoop.hbase.protobuf.generated.MasterProtos.MasterService.BlockingInterface client,
                                                                                                             org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceCall call)
                                                                                                      throws IOException
Throws:
IOException

execRegionServerService

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse execRegionServerService(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
                                                                                                                         org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceCall call)
                                                                                                                  throws IOException
Make a region server endpoint call

Parameters:
client -
call -
Returns:
CoprocessorServiceResponse
Throws:
IOException

newServiceStub

public static <T extends com.google.protobuf.Service> T newServiceStub(Class<T> service,
                                                                       com.google.protobuf.RpcChannel channel)
                                                            throws Exception
Throws:
Exception

getRegionInfo

public static HRegionInfo getRegionInfo(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
                                        byte[] regionName)
                                 throws IOException
A helper to retrieve region info given a region name using admin protocol.

Parameters:
admin -
regionName -
Returns:
the retrieved region info
Throws:
IOException

closeRegion

public static void closeRegion(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
                               ServerName server,
                               byte[] regionName,
                               boolean transitionInZK)
                        throws IOException
A helper to close a region given a region name using admin protocol.

Parameters:
admin -
regionName -
transitionInZK -
Throws:
IOException

closeRegion

public static boolean closeRegion(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
                                  ServerName server,
                                  byte[] regionName,
                                  int versionOfClosingNode,
                                  ServerName destinationServer,
                                  boolean transitionInZK)
                           throws IOException
A helper to close a region given a region name using admin protocol.

Parameters:
admin -
regionName -
versionOfClosingNode -
Returns:
true if the region is closed
Throws:
IOException

openRegion

public static void openRegion(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
                              ServerName server,
                              HRegionInfo region)
                       throws IOException
A helper to open a region using admin protocol.

Parameters:
admin -
region -
Throws:
IOException

getOnlineRegions

public static List<HRegionInfo> getOnlineRegions(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin)
                                          throws IOException
A helper to get the all the online regions on a region server using admin protocol.

Parameters:
admin -
Returns:
a list of online region info
Throws:
IOException

getServerInfo

public static org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ServerInfo getServerInfo(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin)
                                                                                       throws IOException
A helper to get the info of a region server using admin protocol.

Parameters:
admin -
Returns:
the server name
Throws:
IOException

getStoreFiles

public static List<String> getStoreFiles(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
                                         byte[] regionName,
                                         byte[] family)
                                  throws IOException
A helper to get the list of files of a column family on a given region using admin protocol.

Parameters:
admin -
regionName -
family -
Returns:
the list of store files
Throws:
IOException

split

public static void split(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
                         HRegionInfo hri,
                         byte[] splitPoint)
                  throws IOException
A helper to split a region using admin protocol.

Parameters:
admin -
hri -
splitPoint -
Throws:
IOException

mergeRegions

public static void mergeRegions(org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
                                HRegionInfo region_a,
                                HRegionInfo region_b,
                                boolean forcible)
                         throws IOException
A helper to merge regions using admin protocol. Send request to regionserver.

Parameters:
admin -
region_a -
region_b -
forcible - true if do a compulsory merge, otherwise we will only merge two adjacent regions
Throws:
IOException

getTotalRequestsCount

public static long getTotalRequestsCount(org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.RegionLoad rl)

toDelimitedByteArray

public static byte[] toDelimitedByteArray(com.google.protobuf.Message m)
                                   throws IOException
Parameters:
m - Message to get delimited pb serialization of (with pb magic prefix)
Throws:
IOException

toPermission

public static Permission toPermission(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission proto)
Converts a Permission proto to a client Permission object.

Parameters:
proto - the protobuf Permission
Returns:
the converted Permission

toTablePermission

public static TablePermission toTablePermission(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission proto)
Converts a Permission proto to a client TablePermission object.

Parameters:
proto - the protobuf Permission
Returns:
the converted TablePermission

toPermission

public static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission toPermission(Permission perm)
Convert a client Permission to a Permission proto

Parameters:
perm - the client Permission
Returns:
the protobuf Permission

toPermissionActions

public static List<Permission.Action> toPermissionActions(List<org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission.Action> protoActions)
Converts a list of Permission.Action proto to a list of client Permission.Action objects.

Parameters:
protoActions - the list of protobuf Actions
Returns:
the converted list of Actions

toPermissionAction

public static Permission.Action toPermissionAction(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission.Action action)
Converts a Permission.Action proto to a client Permission.Action object.

Parameters:
action - the protobuf Action
Returns:
the converted Action

toPermissionAction

public static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.Permission.Action toPermissionAction(Permission.Action action)
Convert a client Permission.Action to a Permission.Action proto

Parameters:
action - the client Action
Returns:
the protobuf Action

toUserPermission

public static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UserPermission toUserPermission(UserPermission perm)
Convert a client user permission to a user permission proto

Parameters:
perm - the client UserPermission
Returns:
the protobuf UserPermission

toUserPermission

public static UserPermission toUserPermission(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UserPermission proto)
Converts a user permission proto to a client user permission object.

Parameters:
proto - the protobuf UserPermission
Returns:
the converted UserPermission

toUserTablePermissions

public static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions toUserTablePermissions(com.google.common.collect.ListMultimap<String,TablePermission> perm)
Convert a ListMultimap where key is username to a protobuf UserPermission

Parameters:
perm - the list of user and table permissions
Returns:
the protobuf UserTablePermissions

grant

public static void grant(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol,
                         String userShortName,
                         Permission.Action... actions)
                  throws com.google.protobuf.ServiceException
A utility used to grant a user global permissions.

It's also called by the shell, in case you want to find references.

Parameters:
protocol - the AccessControlService protocol proxy
userShortName - the short name of the user to grant permissions
actions - the permissions to be granted
Throws:
com.google.protobuf.ServiceException

grant

public static void grant(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol,
                         String userShortName,
                         TableName tableName,
                         byte[] f,
                         byte[] q,
                         Permission.Action... actions)
                  throws com.google.protobuf.ServiceException
A utility used to grant a user table permissions. The permissions will be for a table table/column family/qualifier.

It's also called by the shell, in case you want to find references.

Parameters:
protocol - the AccessControlService protocol proxy
userShortName - the short name of the user to grant permissions
tableName - optional table name
f - optional column family
q - optional qualifier
actions - the permissions to be granted
Throws:
com.google.protobuf.ServiceException

grant

public static void grant(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol,
                         String userShortName,
                         String namespace,
                         Permission.Action... actions)
                  throws com.google.protobuf.ServiceException
A utility used to grant a user namespace permissions.

It's also called by the shell, in case you want to find references.

Parameters:
protocol - the AccessControlService protocol proxy
namespace - the short name of the user to grant permissions
actions - the permissions to be granted
Throws:
com.google.protobuf.ServiceException

revoke

public static void revoke(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol,
                          String userShortName,
                          Permission.Action... actions)
                   throws com.google.protobuf.ServiceException
A utility used to revoke a user's global permissions.

It's also called by the shell, in case you want to find references.

Parameters:
protocol - the AccessControlService protocol proxy
userShortName - the short name of the user to revoke permissions
actions - the permissions to be revoked
Throws:
com.google.protobuf.ServiceException

revoke

public static void revoke(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol,
                          String userShortName,
                          TableName tableName,
                          byte[] f,
                          byte[] q,
                          Permission.Action... actions)
                   throws com.google.protobuf.ServiceException
A utility used to revoke a user's table permissions. The permissions will be for a table/column family/qualifier.

It's also called by the shell, in case you want to find references.

Parameters:
protocol - the AccessControlService protocol proxy
userShortName - the short name of the user to revoke permissions
tableName - optional table name
f - optional column family
q - optional qualifier
actions - the permissions to be revoked
Throws:
com.google.protobuf.ServiceException

revoke

public static void revoke(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol,
                          String userShortName,
                          String namespace,
                          Permission.Action... actions)
                   throws com.google.protobuf.ServiceException
A utility used to revoke a user's namespace permissions.

It's also called by the shell, in case you want to find references.

Parameters:
protocol - the AccessControlService protocol proxy
userShortName - the short name of the user to revoke permissions
namespace - optional table name
actions - the permissions to be revoked
Throws:
com.google.protobuf.ServiceException

getUserPermissions

public static List<UserPermission> getUserPermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol)
                                               throws com.google.protobuf.ServiceException
A utility used to get user's global permissions.

It's also called by the shell, in case you want to find references.

Parameters:
protocol - the AccessControlService protocol proxy
Throws:
com.google.protobuf.ServiceException

getUserPermissions

public static List<UserPermission> getUserPermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol,
                                                      TableName t)
                                               throws com.google.protobuf.ServiceException
A utility used to get user table permissions.

It's also called by the shell, in case you want to find references.

Parameters:
protocol - the AccessControlService protocol proxy
t - optional table name
Throws:
com.google.protobuf.ServiceException

getUserPermissions

public static List<UserPermission> getUserPermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface protocol,
                                                      byte[] namespace)
                                               throws com.google.protobuf.ServiceException
A utility used to get permissions for selected namespace.

It's also called by the shell, in case you want to find references.

Parameters:
protocol - the AccessControlService protocol proxy
namespace - name of the namespace
Throws:
com.google.protobuf.ServiceException

toUserTablePermissions

public static com.google.common.collect.ListMultimap<String,TablePermission> toUserTablePermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions proto)
Convert a protobuf UserTablePermissions to a ListMultimap where key is username.

Parameters:
proto - the protobuf UserPermission
Returns:
the converted UserPermission

toToken

public static org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.Token toToken(org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> token)
Converts a Token instance (with embedded identifier) to the protobuf representation.

Parameters:
token - the Token instance to copy
Returns:
the protobuf Token message

toToken

public static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> toToken(org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.Token proto)
Converts a protobuf Token message back into a Token instance.

Parameters:
proto - the protobuf Token message
Returns:
the Token instance

getRegionEncodedName

public static String getRegionEncodedName(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier regionSpecifier)
                                   throws DoNotRetryIOException
Find the HRegion encoded name based on a region specifier

Parameters:
regionSpecifier - the region specifier
Returns:
the corresponding region's encoded name
Throws:
DoNotRetryIOException - if the specifier type is unsupported

toScanMetrics

public static ScanMetrics toScanMetrics(byte[] bytes)

toScanMetrics

public static org.apache.hadoop.hbase.protobuf.generated.MapReduceProtos.ScanMetrics toScanMetrics(ScanMetrics scanMetrics)

toIOException

public static void toIOException(com.google.protobuf.ServiceException se)
                          throws IOException
Unwraps an exception from a protobuf service into the underlying (expected) IOException. This method will always throw an exception.

Parameters:
se - the ServiceException instance to convert into an IOException
Throws:
IOException

toCell

public static org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell toCell(Cell kv)

toCell

public static Cell toCell(org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell cell)

toProtoNamespaceDescriptor

public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NamespaceDescriptor toProtoNamespaceDescriptor(NamespaceDescriptor ns)

toNamespaceDescriptor

public static NamespaceDescriptor toNamespaceDescriptor(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NamespaceDescriptor desc)
                                                 throws IOException
Throws:
IOException

getParsedGenericInstance

public static <T extends com.google.protobuf.Message> T getParsedGenericInstance(Class<?> runtimeClass,
                                                                                 int position,
                                                                                 com.google.protobuf.ByteString b)
                                                                      throws IOException
Get an instance of the argument type declared in a class's signature. The argument type is assumed to be a PB Message subclass, and the instance is created using parseFrom method on the passed ByteString.

Parameters:
runtimeClass - the runtime type of the class
position - the position of the argument in the class declaration
b - the ByteString which should be parsed to get the instance created
Returns:
the instance
Throws:
IOException

toCompactionDescriptor

public static org.apache.hadoop.hbase.protobuf.generated.WALProtos.CompactionDescriptor toCompactionDescriptor(HRegionInfo info,
                                                                                                               byte[] family,
                                                                                                               List<org.apache.hadoop.fs.Path> inputPaths,
                                                                                                               List<org.apache.hadoop.fs.Path> outputPaths,
                                                                                                               org.apache.hadoop.fs.Path storeDir)

getShortTextFormat

public static String getShortTextFormat(com.google.protobuf.Message m)
Return short version of Message toString'd, shorter than TextFormat#shortDebugString. Tries to NOT print out data both because it can be big but also so we do not have data in our logs. Use judiciously.

Parameters:
m -
Returns:
toString of passed m

toTableName

public static TableName toTableName(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName tableNamePB)

toProtoTableName

public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName toProtoTableName(TableName tableName)

getTableNameArray

public static TableName[] getTableNameArray(List<org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName> tableNamesList)

toCellVisibility

public static CellVisibility toCellVisibility(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility proto)
Convert a protocol buffer CellVisibility to a client CellVisibility

Parameters:
proto -
Returns:
the converted client CellVisibility

toCellVisibility

public static CellVisibility toCellVisibility(byte[] protoBytes)
                                       throws DeserializationException
Convert a protocol buffer CellVisibility bytes to a client CellVisibility

Parameters:
protoBytes -
Returns:
the converted client CellVisibility
Throws:
DeserializationException

toCellVisibility

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility toCellVisibility(CellVisibility cellVisibility)
Create a protocol buffer CellVisibility based on a client CellVisibility.

Parameters:
cellVisibility -
Returns:
a protocol buffer CellVisibility

toAuthorizations

public static Authorizations toAuthorizations(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Authorizations proto)
Convert a protocol buffer Authorizations to a client Authorizations

Parameters:
proto -
Returns:
the converted client Authorizations

toAuthorizations

public static Authorizations toAuthorizations(byte[] protoBytes)
                                       throws DeserializationException
Convert a protocol buffer Authorizations bytes to a client Authorizations

Parameters:
protoBytes -
Returns:
the converted client Authorizations
Throws:
DeserializationException

toAuthorizations

public static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Authorizations toAuthorizations(Authorizations authorizations)
Create a protocol buffer Authorizations based on a client Authorizations.

Parameters:
authorizations -
Returns:
a protocol buffer Authorizations

toUsersAndPermissions

public static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions toUsersAndPermissions(String user,
                                                                                                                       Permission perms)

toUsersAndPermissions

public static org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions toUsersAndPermissions(com.google.common.collect.ListMultimap<String,Permission> perms)

toUsersAndPermissions

public static com.google.common.collect.ListMultimap<String,Permission> toUsersAndPermissions(org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.UsersAndPermissions proto)

mergeDelimitedFrom

public static void mergeDelimitedFrom(com.google.protobuf.Message.Builder builder,
                                      InputStream in)
                               throws IOException
This version of protobuf's mergeDelimitedFrom avoids the hard-coded 64MB limit for decoding buffers

Parameters:
builder - current message builder
in - Inputsream with delimited protobuf data
Throws:
IOException

mergeFrom

public static void mergeFrom(com.google.protobuf.Message.Builder builder,
                             InputStream in,
                             int size)
                      throws IOException
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers where the message size is known

Parameters:
builder - current message builder
in - InputStream containing protobuf data
size - known size of protobuf data
Throws:
IOException

mergeFrom

public static void mergeFrom(com.google.protobuf.Message.Builder builder,
                             InputStream in)
                      throws IOException
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers where the message size is not known

Parameters:
builder - current message builder
in - InputStream containing protobuf data
Throws:
IOException

mergeFrom

public static void mergeFrom(com.google.protobuf.Message.Builder builder,
                             com.google.protobuf.ByteString bs)
                      throws IOException
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers when working with ByteStrings

Parameters:
builder - current message builder
bs - ByteString containing the
Throws:
IOException

mergeFrom

public static void mergeFrom(com.google.protobuf.Message.Builder builder,
                             byte[] b)
                      throws IOException
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers when working with byte arrays

Parameters:
builder - current message builder
b - byte array
Throws:
IOException

mergeFrom

public static void mergeFrom(com.google.protobuf.Message.Builder builder,
                             byte[] b,
                             int offset,
                             int length)
                      throws IOException
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding buffers when working with byte arrays

Parameters:
builder - current message builder
b - byte array
offset -
length -
Throws:
IOException

toReplicationLoadSink

public static ReplicationLoadSink toReplicationLoadSink(org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.ReplicationLoadSink cls)

toReplicationLoadSource

public static ReplicationLoadSource toReplicationLoadSource(org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.ReplicationLoadSource cls)

toReplicationLoadSourceList

public static List<ReplicationLoadSource> toReplicationLoadSourceList(List<org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos.ReplicationLoadSource> clsList)

getVersionInfo

public static org.apache.hadoop.hbase.protobuf.generated.RPCProtos.VersionInfo getVersionInfo()
Get a protocol buffer VersionInfo

Returns:
the converted protocol buffer VersionInfo

toSecurityCapabilityList

public static List<SecurityCapability> toSecurityCapabilityList(List<org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SecurityCapabilitiesResponse.Capability> capabilities)
Convert SecurityCapabilitiesResponse.Capability to SecurityCapability

Parameters:
capabilities - capabilities returned in the SecurityCapabilitiesResponse message
Returns:
the converted list of SecurityCapability elements


Copyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.