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.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Initialisation context.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the DynamoDB hash key attribute name.
    default String
    Returns the optional DynamoDB range key attribute name.
    Returns the base name of the DynamoDB table.
    default String
    Returns the optional DynamoDB time-to-live attribute name.
    default void
    Provides initialisation.
    Deprecated.
    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 Details

    • init

      default void init(DynamoDBItemTransformer.InitContext initContext)
      Provides initialisation.
      Parameters:
      initContext - The initialisation context.
    • 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

      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

      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

      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.
      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

      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,V> toInfinispanEntry(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).