public class DynamoDbDataContext extends QueryPostprocessDataContext implements UpdateableDataContext, Closeable
Modifier and Type | Field and Description |
---|---|
static String |
SCHEMA_NAME
The artificial schema name used by this DataContext.
|
static String |
SYSTEM_PROPERTY_THROUGHPUT_READ_CAPACITY
System property key used for getting the read throughput capacity when
creating new tables.
|
static String |
SYSTEM_PROPERTY_THROUGHPUT_WRITE_CAPACITY
System property key used for getting the write throughput capacity when
creating new tables.
|
INFORMATION_SCHEMA_NAME
Constructor and Description |
---|
DynamoDbDataContext() |
DynamoDbDataContext(com.amazonaws.services.dynamodbv2.AmazonDynamoDB client) |
DynamoDbDataContext(com.amazonaws.services.dynamodbv2.AmazonDynamoDB client,
SimpleTableDef[] tableDefs) |
DynamoDbDataContext(SimpleTableDef[] tableDefs) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected Number |
executeCountQuery(Table table,
List<FilterItem> whereItems,
boolean functionApproximationAllowed)
Executes a simple count query, if possible.
|
protected Row |
executePrimaryKeyLookupQuery(Table table,
List<SelectItem> selectItems,
Column primaryKeyColumn,
Object keyValue)
Executes a query which obtains a row by primary key (as defined by
Column.isPrimaryKey() ). |
UpdateSummary |
executeUpdate(UpdateScript update)
Submits an
UpdateScript for execution on the DataContext . |
com.amazonaws.services.dynamodbv2.AmazonDynamoDB |
getDynamoDb() |
protected Schema |
getMainSchema() |
protected String |
getMainSchemaName() |
protected DataSet |
materializeMainSchemaTable(Table table,
Column[] columns,
int maxRows)
Executes a simple one-table query against a table in the main schema of
the subclasses of this class.
|
addConverter, executeQuery, getDefaultSchemaName, getSchemaByNameInternal, getSchemaNamesInternal, isMainSchemaTable, isScalarFunctionMaterialized, materializeFromItem, materializeMainSchemaTable, materializeMainSchemaTable, materializeMainSchemaTable, materializeTable
compileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, onSchemaCacheRefreshed, parseQuery, query, refreshSchemas
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compileQuery, executeQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, parseQuery, query, refreshSchemas
public static final String SYSTEM_PROPERTY_THROUGHPUT_READ_CAPACITY
public static final String SYSTEM_PROPERTY_THROUGHPUT_WRITE_CAPACITY
public static final String SCHEMA_NAME
public DynamoDbDataContext()
public DynamoDbDataContext(SimpleTableDef[] tableDefs)
public DynamoDbDataContext(com.amazonaws.services.dynamodbv2.AmazonDynamoDB client)
public DynamoDbDataContext(com.amazonaws.services.dynamodbv2.AmazonDynamoDB client, SimpleTableDef[] tableDefs)
public com.amazonaws.services.dynamodbv2.AmazonDynamoDB getDynamoDb()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
protected Schema getMainSchema() throws MetaModelException
getMainSchema
in class QueryPostprocessDataContext
MetaModelException
protected String getMainSchemaName() throws MetaModelException
getMainSchemaName
in class QueryPostprocessDataContext
MetaModelException
protected Number executeCountQuery(Table table, List<FilterItem> whereItems, boolean functionApproximationAllowed)
QueryPostprocessDataContext
executeCountQuery
in class QueryPostprocessDataContext
table
- the table on which the count is requested.whereItems
- a (sometimes empty) list of WHERE items.functionApproximationAllowed
- whether approximation is allowed or not.protected DataSet materializeMainSchemaTable(Table table, Column[] columns, int maxRows)
QueryPostprocessDataContext
materializeMainSchemaTable
in class QueryPostprocessDataContext
table
- the table to querycolumns
- the columns of the table to querymaxRows
- the maximum amount of rows needed or -1 if all rows are
wanted.protected Row executePrimaryKeyLookupQuery(Table table, List<SelectItem> selectItems, Column primaryKeyColumn, Object keyValue)
QueryPostprocessDataContext
Column.isPrimaryKey()
). This method is provided to allow
subclasses to optimize lookup queries since they are quite common and
often a datastore can retrieve the row using some specialized means which
is much more performant than scanning all records manually.executePrimaryKeyLookupQuery
in class QueryPostprocessDataContext
table
- the table on which the lookup is requested.selectItems
- the items to select from the lookup query.primaryKeyColumn
- the column that is the primary keykeyValue
- the primary key value that is specified in the lookup query.public UpdateSummary executeUpdate(UpdateScript update)
UpdateableDataContext
UpdateScript
for execution on the DataContext
.
Since implementations of the DataContext
vary quite a lot, there
is no golden rule as to how an update script will be executed. But the
implementors should strive towards handling an UpdateScript
as a
single transactional change to the data store.executeUpdate
in interface UpdateableDataContext
update
- the update script to executeCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.