|
||||||||||
| 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>
org.apache.gora.sql.store.SqlStore<K,T>
public class SqlStore<K,T extends Persistent>
A DataStore implementation for RDBMS with a SQL interface. SqlStore uses JDBC drivers to communicate with the DB.
| Nested Class Summary | |
|---|---|
static class |
SqlStore.DBVendor
The vendor of the DB |
| Field Summary | |
|---|---|
protected static java.lang.String |
DEFAULT_MAPPING_FILE
|
protected static java.lang.String |
DRIVER_CLASS_PROPERTY
The JDBC Driver class name |
protected static java.lang.String |
PASSWORD_PROPERTY
Password to access the database |
protected static java.lang.String |
URL_PROPERTY
JDBC Database access URL |
protected static java.lang.String |
USERNAME_PROPERTY
User name to access the database |
| Fields inherited from class org.apache.gora.store.impl.DataStoreBase |
|---|
autoCreateSchema, beanFactory, conf, datumReader, datumWriter, fieldMap, keyClass, persistentClass, properties, schema |
| Constructor Summary | |
|---|---|
SqlStore()
|
|
| Method Summary | ||
|---|---|---|
void |
close()
|
|
void |
createSchema()
|
|
protected com.healthmarketscience.sqlbuilder.dbspec.basic.DbTable |
createSqlTable(SqlMapping mapping)
|
|
boolean |
delete(K key)
|
|
long |
deleteByQuery(Query<K,T> query)
|
|
void |
deleteSchema()
|
|
Result<K,T> |
execute(Query<K,T> query)
|
|
void |
flush()
|
|
T |
get(K key,
java.lang.String[] requestFields)
|
|
protected byte[] |
getBytes(java.sql.ResultSet resultSet,
int columnIndex,
org.apache.avro.Schema schema,
Column column)
|
|
protected java.sql.Connection |
getConnection()
|
|
protected java.lang.String |
getIdentifier(java.lang.String identifier)
|
|
java.util.List<PartitionQuery<K,T>> |
getPartitions(Query<K,T> query)
|
|
java.lang.String |
getSchemaName()
|
|
protected void |
initDbMetadata()
|
|
void |
initialize(java.lang.Class<K> keyClass,
java.lang.Class<T> persistentClass,
java.util.Properties properties)
|
|
Query<K,T> |
newQuery()
|
|
void |
put(K key,
T persistent)
|
|
protected java.lang.Object |
readField(java.sql.ResultSet resultSet,
int columnIndex,
java.lang.Object field,
org.apache.avro.Schema schema,
Column column)
|
|
protected SqlMapping |
readMapping(java.lang.String filename)
|
|
T |
readObject(java.sql.ResultSet rs,
T persistent,
java.lang.String[] requestFields)
|
|
K |
readPrimaryKey(java.sql.ResultSet resultSet)
|
|
boolean |
schemaExists()
|
|
protected void |
setBytes(java.sql.PreparedStatement statement,
Column column,
int index,
byte[] value)
|
|
protected void |
setField(java.sql.PreparedStatement statement,
Column column,
org.apache.avro.Schema schema,
int index,
java.lang.Object object)
Serializes the field using Avro to a BLOB field |
|
void |
setObject(java.sql.PreparedStatement statement,
int index,
java.lang.Object object,
org.apache.avro.Schema schema,
Column column)
Sets the object to the preparedStatement by it's schema |
|
protected
|
setObject(java.sql.PreparedStatement statement,
int index,
V object,
int objectType,
Column column)
|
|
| Methods inherited from class org.apache.gora.store.impl.DataStoreBase |
|---|
equals, get, getBeanFactory, getConf, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, newKey, newPersistent, readFields, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema, write |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String DRIVER_CLASS_PROPERTY
protected static final java.lang.String URL_PROPERTY
protected static final java.lang.String USERNAME_PROPERTY
protected static final java.lang.String PASSWORD_PROPERTY
protected static final java.lang.String DEFAULT_MAPPING_FILE
| Constructor Detail |
|---|
public SqlStore()
| Method Detail |
|---|
public void initialize(java.lang.Class<K> keyClass,
java.lang.Class<T> persistentClass,
java.util.Properties properties)
throws java.io.IOException
initialize in interface DataStore<K,T extends Persistent>initialize in class DataStoreBase<K,T extends Persistent>java.io.IOExceptionpublic java.lang.String getSchemaName()
public void close()
throws java.io.IOException
java.io.IOException
public void createSchema()
throws java.io.IOException
java.io.IOException
public void deleteSchema()
throws java.io.IOException
java.io.IOException
public boolean schemaExists()
throws java.io.IOException
java.io.IOException
public boolean delete(K key)
throws java.io.IOException
java.io.IOException
public long deleteByQuery(Query<K,T> query)
throws java.io.IOException
java.io.IOException
public void flush()
throws java.io.IOException
java.io.IOException
public T get(K key,
java.lang.String[] requestFields)
throws java.io.IOException
java.io.IOException
public Result<K,T> execute(Query<K,T> query)
throws java.io.IOException
java.io.IOException
public K readPrimaryKey(java.sql.ResultSet resultSet)
throws java.sql.SQLException
java.sql.SQLException
public T readObject(java.sql.ResultSet rs,
T persistent,
java.lang.String[] requestFields)
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
protected byte[] getBytes(java.sql.ResultSet resultSet,
int columnIndex,
org.apache.avro.Schema schema,
Column column)
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
protected java.lang.Object readField(java.sql.ResultSet resultSet,
int columnIndex,
java.lang.Object field,
org.apache.avro.Schema schema,
Column column)
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
public java.util.List<PartitionQuery<K,T>> getPartitions(Query<K,T> query)
throws java.io.IOException
java.io.IOExceptionpublic Query<K,T> newQuery()
public void put(K key,
T persistent)
throws java.io.IOException
java.io.IOException
public void setObject(java.sql.PreparedStatement statement,
int index,
java.lang.Object object,
org.apache.avro.Schema schema,
Column column)
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
protected <V> void setObject(java.sql.PreparedStatement statement,
int index,
V object,
int objectType,
Column column)
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
protected void setBytes(java.sql.PreparedStatement statement,
Column column,
int index,
byte[] value)
throws java.sql.SQLException
java.sql.SQLException
protected void setField(java.sql.PreparedStatement statement,
Column column,
org.apache.avro.Schema schema,
int index,
java.lang.Object object)
throws java.io.IOException,
java.sql.SQLException
java.io.IOException
java.sql.SQLException
protected java.sql.Connection getConnection()
throws java.io.IOException
java.io.IOException
protected void initDbMetadata()
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getIdentifier(java.lang.String identifier)
protected com.healthmarketscience.sqlbuilder.dbspec.basic.DbTable createSqlTable(SqlMapping mapping)
protected SqlMapping readMapping(java.lang.String filename)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||