org.apache.hadoop.hbase.util
Class Keying

java.lang.Object
  extended by org.apache.hadoop.hbase.util.Keying

public class Keying
extends Object

Utility creating hbase friendly keys. Use fabricating row names or column qualifiers.

TODO: Add createSchemeless key, a key that doesn't care if scheme is http or https.

See Also:
Bytes.split(byte[], byte[], int)

Constructor Summary
Keying()
           
 
Method Summary
static String createKey(String u)
          Makes a key out of passed URI for use as row name or column qualifier.
static String keyToUri(String s)
          Reverse the createKey(String) transform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Keying

public Keying()
Method Detail

createKey

public static String createKey(String u)
Makes a key out of passed URI for use as row name or column qualifier. This method runs transforms on the passed URI so it sits better as a key (or portion-of-a-key) in hbase. The host portion of the URI authority is reversed so subdomains sort under their parent domain. The returned String is an opaque URI of an artificial r: scheme to prevent the result being considered an URI of the original scheme. Here is an example of the transform: The url http://lucene.apache.org/index.html?query=something#middle is returned as r:http://org.apache.lucene/index.html?query=something#middle The transforms are reversible. No transform is done if passed URI is not hierarchical.

If authority userinfo is present, will mess up the sort (until we do more work).

Parameters:
u - URL to transform.
Returns:
An opaque URI of artificial 'r' scheme with host portion of URI authority reversed (if present).
See Also:
keyToUri(String), RFC2396

keyToUri

public static String keyToUri(String s)
Reverse the createKey(String) transform.

Parameters:
s - URI made by createKey(String).
Returns:
'Restored' URI made by reversing the createKey(String) transform.


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