org.apache.gora.hbase.store
Class HBaseStore<K,T extends org.apache.gora.persistency.Persistent>

java.lang.Object
  extended by org.apache.gora.store.impl.DataStoreBase<K,T>
      extended by org.apache.gora.hbase.store.HBaseStore<K,T>
All Implemented Interfaces:
Closeable, org.apache.gora.store.DataStore<K,T>, org.apache.hadoop.conf.Configurable, org.apache.hadoop.io.Writable

public class HBaseStore<K,T extends org.apache.gora.persistency.Persistent>
extends org.apache.gora.store.impl.DataStoreBase<K,T>
implements org.apache.hadoop.conf.Configurable

DataStore for HBase. Thread safe.


Field Summary
static String DEFAULT_MAPPING_FILE
           
static org.slf4j.Logger LOG
           
static String PARSE_MAPPING_FILE_KEY
           
 
Fields inherited from class org.apache.gora.store.impl.DataStoreBase
beanFactory, conf, datumReader, datumWriter, fieldMap, keyClass, persistentClass, properties, schema
 
Constructor Summary
HBaseStore()
           
 
Method Summary
 void close()
           
 org.apache.hadoop.hbase.client.ResultScanner createScanner(org.apache.gora.query.Query<K,T> query)
           
 void createSchema()
           
 boolean delete(K key)
          Deletes the object with the given key.
 void delete(T obj)
           
 long deleteByQuery(org.apache.gora.query.Query<K,T> query)
           
 void deleteSchema()
           
 org.apache.gora.query.Result<K,T> execute(org.apache.gora.query.Query<K,T> query)
           
 void flush()
           
 T get(K key, String[] fields)
           
 org.apache.hadoop.conf.Configuration getConf()
           
 List<org.apache.gora.query.PartitionQuery<K,T>> getPartitions(org.apache.gora.query.Query<K,T> query)
           
 String getSchemaName()
           
 void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties)
           
 T newInstance(org.apache.hadoop.hbase.client.Result result, String[] fields)
           
 org.apache.gora.query.Query<K,T> newQuery()
           
 void put(K key, T persistent)
           
 boolean schemaExists()
           
 void setConf(org.apache.hadoop.conf.Configuration conf)
           
 
Methods inherited from class org.apache.gora.store.impl.DataStoreBase
equals, get, getBeanFactory, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, newKey, newPersistent, readFields, setBeanFactory, setKeyClass, setPersistentClass, truncateSchema, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.slf4j.Logger LOG

PARSE_MAPPING_FILE_KEY

public static final String PARSE_MAPPING_FILE_KEY
See Also:
Constant Field Values

DEFAULT_MAPPING_FILE

public static final String DEFAULT_MAPPING_FILE
See Also:
Constant Field Values
Constructor Detail

HBaseStore

public HBaseStore()
Method Detail

initialize

public void initialize(Class<K> keyClass,
                       Class<T> persistentClass,
                       Properties properties)
                throws IOException
Specified by:
initialize in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Overrides:
initialize in class org.apache.gora.store.impl.DataStoreBase<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

getSchemaName

public String getSchemaName()
Specified by:
getSchemaName in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>

createSchema

public void createSchema()
                  throws IOException
Specified by:
createSchema in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

deleteSchema

public void deleteSchema()
                  throws IOException
Specified by:
deleteSchema in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

schemaExists

public boolean schemaExists()
                     throws IOException
Specified by:
schemaExists in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

get

public T get(K key,
             String[] fields)
                                                     throws IOException
Specified by:
get in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

put

public void put(K key,
                T persistent)
         throws IOException
Specified by:
put in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

delete

public void delete(T obj)

delete

public boolean delete(K key)
               throws IOException
Deletes the object with the given key.

Specified by:
delete in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Returns:
always true
Throws:
IOException

deleteByQuery

public long deleteByQuery(org.apache.gora.query.Query<K,T> query)
                   throws IOException
Specified by:
deleteByQuery in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

newQuery

public org.apache.gora.query.Query<K,T> newQuery()
Specified by:
newQuery in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>

getPartitions

public List<org.apache.gora.query.PartitionQuery<K,T>> getPartitions(org.apache.gora.query.Query<K,T> query)
                                                                                                             throws IOException
Specified by:
getPartitions in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

execute

public org.apache.gora.query.Result<K,T> execute(org.apache.gora.query.Query<K,T> query)
                                                                                         throws IOException
Specified by:
execute in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

createScanner

public org.apache.hadoop.hbase.client.ResultScanner createScanner(org.apache.gora.query.Query<K,T> query)
                                                           throws IOException
Throws:
IOException

newInstance

public T newInstance(org.apache.hadoop.hbase.client.Result result,
                     String[] fields)
                                                             throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Throws:
IOException

getConf

public org.apache.hadoop.conf.Configuration getConf()
Specified by:
getConf in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Specified by:
getConf in interface org.apache.hadoop.conf.Configurable
Overrides:
getConf in class org.apache.gora.store.impl.DataStoreBase<K,T extends org.apache.gora.persistency.Persistent>

setConf

public void setConf(org.apache.hadoop.conf.Configuration conf)
Specified by:
setConf in interface org.apache.gora.store.DataStore<K,T extends org.apache.gora.persistency.Persistent>
Specified by:
setConf in interface org.apache.hadoop.conf.Configurable
Overrides:
setConf in class org.apache.gora.store.impl.DataStoreBase<K,T extends org.apache.gora.persistency.Persistent>


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.