Class DynamoDb<T extends DynamoDb>

  • All Implemented Interfaces:
    java.lang.Comparable<T>

    public class DynamoDb<T extends DynamoDb>
    extends io.inversion.Db<T>
    • Nested Class Summary

      • Nested classes/interfaces inherited from class io.inversion.Rule

        io.inversion.Rule.RuleMatcher
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String awsAccessKey  
      protected java.lang.String awsEndpoint  
      protected java.lang.String awsRegion  
      protected java.lang.String awsSecretKey  
      protected int batchMax  
      protected com.amazonaws.services.dynamodbv2.AmazonDynamoDB dynamoClient  
      static java.lang.String GLOBAL_SECONDARY_INDEX_TYPE  
      static java.lang.String LOCAL_SECONDARY_INDEX_TYPE  
      static java.lang.String PRIMARY_INDEX_NAME  
      static java.lang.String PRIMARY_INDEX_TYPE  
      • Fields inherited from class io.inversion.Db

        bootstrap, collections, dryRun, excludeColumns, includeColumns, includeTables, log, reservedParams, type
      • Fields inherited from class io.inversion.Rule

        ALL_METHODS, configMap, description, excludeMatchers, excludeOn, includeMatchers, includeOn, name, order, params
    • Constructor Summary

      Constructors 
      Constructor Description
      DynamoDb()  
      DynamoDb​(java.lang.String name, java.lang.String includeTables)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected io.inversion.Index addTableIndex​(java.lang.String type, java.lang.String indexName, java.util.List<com.amazonaws.services.dynamodbv2.model.KeySchemaElement> keySchemaList, io.inversion.Collection collection, boolean unique, com.amazonaws.services.dynamodbv2.model.Projection projection, io.inversion.Index primaryIndex)  
      protected io.inversion.Collection buildCollection​(java.lang.String tableName, java.lang.String collectionName)  
      static com.amazonaws.services.dynamodbv2.AmazonDynamoDB buildDynamoClient​(java.lang.String awsRegion, java.lang.String awsAccessKey, java.lang.String awsSecretKey, java.lang.String awsEndpoint)  
      protected com.amazonaws.services.dynamodbv2.document.spec.UpdateItemSpec buildUpdateItemSpec​(io.inversion.Collection collection, java.util.Map<java.lang.String,​java.lang.Object> row)  
      void configDb()  
      void deleteRow​(io.inversion.Collection table, java.util.Map<java.lang.String,​java.lang.Object> row)  
      void doDelete​(io.inversion.Collection table, java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> indexValues)  
      io.inversion.Results doSelect​(io.inversion.Collection table, java.util.List<io.inversion.rql.Term> columnMappedTerms)  
      io.inversion.Results doSelect0​(io.inversion.Collection table, java.util.List<io.inversion.rql.Term> columnMappedTerms)  
      java.util.List<java.lang.String> doUpsert​(io.inversion.Collection collection, java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> rows)  
      static io.inversion.Index findIndexByName​(io.inversion.Collection coll, java.lang.String name)  
      com.amazonaws.services.dynamodbv2.AmazonDynamoDB getDynamoClient()  
      com.amazonaws.services.dynamodbv2.document.Table getDynamoTable​(io.inversion.Collection table)  
      com.amazonaws.services.dynamodbv2.document.Table getDynamoTable​(java.lang.String tableName)  
      protected static java.lang.String getTypeStringFromObject​(java.lang.Object obj)  
      java.lang.Object run​(java.util.concurrent.Callable statement)
      TODO: update all calls to DynamoDb to use this method to have consistent error handling.
      java.lang.String toString()  
      DynamoDb withAwsAccessKey​(java.lang.String awsAccessKey)  
      DynamoDb withAwsEndpoint​(java.lang.String awsEndpoint)  
      DynamoDb withAwsRegion​(java.lang.String awsRegion)  
      DynamoDb withAwsSecretKey​(java.lang.String awsSecretKey)  
      • Methods inherited from class io.inversion.Db

        beautifyCollectionName, beautifyName, buildCollections, buildRelationships, castDbOutput, castJsonInput, castJsonInput, configApi, delete, doPatch, doShutdown, doShutdown, doStartup, excludeTable, filterOutJsonProperty, getCollection, getCollectionByTableName, getCollections, getProperty, getType, isBootstrap, isDryRun, isRunning, isType, makeRelationshipName, mapToColumnNames, mapToColumnNames, mapToJsonNames, patch, removeCollection, select, shutdown, shutdown, startup, upsert, withBootstrap, withCollection, withCollections, withDryRun, withExcludeColumns, withIncludeColumns, withIncludeTable, withIncludeTables, withType
      • Methods inherited from class io.inversion.Rule

        afterWiringComplete, checkLazyConfig, compareTo, doLazyConfig, getAllExcludePaths, getAllIncludeMethods, getAllIncludePaths, getDefaultIncludeMatchers, getDescription, getExcludeMatchers, getIncludeMatchers, getName, getOrder, getParams, match, match, matches, matches, withDescription, withExcludeOn, withExcludeOn, withIncludeOn, withIncludeOn, withName, withOrder, withParam, withParams
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • PRIMARY_INDEX_NAME

        public static final java.lang.String PRIMARY_INDEX_NAME
        See Also:
        Constant Field Values
      • PRIMARY_INDEX_TYPE

        public static final java.lang.String PRIMARY_INDEX_TYPE
        See Also:
        Constant Field Values
      • LOCAL_SECONDARY_INDEX_TYPE

        public static final java.lang.String LOCAL_SECONDARY_INDEX_TYPE
        See Also:
        Constant Field Values
      • GLOBAL_SECONDARY_INDEX_TYPE

        public static final java.lang.String GLOBAL_SECONDARY_INDEX_TYPE
        See Also:
        Constant Field Values
      • awsAccessKey

        protected java.lang.String awsAccessKey
      • awsSecretKey

        protected java.lang.String awsSecretKey
      • awsRegion

        protected java.lang.String awsRegion
      • awsEndpoint

        protected java.lang.String awsEndpoint
      • dynamoClient

        protected transient com.amazonaws.services.dynamodbv2.AmazonDynamoDB dynamoClient
    • Constructor Detail

      • DynamoDb

        public DynamoDb()
      • DynamoDb

        public DynamoDb​(java.lang.String name,
                        java.lang.String includeTables)
    • Method Detail

      • findIndexByName

        public static io.inversion.Index findIndexByName​(io.inversion.Collection coll,
                                                         java.lang.String name)
      • getTypeStringFromObject

        protected static java.lang.String getTypeStringFromObject​(java.lang.Object obj)
      • buildDynamoClient

        public static com.amazonaws.services.dynamodbv2.AmazonDynamoDB buildDynamoClient​(java.lang.String awsRegion,
                                                                                         java.lang.String awsAccessKey,
                                                                                         java.lang.String awsSecretKey,
                                                                                         java.lang.String awsEndpoint)
      • doSelect

        public io.inversion.Results doSelect​(io.inversion.Collection table,
                                             java.util.List<io.inversion.rql.Term> columnMappedTerms)
                                      throws io.inversion.ApiException
        Overrides:
        doSelect in class io.inversion.Db<T extends DynamoDb>
        Throws:
        io.inversion.ApiException
      • doSelect0

        public io.inversion.Results doSelect0​(io.inversion.Collection table,
                                              java.util.List<io.inversion.rql.Term> columnMappedTerms)
                                       throws io.inversion.ApiException
        Throws:
        io.inversion.ApiException
      • doUpsert

        public java.util.List<java.lang.String> doUpsert​(io.inversion.Collection collection,
                                                         java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> rows)
                                                  throws io.inversion.ApiException
        Overrides:
        doUpsert in class io.inversion.Db<T extends DynamoDb>
        Throws:
        io.inversion.ApiException
      • buildUpdateItemSpec

        protected com.amazonaws.services.dynamodbv2.document.spec.UpdateItemSpec buildUpdateItemSpec​(io.inversion.Collection collection,
                                                                                                     java.util.Map<java.lang.String,​java.lang.Object> row)
      • doDelete

        public void doDelete​(io.inversion.Collection table,
                             java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> indexValues)
                      throws io.inversion.ApiException
        Overrides:
        doDelete in class io.inversion.Db<T extends DynamoDb>
        Throws:
        io.inversion.ApiException
      • run

        public java.lang.Object run​(java.util.concurrent.Callable statement)
        TODO: update all calls to DynamoDb to use this method to have consistent error handling.
        Parameters:
        statement -
        Returns:
      • deleteRow

        public void deleteRow​(io.inversion.Collection table,
                              java.util.Map<java.lang.String,​java.lang.Object> row)
                       throws io.inversion.ApiException
        Throws:
        io.inversion.ApiException
      • configDb

        public void configDb()
                      throws io.inversion.ApiException
        Overrides:
        configDb in class io.inversion.Db<T extends DynamoDb>
        Throws:
        io.inversion.ApiException
      • buildCollection

        protected io.inversion.Collection buildCollection​(java.lang.String tableName,
                                                          java.lang.String collectionName)
      • addTableIndex

        protected io.inversion.Index addTableIndex​(java.lang.String type,
                                                   java.lang.String indexName,
                                                   java.util.List<com.amazonaws.services.dynamodbv2.model.KeySchemaElement> keySchemaList,
                                                   io.inversion.Collection collection,
                                                   boolean unique,
                                                   com.amazonaws.services.dynamodbv2.model.Projection projection,
                                                   io.inversion.Index primaryIndex)
      • getDynamoTable

        public com.amazonaws.services.dynamodbv2.document.Table getDynamoTable​(io.inversion.Collection table)
      • getDynamoTable

        public com.amazonaws.services.dynamodbv2.document.Table getDynamoTable​(java.lang.String tableName)
      • withAwsRegion

        public DynamoDb withAwsRegion​(java.lang.String awsRegion)
      • withAwsAccessKey

        public DynamoDb withAwsAccessKey​(java.lang.String awsAccessKey)
      • withAwsSecretKey

        public DynamoDb withAwsSecretKey​(java.lang.String awsSecretKey)
      • withAwsEndpoint

        public DynamoDb withAwsEndpoint​(java.lang.String awsEndpoint)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class io.inversion.Rule<T extends DynamoDb>
      • getDynamoClient

        public com.amazonaws.services.dynamodbv2.AmazonDynamoDB getDynamoClient()