This project has retired. For details please refer to its Attic page.
DataFileAvroStore (Apache Gora 0.2 API)

org.apache.gora.avro.store
Class DataFileAvroStore<K,T extends Persistent>

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

public class DataFileAvroStore<K,T extends Persistent>
extends AvroStore<K,T>

DataFileAvroStore is file based store which uses Avro's DataFile{Writer,Reader}'s as a backend. This datastore supports mapreduce.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.gora.avro.store.AvroStore
AvroStore.CodecType
 
Field Summary
 
Fields inherited from class org.apache.gora.avro.store.AvroStore
CODEC_TYPE_KEY
 
Fields inherited from class org.apache.gora.store.impl.FileBackedDataStoreBase
inputPath, inputSize, inputStream, outputPath, outputStream
 
Fields inherited from class org.apache.gora.store.impl.DataStoreBase
autoCreateSchema, beanFactory, conf, fieldMap, keyClass, persistentClass, properties, schema
 
Constructor Summary
DataFileAvroStore()
           
 
Method Summary
 void close()
          Close the DataStore.
protected  Result<K,T> executePartial(FileSplitPartitionQuery<K,T> query)
          Executes a PartitialQuery, reading the data between start and end.
protected  Result<K,T> executeQuery(Query<K,T> query)
          Executes a normal Query reading the whole data.
 void flush()
          Forces the write caches to be flushed.
 T get(K key, String[] fields)
          Returns the object corresponding to the given key.
 void put(K key, T obj)
          Inserts the persistent object with the given key.
 
Methods inherited from class org.apache.gora.avro.store.AvroStore
createDatumReader, createDatumWriter, createDecoder, createEncoder, delete, deleteByQuery, getConf, getDatumReader, getDatumWriter, getDecoder, getEncoder, getSchemaName, initialize, newQuery, readFields, setCodecType, setDatumReader, setDatumWriter, setDecoder, setEncoder, write
 
Methods inherited from class org.apache.gora.store.impl.FileBackedDataStoreBase
createInputStream, createOutputStream, createSchema, deleteSchema, execute, getInputPath, getInputStream, getOrCreateInputStream, getOrCreateOutputStream, getOutputPath, getOutputStream, getPartitions, schemaExists, setInputPath, setInputStream, setOutputPath, setOutputStream
 
Methods inherited from class org.apache.gora.store.impl.DataStoreBase
equals, get, getBeanFactory, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, newKey, newPersistent, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.conf.Configurable
setConf
 
Methods inherited from interface org.apache.gora.store.DataStore
get, getBeanFactory, getKeyClass, getPersistentClass, newKey, newPersistent, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema
 

Constructor Detail

DataFileAvroStore

public DataFileAvroStore()
Method Detail

get

public T get(K key,
             String[] fields)
                         throws IOException
Description copied from interface: DataStore
Returns the object corresponding to the given key.

Specified by:
get in interface DataStore<K,T extends Persistent>
Overrides:
get in class AvroStore<K,T extends Persistent>
Parameters:
key - the key of the object
fields - the fields required in the object. Pass null, to retrieve all fields
Returns:
the Object corresponding to the key or null if it cannot be found
Throws:
IOException

put

public void put(K key,
                T obj)
         throws IOException
Description copied from interface: DataStore
Inserts the persistent object with the given key. If an object with the same key already exists it will silently be replaced. See also the note on visibility.

Specified by:
put in interface DataStore<K,T extends Persistent>
Overrides:
put in class AvroStore<K,T extends Persistent>
Throws:
IOException

executeQuery

protected Result<K,T> executeQuery(Query<K,T> query)
                                               throws IOException
Description copied from class: AvroStore
Executes a normal Query reading the whole data. #execute() calls this function for non-PartitionQuery's.

Overrides:
executeQuery in class AvroStore<K,T extends Persistent>
Throws:
IOException

executePartial

protected Result<K,T> executePartial(FileSplitPartitionQuery<K,T> query)
                                                 throws IOException
Description copied from class: AvroStore
Executes a PartitialQuery, reading the data between start and end.

Overrides:
executePartial in class AvroStore<K,T extends Persistent>
Throws:
IOException

flush

public void flush()
           throws IOException
Description copied from interface: DataStore
Forces the write caches to be flushed. DataStore implementations may optimize their writing by deferring the actual put / delete operations until this moment. See also the note on visibility.

Specified by:
flush in interface DataStore<K,T extends Persistent>
Overrides:
flush in class AvroStore<K,T extends Persistent>
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: DataStore
Close the DataStore. This should release any resources held by the implementation, so that the instance is ready for GC. All other DataStore methods cannot be used after this method was called. Subsequent calls of this method are ignored.

Specified by:
close in interface Closeable
Specified by:
close in interface DataStore<K,T extends Persistent>
Overrides:
close in class AvroStore<K,T extends Persistent>
Throws:
IOException


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