Interface SQLRecordTransformer<K,V>
-
public interface SQLRecordTransformer<K,V>
Interface for transforming between Infinispan entries (key / value pair and metadata) and a corresponding SQL record. Implementations must be thread-safe.To specify an entry transformer for a given Infinispan cache that is backed by an SQL store, provide its class name to the
store configuration
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SQLRecordTransformer.InitParameters
SQL transformer initialisation parameters.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getCreateTableStatement()
Returns the SQL statement to create a table for the entries.java.lang.String
getTableName()
Returns the associated SQL table name.void
init(SQLRecordTransformer.InitParameters initParams)
Initialises the SQL transformer.java.util.Collection<org.jooq.Condition>
resolveSelectionConditions(K key)
Resolves the SQL selection conditions for the specified Infinispan entry key.com.nimbusds.infinispan.persistence.common.InfinispanEntry<K,V>
toInfinispanEntry(RetrievedSQLRecord sqlRecord)
Transforms the specified SQL record to an Infinispan entry (key / value / metadata triple).SQLRecord
toSQLRecord(com.nimbusds.infinispan.persistence.common.InfinispanEntry<K,V> infinispanEntry)
Transforms the specified Infinispan entry (key / value pair with optional metadata) to an SQL record ready to be written.
-
-
-
Method Detail
-
init
void init(SQLRecordTransformer.InitParameters initParams)
Initialises the SQL transformer.- Parameters:
initParams
- The initialisation parameters.
-
getCreateTableStatement
java.lang.String getCreateTableStatement()
Returns the SQL statement to create a table for the entries. Typically required at SQL store startup if the underlying table doesn't exist yet. The statement must be aware of the SQL dialect of theconfigured
database.- Returns:
- The SQL create table statement.
-
getTableName
java.lang.String getTableName()
Returns the associated SQL table name.- Returns:
- The table name.
-
resolveSelectionConditions
java.util.Collection<org.jooq.Condition> resolveSelectionConditions(K key)
Resolves the SQL selection conditions for the specified Infinispan entry key.- Parameters:
key
- The Infinispan entry key. Notnull
.- Returns:
- One or more WHERE conditions.
-
toSQLRecord
SQLRecord toSQLRecord(com.nimbusds.infinispan.persistence.common.InfinispanEntry<K,V> infinispanEntry)
Transforms the specified Infinispan entry (key / value pair with optional metadata) to an SQL record ready to be written.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 SQL record:
uid: cae7t (key) surname: Adams given_name: Alice email: [email protected]
- Parameters:
infinispanEntry
- The Infinispan entry. Notnull
.- Returns:
- The SQL record.
-
toInfinispanEntry
com.nimbusds.infinispan.persistence.common.InfinispanEntry<K,V> toInfinispanEntry(RetrievedSQLRecord sqlRecord)
Transforms the specified SQL record to an Infinispan entry (key / value / metadata triple).Example:
SQL record:
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:
sqlRecord
- The SQL record. Must not benull
.- Returns:
- The Infinispan entry (key / value pair with optional metadata).
-
-