public abstract class FileBackedDataStoreBase<K,T extends PersistentBase> extends DataStoreBase<K,T> implements FileBackedDataStore<K,T>
FileBackedDataStore
methods.Modifier and Type | Field and Description |
---|---|
protected String |
inputPath |
protected long |
inputSize |
protected InputStream |
inputStream |
static org.slf4j.Logger |
LOG |
protected String |
outputPath |
protected OutputStream |
outputStream |
autoCreateSchema, beanFactory, conf, datumReader, datumWriter, fieldMap, keyClass, persistentClass, properties, schema
Constructor and Description |
---|
FileBackedDataStoreBase() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the DataStore.
|
protected InputStream |
createInputStream()
Opens an InputStream for the input Hadoop path
|
protected OutputStream |
createOutputStream()
Opens an OutputStream for the output Hadoop path
|
void |
createSchema()
Creates the optional schema or table (or similar) in the datastore
to hold the objects.
|
void |
deleteSchema()
Deletes the underlying schema or table (or similar) in the datastore
that holds the objects.
|
Result<K,T> |
execute(Query<K,T> query)
Executes the given query and returns the results.
|
protected abstract Result<K,T> |
executePartial(FileSplitPartitionQuery<K,T> query)
Executes a PartitialQuery, reading the data between start and end.
|
protected abstract 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.
|
String |
getInputPath() |
InputStream |
getInputStream() |
protected InputStream |
getOrCreateInputStream() |
protected OutputStream |
getOrCreateOutputStream() |
String |
getOutputPath() |
OutputStream |
getOutputStream() |
List<PartitionQuery<K,T>> |
getPartitions(Query<K,T> query)
Partitions the given query and returns a list of
PartitionQuery s,
which will execute on local data. |
void |
initialize(Class<K> keyClass,
Class<T> persistentClass,
Properties properties)
Initializes this DataStore.
|
void |
readFields(DataInput in) |
boolean |
schemaExists()
Returns whether the schema that holds the data exists in the datastore.
|
void |
setInputPath(String inputPath) |
void |
setInputStream(InputStream inputStream) |
void |
setOutputPath(String outputPath) |
void |
setOutputStream(OutputStream outputStream) |
void |
write(DataOutput out) |
equals, get, getBeanFactory, getConf, getFields, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, newKey, newPersistent, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
delete, deleteByQuery, get, get, getBeanFactory, getKeyClass, getPersistentClass, getSchemaName, newKey, newPersistent, newQuery, put, setBeanFactory, setKeyClass, setPersistentClass, truncateSchema
protected long inputSize
protected String inputPath
protected String outputPath
protected InputStream inputStream
protected OutputStream outputStream
public static final org.slf4j.Logger LOG
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties)
DataStore
initialize
in interface DataStore<K,T extends PersistentBase>
initialize
in class DataStoreBase<K,T extends PersistentBase>
keyClass
- the class of the keyspersistentClass
- the class of the persistent objectsproperties
- extra metadatapublic void setInputPath(String inputPath)
setInputPath
in interface FileBackedDataStore<K,T extends PersistentBase>
public void setOutputPath(String outputPath)
setOutputPath
in interface FileBackedDataStore<K,T extends PersistentBase>
public String getInputPath()
getInputPath
in interface FileBackedDataStore<K,T extends PersistentBase>
public String getOutputPath()
getOutputPath
in interface FileBackedDataStore<K,T extends PersistentBase>
public void setInputStream(InputStream inputStream)
setInputStream
in interface FileBackedDataStore<K,T extends PersistentBase>
public void setOutputStream(OutputStream outputStream)
setOutputStream
in interface FileBackedDataStore<K,T extends PersistentBase>
public InputStream getInputStream()
getInputStream
in interface FileBackedDataStore<K,T extends PersistentBase>
public OutputStream getOutputStream()
getOutputStream
in interface FileBackedDataStore<K,T extends PersistentBase>
protected InputStream createInputStream() throws IOException
IOException
protected OutputStream createOutputStream()
protected InputStream getOrCreateInputStream() throws IOException
IOException
protected OutputStream getOrCreateOutputStream() throws IOException
IOException
public List<PartitionQuery<K,T>> getPartitions(Query<K,T> query)
DataStore
PartitionQuery
s,
which will execute on local data.getPartitions
in interface DataStore<K,T extends PersistentBase>
query
- the base query to create the partitions for. If the query
is null, then the data store returns the partitions for the default query
(returning every object)public Result<K,T> execute(Query<K,T> query)
DataStore
protected abstract Result<K,T> executeQuery(Query<K,T> query) throws IOException
IOException
protected abstract Result<K,T> executePartial(FileSplitPartitionQuery<K,T> query) throws IOException
IOException
public void flush()
DataStore
flush
in interface DataStore<K,T extends PersistentBase>
public void createSchema()
DataStore
createSchema
in interface DataStore<K,T extends PersistentBase>
public void deleteSchema()
DataStore
deleteSchema
in interface DataStore<K,T extends PersistentBase>
public boolean schemaExists()
DataStore
schemaExists
in interface DataStore<K,T extends PersistentBase>
public void write(DataOutput out)
write
in interface org.apache.hadoop.io.Writable
write
in class DataStoreBase<K,T extends PersistentBase>
public void readFields(DataInput in)
readFields
in interface org.apache.hadoop.io.Writable
readFields
in class DataStoreBase<K,T extends PersistentBase>
public void close()
DataStore
close
in interface Closeable
close
in interface AutoCloseable
close
in interface DataStore<K,T extends PersistentBase>
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.