org.apache.gora.dynamodb.store
Class DynamoDBStore<K,T extends org.apache.gora.persistency.Persistent>

java.lang.Object
  extended by org.apache.gora.store.ws.impl.WSDataStoreBase<K,T>
      extended by org.apache.gora.dynamodb.store.DynamoDBStore<K,T>
All Implemented Interfaces:
org.apache.gora.store.DataStore<K,T>

public class DynamoDBStore<K,T extends org.apache.gora.persistency.Persistent>
extends org.apache.gora.store.ws.impl.WSDataStoreBase<K,T>


Field Summary
static org.slf4j.Logger LOG
          Helper to write useful information into the logs
 
Fields inherited from class org.apache.gora.store.ws.impl.WSDataStoreBase
authentication, keyClass, properties
 
Constructor Summary
DynamoDBStore()
          Constructor
 
Method Summary
 void close()
           
 void createSchema()
          Creates the table within the data store for a preferred schema or for a group of schemas defined withing the mapping file
 boolean delete(K key)
          Deletes the object using key
 long deleteByQuery(org.apache.gora.query.Query<K,T> query)
          Deletes items using a specific query
 void deleteSchema()
          Deletes all tables present in the mapping object.
 org.apache.gora.query.Result<K,T> execute(org.apache.gora.query.Query<K,T> query)
          Executes a query after building a DynamoDB specific query based on the received one
 void executeDeleteTableRequest(String pTableName)
          Executes a delete table request using the DynamoDB client
 void flush()
           
 T get(K key)
           
 T get(K key, String[] fields)
           
 org.apache.gora.persistency.BeanFactory<K,T> getBeanFactory()
           
 com.amazonaws.services.dynamodb.AmazonDynamoDB getClient(String clientType, com.amazonaws.auth.AWSCredentials credentials)
          Method to create the specific client to be used
 List<org.apache.gora.query.PartitionQuery<K,T>> getPartitions(org.apache.gora.query.Query<K,T> query)
           
 String getSchemaName()
          Gets the preferred schema
 void initialize(Class<K> keyClass, Class<T> pPersistentClass, Properties properties)
          Initialize the data store by reading the credentials, setting the cloud provider, setting the client's properties up, setting the end point and reading the mapping file
 K newKey()
          Returns a new instance of the key object.
 T newPersistent()
          Returns a new persistent object
 org.apache.gora.query.Query<K,T> newQuery()
          Creates a new DynamoDBQuery
 void put(K key, T obj)
          Puts an object identified by a key
 boolean schemaExists()
          Verifies if the specified schemas exist
 void setBeanFactory(org.apache.gora.persistency.BeanFactory<K,T> beanFactory)
           
 void setSchemaName(String pSchemaName)
          Sets the preferred schema
 
Methods inherited from class org.apache.gora.store.ws.impl.WSDataStoreBase
equals, getConf, getKeyClass, getPersistentClass, getSchemaName, getWSProvider, readFields, setConf, setKeyClass, setPersistentClass, setWsProvider, 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
Helper to write useful information into the logs

Constructor Detail

DynamoDBStore

public DynamoDBStore()
Constructor

Method Detail

initialize

public void initialize(Class<K> keyClass,
                       Class<T> pPersistentClass,
                       Properties properties)
Initialize the data store by reading the credentials, setting the cloud provider, setting the client's properties up, setting the end point and reading the mapping file

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.ws.impl.WSDataStoreBase<K,T extends org.apache.gora.persistency.Persistent>

getClient

public com.amazonaws.services.dynamodb.AmazonDynamoDB getClient(String clientType,
                                                                com.amazonaws.auth.AWSCredentials credentials)
Method to create the specific client to be used

Parameters:
clientType -
credentials -
Returns:

execute

public org.apache.gora.query.Result<K,T> execute(org.apache.gora.query.Query<K,T> query)
Executes a query after building a DynamoDB specific query based on the received one


get

public T get(K key,
             String[] fields)

get

public T get(K key)

newQuery

public org.apache.gora.query.Query<K,T> newQuery()
Creates a new DynamoDBQuery


getSchemaName

public String getSchemaName()
Gets the preferred schema


setSchemaName

public void setSchemaName(String pSchemaName)
Sets the preferred schema

Parameters:
pSchemaName -

createSchema

public void createSchema()
Creates the table within the data store for a preferred schema or for a group of schemas defined withing the mapping file

Throws:
IOException

deleteSchema

public void deleteSchema()
Deletes all tables present in the mapping object.

Throws:
IOException

executeDeleteTableRequest

public void executeDeleteTableRequest(String pTableName)
Executes a delete table request using the DynamoDB client

Parameters:
tableName -

schemaExists

public boolean schemaExists()
Verifies if the specified schemas exist

Throws:
IOException

newKey

public K newKey()
Returns a new instance of the key object.

Throws:
IOException

newPersistent

public T newPersistent()
Returns a new persistent object

Throws:
IOException

put

public void put(K key,
                T obj)
Puts an object identified by a key

Throws:
IOException

delete

public boolean delete(K key)
Deletes the object using key

Returns:
true for a successful process
Throws:
IOException

deleteByQuery

public long deleteByQuery(org.apache.gora.query.Query<K,T> query)
Deletes items using a specific query

Throws:
IOException

getPartitions

public List<org.apache.gora.query.PartitionQuery<K,T>> getPartitions(org.apache.gora.query.Query<K,T> query)
                                                                                                             throws IOException
Throws:
IOException

flush

public void flush()

setBeanFactory

public void setBeanFactory(org.apache.gora.persistency.BeanFactory<K,T> beanFactory)

getBeanFactory

public org.apache.gora.persistency.BeanFactory<K,T> getBeanFactory()

close

public void close()


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