Class DynamoDocumentStore

java.lang.Object
com.codename1.backend.document.DynamoDocumentStore
All Implemented Interfaces:
DocumentStore, Closeable, AutoCloseable

public final class DynamoDocumentStore extends Object implements DocumentStore

DocumentStore over DynamoDB: one table per collection, named tablePrefix + collection, keyed by the partition key and, for a two-column key, the sort key.

A lookup by the whole key is a GetItem. A query with an equality on the partition key is a Query over that partition, with at most one comparison on the sort key in the key condition and the other comparisons as a filter. Anything else is a Scan with the comparisons as a filter expression. LIKE, ordering and paging are applied in memory afterwards. Dates are stored as epoch milliseconds, the form DynamoDB's TTL and numeric comparisons expect.

  • Constructor Summary

    Constructors
    Constructor
    Description
    A store over db, with every table name prefixed by tablePrefix (which may be empty) so environments can share an account.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Releases the store's connections.
    long
    count(String collection, String[] keyFields, List criteria)
    How many documents match every criterion.
    boolean
    delete(String collection, String[] keyFields, Object[] key, String versionField, Object expectedVersion)
    Deletes the document with this key; returns whether there was one.
    void
    ensureCollection(String collection, String[] keyFields, boolean[] numericKeys)
    Prepares a collection keyed by keyFields, each a number where numericKeys says so and a string otherwise; an existing one is kept.
    find(String collection, String[] keyFields, List criteria, String sortField, boolean ascending, int offset, int limit)
    The documents matching every criterion, ordered by sortField (null for the store's order), skipping offset and returning at most limit (negative for no limit).
    get(String collection, String[] keyFields, Object[] key)
    The document with this key, or null.
    boolean
    insert(String collection, String[] keyFields, Map document)
    Inserts a new document; returns false when one with the same key exists.
    A new identifier for a document whose id is generated.
    boolean
    replace(String collection, String[] keyFields, Map document, String versionField, Object expectedVersion)
    Replaces the document with the same key.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait