| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.gora.store.impl.DataStoreBase<K,T>
public abstract class DataStoreBase<K,T extends Persistent>
A Base class for DataStores.
| Field Summary | |
|---|---|
| protected  boolean | autoCreateSchema | 
| protected  BeanFactory<K,T> | beanFactory | 
| protected  org.apache.hadoop.conf.Configuration | conf | 
| protected  PersistentDatumReader<T> | datumReader | 
| protected  PersistentDatumWriter<T> | datumWriter | 
| protected  Map<String,org.apache.avro.Schema.Field> | fieldMapA map of field names to Field objects containing schema's fields | 
| protected  Class<K> | keyClass | 
| protected  Class<T> | persistentClass | 
| protected  Properties | properties | 
| protected  org.apache.avro.Schema | schemaThe schema of the persistent class | 
| Constructor Summary | |
|---|---|
| DataStoreBase() | |
| Method Summary | |
|---|---|
|  boolean | equals(Object obj) | 
|  T | get(K key)Returns the object corresponding to the given key fetching all the fields. | 
|  BeanFactory<K,T> | getBeanFactory()Returns the BeanFactory used by the DataStore | 
|  org.apache.hadoop.conf.Configuration | getConf() | 
| protected  String[] | getFieldsToQuery(String[] fields)Checks whether the fields argument is null, and if so returns all the fields of the Persistent object, else returns the argument. | 
|  Class<K> | getKeyClass()Returns the class of the keys | 
| protected  org.apache.hadoop.conf.Configuration | getOrCreateConf() | 
|  Class<T> | getPersistentClass()Returns the class of the persistent objects | 
| protected  String | getSchemaName(String mappingSchemaName,
              Class<?> persistentClass)Returns the name of the schema to use for the persistent class. | 
|  void | initialize(Class<K> keyClass,
           Class<T> persistentClass,
           Properties properties)Initializes this DataStore. | 
|  K | newKey()Returns a new instance of the key object. | 
|  T | newPersistent()Returns a new instance of the managed persistent object. | 
|  void | readFields(DataInput in) | 
|  void | setBeanFactory(BeanFactory<K,T> beanFactory)Sets the BeanFactoryto use by the DataStore. | 
|  void | setConf(org.apache.hadoop.conf.Configuration conf) | 
|  void | setKeyClass(Class<K> keyClass)Sets the class of the keys | 
|  void | setPersistentClass(Class<T> persistentClass)Sets the class of the persistent objects | 
|  void | truncateSchema()Deletes all the data associated with the schema, but keeps the schema (table or similar) intact. | 
|  void | write(DataOutput out) | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface org.apache.gora.store.DataStore | 
|---|
| close, createSchema, delete, deleteByQuery, deleteSchema, execute, flush, get, getPartitions, getSchemaName, newQuery, put, schemaExists | 
| Field Detail | 
|---|
protected BeanFactory<K,T extends Persistent> beanFactory
protected Class<K> keyClass
protected Class<T extends Persistent> persistentClass
protected org.apache.avro.Schema schema
protected Map<String,org.apache.avro.Schema.Field> fieldMap
protected org.apache.hadoop.conf.Configuration conf
protected boolean autoCreateSchema
protected Properties properties
protected PersistentDatumReader<T extends Persistent> datumReader
protected PersistentDatumWriter<T extends Persistent> datumWriter
| Constructor Detail | 
|---|
public DataStoreBase()
| Method Detail | 
|---|
public void initialize(Class<K> keyClass,
                       Class<T> persistentClass,
                       Properties properties)
                throws IOException
DataStore
initialize in interface DataStore<K,T extends Persistent>keyClass - the class of the keyspersistentClass - the class of the persistent objectsproperties - extra metadata
IOExceptionpublic void setPersistentClass(Class<T> persistentClass)
DataStore
setPersistentClass in interface DataStore<K,T extends Persistent>persistentClass - class of persistent objectspublic Class<T> getPersistentClass()
DataStore
getPersistentClass in interface DataStore<K,T extends Persistent>public Class<K> getKeyClass()
DataStore
getKeyClass in interface DataStore<K,T extends Persistent>public void setKeyClass(Class<K> keyClass)
DataStore
setKeyClass in interface DataStore<K,T extends Persistent>keyClass - the class of keys
public K newKey()
         throws IOException
DataStore
newKey in interface DataStore<K,T extends Persistent>IOException
public T newPersistent()
                                   throws IOException
DataStore
newPersistent in interface DataStore<K,T extends Persistent>IOExceptionpublic void setBeanFactory(BeanFactory<K,T> beanFactory)
DataStoreBeanFactory to use by the DataStore.
setBeanFactory in interface DataStore<K,T extends Persistent>beanFactory - the BeanFactory to usepublic BeanFactory<K,T> getBeanFactory()
DataStore
getBeanFactory in interface DataStore<K,T extends Persistent>
public T get(K key)
                         throws IOException
DataStore
get in interface DataStore<K,T extends Persistent>key - the key of the object
IOExceptionprotected String[] getFieldsToQuery(String[] fields)
public org.apache.hadoop.conf.Configuration getConf()
getConf in interface DataStore<K,T extends Persistent>getConf in interface org.apache.hadoop.conf.Configurablepublic void setConf(org.apache.hadoop.conf.Configuration conf)
setConf in interface DataStore<K,T extends Persistent>setConf in interface org.apache.hadoop.conf.Configurableprotected org.apache.hadoop.conf.Configuration getOrCreateConf()
public void readFields(DataInput in)
                throws IOException
readFields in interface DataStore<K,T extends Persistent>readFields in interface org.apache.hadoop.io.WritableIOException
public void write(DataOutput out)
           throws IOException
write in interface DataStore<K,T extends Persistent>write in interface org.apache.hadoop.io.WritableIOExceptionpublic boolean equals(Object obj)
equals in class Object
public void truncateSchema()
                    throws IOException
DataStore
truncateSchema in interface DataStore<K,T extends Persistent>IOException
protected String getSchemaName(String mappingSchemaName,
                               Class<?> persistentClass)
Configuration.
 The schema name in the defined properties is returned. If null then
 the provided mappingSchemaName is returned. If this is null too,
 the class name, without the package, of the persistent class is returned.
mappingSchemaName - the name of the schema as read from the mapping filepersistentClass - persistent class| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||