Package org.forgerock.am.cts.api
Interface TokenStorageAdapter
-
public interface TokenStorageAdapterAdapts the token to some activity against the connection type.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Tokencreate(Token token, Options options)Create the Token in the database.default PartialTokendelete(String tokenId, Options options)Performs a delete against the Token ID provided.Promise<PartialToken,DataLayerException>deleteAsync(String tokenId, Options options)Performs a delete against the Token ID provided.booleanisAvailable()Checks whether this storage adapter is available and ready to process.Collection<PartialToken>partialQuery(TokenFilter query, Options options)Performs a partial query using the provided filter.PartialTokenpatch(String tokenId, TokenModifications modifications, Options options)Applies a patch to the database entry using the instructions contained within the TokenModification.Collection<Token>query(TokenFilter query, Options options)Performs a full-token query using the provided filter.Tokenread(String tokenId, Options options)Performs a read against the database and converts the result into a Token.ContinuousQuerystartContinuousQuery(TokenFilter filter, ContinuousQueryListener listener)Performs a continuous query using the provided filter.Tokenupdate(Token previous, Token updated, Options options)Update the Token based on whether there were any changes between the two.
-
-
-
Method Detail
-
isAvailable
boolean isAvailable()
Checks whether this storage adapter is available and ready to process.- Returns:
trueIf this adapter is available and ready,falseotherwise.
-
create
Token create(Token token, Options options) throws DataLayerException
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
Token read(String tokenId, Options options) throws DataLayerException
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
Token update(Token previous, Token updated, Options options) throws DataLayerException
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 nullOptionsto 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
default PartialToken delete(String tokenId, Options options) throws DataLayerException
Performs a delete against the Token ID provided.- Parameters:
tokenId- The non null Token ID to delete.options- Non nullOptionsto pass through to the underlying implementation.- Returns:
- A
PartialTokencontaining at least theCoreTokenField.TOKEN_ID. - Throws:
DataLayerException- If the operation failed, this exception will capture the reason.
-
deleteAsync
Promise<PartialToken,DataLayerException> deleteAsync(String tokenId, Options options)
Performs a delete against the Token ID provided.- Parameters:
tokenId- The non null Token ID to delete.options- Non nullOptionsto pass through to the underlying implementation.- Returns:
- A promise of
PartialTokencontaining 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
PartialTokencontaining 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
Collection<Token> query(TokenFilter query, Options options) throws DataLayerException
Performs a full-token query using the provided filter.- Parameters:
query- The non null filter specification.options- Non nullOptionsto 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
Collection<PartialToken> partialQuery(TokenFilter query, Options options) throws DataLayerException
Performs a partial query using the provided filter.- Parameters:
query- The non null filter specification.options- Non nullOptionsto 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.
-
-