Interface DynamoDBItemTransformer<K,​V>


  • public interface DynamoDBItemTransformer<K,​V>
    Interface for transforming between Infinispan entries (key / value pair and metadata) and a corresponding DynamoDB item. Implementations must be thread-safe.

    To specify an entry transformer for a given Infinispan cache that is backed by a DynamoDB store, provide its class name to the store configuration.

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String getHashKeyAttributeName()
      Returns the DynamoDB hash key attribute name.
      default java.lang.String getRangeKeyAttributeName()
      Returns the optional DynamoDB range key attribute name.
      java.lang.String getTableName()
      Returns the base name of the DynamoDB table.
      default java.lang.String getTTLAttributeName()
      Returns the optional DynamoDB time-to-live attribute name.
      default void init​(DynamoDBItemTransformer.InitContext initContext)
      Provides initialisation.
      java.lang.String resolveHashKey​(K key)
      Deprecated.
      default PrimaryKeyValue resolvePrimaryKey​(K key)
      Resolves the DynamoDB primary key (hash key value of scalar attribute type string, with optional additional range key value) for the specified Infinispan entry key.
      com.nimbusds.infinispan.persistence.common.InfinispanEntry<K,​V> toInfinispanEntry​(com.amazonaws.services.dynamodbv2.document.Item item)
      Transforms the specified DynamoDB item to an Infinispan entry (key / value / metadata triple).
      com.amazonaws.services.dynamodbv2.document.Item toItem​(com.nimbusds.infinispan.persistence.common.InfinispanEntry<K,​V> infinispanEntry)
      Transforms the specified Infinispan entry (key / value pair with optional metadata) to a DynamoDB item.
    • Method Detail

      • getTableName

        java.lang.String getTableName()
        Returns the base name of the DynamoDB table. Required to create and to connect to the DynamoDB table for storing the cache entries. The final DynamoDB table name is formed by prefixing the optional configuration table-prefix to the base name.
        Returns:
        The table name.
      • getHashKeyAttributeName

        java.lang.String getHashKeyAttributeName()
        Returns the DynamoDB hash key attribute name. Required to create the DynamoDB table for storing the cache entries.
        Returns:
        The hash key attribute name.
      • getRangeKeyAttributeName

        default java.lang.String getRangeKeyAttributeName()
        Returns the optional DynamoDB range key attribute name. Required to create the DynamoDB table for storing the cache entries.
        Returns:
        The range key attribute name, null if none.
      • getTTLAttributeName

        default java.lang.String getTTLAttributeName()
        Returns the optional DynamoDB time-to-live attribute name. Required to create the DynamoDB table for the storing the cache entries with DynamoDB managed expiration.
        Returns:
        The TTL attribute name, null if none.
      • resolveHashKey

        @Deprecated
        java.lang.String resolveHashKey​(K key)
        Deprecated.
        Resolves the DynamoDB hash key value (of scalar attribute type string) for the specified Infinispan entry key.

        Use resolvePrimaryKey(Object) instead.

        Parameters:
        key - The Infinispan entry key. Not null.
        Returns:
        The DynamoDB hash key value.
      • resolvePrimaryKey

        default PrimaryKeyValue resolvePrimaryKey​(K key)
        Resolves the DynamoDB primary key (hash key value of scalar attribute type string, with optional additional range key value) for the specified Infinispan entry key.
        Parameters:
        key - The Infinispan entry key. Not null.
        Returns:
        The DynamoDB primary key value.
      • toItem

        com.amazonaws.services.dynamodbv2.document.Item toItem​(com.nimbusds.infinispan.persistence.common.InfinispanEntry<K,​V> infinispanEntry)
        Transforms the specified Infinispan entry (key / value pair with optional metadata) to a DynamoDB item.

        Example:

        Infinispan entry:

        • Key: cae7t
        • Value: Java POJO with fields uid=cae7t, givenName=Alice, surname=Adams and [email protected].
        • Metadata: Specifies the entry expiration and other properties.

        Resulting DynamoDB item:

         uid: cae7t (key)
         surname: Adams
         given_name: Alice
         email: [email protected]
         
        Parameters:
        infinispanEntry - The Infinispan entry. Not null.
        Returns:
        The DynamoDB item.
      • toInfinispanEntry

        com.nimbusds.infinispan.persistence.common.InfinispanEntry<K,​VtoInfinispanEntry​(com.amazonaws.services.dynamodbv2.document.Item item)
        Transforms the specified DynamoDB item to an Infinispan entry (key / value / metadata triple).

        Example:

        DynamoDB item:

         uid: cae7t
         surname: Adams
         given_name: Alice
         email: [email protected]
         

        Resulting Infinispan entry:

        • Key: cae7t
        • Value: Java POJO with fields uid=cae7t, givenName=Alice, surname=Adams and [email protected].
        • Metadata: Default metadata (no expiration, etc).
        Parameters:
        item - The DynamoDB item. Must not be null.
        Returns:
        The Infinispan entry (key / value pair with optional metadata).