Package org.forgerock.am.cts.api
Interface TokenStorageAdapter
public interface TokenStorageAdapter
Adapts the token to some activity against the connection type.
-
Method Summary
Modifier and TypeMethodDescriptionCreate the Token in the database.default PartialToken
Performs a delete against the Token ID provided.deleteAsync
(String tokenId, Options options) Performs a delete against the Token ID provided.boolean
Checks whether this storage adapter is available and ready to process.partialQuery
(TokenFilter query, Options options) Performs a partial query using the provided filter.patch
(String tokenId, TokenModifications modifications, Options options) Applies a patch to the database entry using the instructions contained within the TokenModification.query
(TokenFilter query, Options options) Performs a full-token query using the provided filter.Performs a read against the database and converts the result into a Token.startContinuousQuery
(TokenFilter filter, ContinuousQueryListener listener) Performs a continuous query using the provided filter.Update the Token based on whether there were any changes between the two.
-
Method Details
-
isAvailable
boolean isAvailable()Checks whether this storage adapter is available and ready to process.- Returns:
true
If this adapter is available and ready,false
otherwise.
-
create
Create the Token in the database.- Parameters:
token
- Non null Token to create.options
- Non null Options for the operations.- Returns:
- The newly created
Token
. - Throws:
DataLayerException
- If the operation failed, this exception will capture the reason.RuntimeException
- If the thread is interrupted while retrieving the token from promise.
-
read
Performs a read against the database and converts the result into a Token.- Parameters:
tokenId
- The id of the Token to read.options
- Non null Options for the operations.- Returns:
- Token if found, otherwise null.
- Throws:
DataLayerException
- If the operation failed, this exception will capture the reason.RuntimeException
- If the thread is interrupted while retrieving the token from promise.
-
update
Update the Token based on whether there were any changes between the two.- Parameters:
previous
- The non null previous Token to check against.updated
- The non null Token to update with.options
- Non nullOptions
to pass through to the underlying implementation.- Returns:
- A copy of the updated token. The token would contain the updated etag.
- Throws:
DataLayerException
- If the operation failed for a known reason.
-
delete
Performs a delete against the Token ID provided.- Parameters:
tokenId
- The non null Token ID to delete.options
- Non nullOptions
to pass through to the underlying implementation.- Returns:
- A
PartialToken
containing at least theCoreTokenField.TOKEN_ID
. - Throws:
DataLayerException
- If the operation failed, this exception will capture the reason.
-
deleteAsync
Performs a delete against the Token ID provided.- Parameters:
tokenId
- The non null Token ID to delete.options
- Non nullOptions
to pass through to the underlying implementation.- Returns:
- A promise of
PartialToken
containing at least theCoreTokenField.TOKEN_ID
. - Throws:
DataLayerException
- If the operation failed, this exception will capture the reason.
-
patch
PartialToken patch(String tokenId, TokenModifications modifications, Options options) throws DataLayerException Applies a patch to the database entry using the instructions contained within the TokenModification.- Parameters:
tokenId
- The ID of the token against which to apply the modifications.modifications
- The set of modifications to make to this token.options
- The non null Options for the operation.- Returns:
- A
PartialToken
containing at least theCoreTokenField.TOKEN_ID
. - Throws:
DataLayerException
- If the operation failed, this exception will capture the reason.RuntimeException
- If the thread is interrupted while retrieving the token from promise.
-
query
Performs a full-token query using the provided filter.- Parameters:
query
- The non null filter specification.options
- Non nullOptions
to pass through to the underlying implementation.- Returns:
- A collection of
Token
. - Throws:
DataLayerException
- If the operation failed, this exception will capture the reason.RuntimeException
- If the thread is interrupted while retrieving the token from promise.
-
partialQuery
Performs a partial query using the provided filter.- Parameters:
query
- The non null filter specification.options
- Non nullOptions
to pass through to the underlying implementation.- Returns:
- A collection of
PartialToken
. - Throws:
DataLayerException
- If the operation failed, this exception will capture the reason.RuntimeException
- If the thread is interrupted while retrieving the token from promise.
-
startContinuousQuery
ContinuousQuery startContinuousQuery(TokenFilter filter, ContinuousQueryListener listener) throws DataLayerException Performs a continuous query using the provided filter.- Parameters:
filter
- The non null filter specification.- Returns:
- An instance of ContinuousQuery.
- Throws:
DataLayerException
- If the operation failed, this exception will capture the reason.
-