Package org.forgerock.openam.cts
Interface CTSPersistentStore
-
- All Known Implementing Classes:
CTSPersistentStoreImpl,CTSPersistentStoreProxy
public interface CTSPersistentStoreCore Token Service Persistent Store is responsible for the storage and retrieval of Tokens from a persistent store. The Core Token Service is exposed through a series of CRUDL operations which require the use of TokenAdapters to convert from objects to be stored into the expected Core Token Service format. This allows the Tokens to be stored in a generic storage. The current main use cases for the CTS are: - Session fail-over - OAuth token storage - SAML Federation token storage - Forgotten Password The implementation of this interface must be thread safe as this service will often be on a direct call path from the front end of the Server hosting OpenAM, and so multiple calls to the service can occur at the same time from different calling threads.- See Also:
TokenAdapter,Token
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddContinuousQueryListener(ContinuousQueryListener listener, TokenFilter filter)Performs a continuous query against the persistent store using the provided TokenFilter.Collection<PartialToken>attributeQuery(TokenFilter tokenFilter)Performs a partial Token query against the store synchronously.voidcreate(Token token)Creates a Token in the persistent store synchronously.voidcreate(Token token, org.forgerock.util.Options options)Creates a Token in the persistent store synchronously.voidcreateAsync(Token token)Creates a Token in the persistent store asynchronously.voidcreateAsync(Token token, org.forgerock.util.Options options)Creates a Token in the persistent store asynchronously.voiddelete(String tokenId)Delete the Token from the store synchronously based on its id.voiddelete(String tokenId, org.forgerock.util.Options options)Delete the Token from the store synchronously based on its id.intdelete(Map<CoreTokenField,Object> query)Delete a collection of Tokens from the Token Store asynchronously using a filter to narrow down the Tokens to be deleted.voiddelete(Token token)Delete the Token from the store synchronously.voiddeleteAsync(String tokenId)Delete the Token from the store asynchronously based on its id.voiddeleteAsync(String tokenId, org.forgerock.util.Options options)Delete the Token from the store asynchronously based on its id.voiddeleteAsync(Token token)Deletes the Token from the store asynchronously.voiddeleteOnQueryAsync(TokenFilter tokenFilter)Performs an asynchronous query against the persistent store using the provided TokenFilter and then deletes the matching tokens from the store.Collection<Token>query(TokenFilter filter)Performs a synchronous query against the persistent store using the provided TokenFilter.Tokenread(String tokenId)Read a Token from the persistent store synchronously.Tokenread(String tokenId, org.forgerock.util.Options options)Read a Token from the persistent store synchronously.voidremoveContinuousQueryListener(ContinuousQueryListener listener, TokenFilter filter)Removes aContinuousQueryListenerfrom a specifiedTokenFilter.voidstopContinuousQuery(TokenFilter filter)Removes allContinuousQueryListeners and stops aContinuousQuerygenerated for a specifiedTokenFilter.voidupdate(Token token)Updates an existing Token in the store synchronously.voidupdate(Token token, org.forgerock.util.Options options)Updates an existing Token in the store synchronously.voidupdateAsync(Token token)Updates an existing Token in the store asynchronously.voidupdateAsync(Token token, org.forgerock.util.Options options)Updates an existing Token in the store asynchronously.
-
-
-
Method Detail
-
create
void create(Token token) throws CoreTokenException
Creates a Token in the persistent store synchronously.- Parameters:
token- Non null Token to create.- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the provided Token, or if the operation itself has failed.
-
create
void create(Token token, org.forgerock.util.Options options) throws CoreTokenException
Creates a Token in the persistent store synchronously.- Parameters:
token- Non null Token to create.options- Non null Options for the operation.- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the provided Token, or if the operation itself has failed.
-
createAsync
void createAsync(Token token) throws CoreTokenException
Creates a Token in the persistent store asynchronously. The result of the operation (success/failure) is ignored.- Parameters:
token- Non null Token to create.- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the provided Token.
-
createAsync
void createAsync(Token token, org.forgerock.util.Options options) throws CoreTokenException
Creates a Token in the persistent store asynchronously. The result of the operation (success/failure) is ignored.- Parameters:
token- Non null Token to create.options- Non null Options for the operation.- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the provided Token.
-
read
Token read(String tokenId) throws CoreTokenException
Read a Token from the persistent store synchronously.- Parameters:
tokenId- The non null Token Id that the Token was created with.- Returns:
- Null if there was no matching Token. Otherwise a fully populated Token will be returned.
- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the returned Token, or if the operation itself has failed.
-
read
Token read(String tokenId, org.forgerock.util.Options options) throws CoreTokenException
Read a Token from the persistent store synchronously.- Parameters:
tokenId- The non null Token Id that the Token was created with.options- The non null Options for the operation.- Returns:
- Null if there was no matching Token. Otherwise a fully populated Token will be returned.
- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the returned Token, or if the operation itself has failed.
-
update
void update(Token token) throws CoreTokenException
Updates an existing Token in the store synchronously. If the Token does not exist in the store then a Token is created. If the Token did exist in the store then it is updated. Not all fields of the Token can be updated, see the Token class for more details.- Parameters:
token- Non null Token to update.- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the provided Token, or if the operation itself has failed.- See Also:
Token.isFieldReadOnly(org.forgerock.openam.tokens.CoreTokenField)
-
update
void update(Token token, org.forgerock.util.Options options) throws CoreTokenException
Updates an existing Token in the store synchronously. If the Token does not exist in the store then a Token is created. If the Token did exist in the store then it is updated. Not all fields of the Token can be updated, see the Token class for more details.- Parameters:
token- Non null Token to update.options- Non null Options for the operation.- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the provided Token, or if the operation itself has failed.- See Also:
Token.isFieldReadOnly(org.forgerock.openam.tokens.CoreTokenField)
-
updateAsync
void updateAsync(Token token) throws CoreTokenException
Updates an existing Token in the store asynchronously. If the Token does not exist in the store then a Token is created. If the Token did exist in the store then it is updated. Not all fields of the Token can be updated, see the Token class for more details.- Parameters:
token- Non null Token to update.- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the provided Token.- See Also:
Token.isFieldReadOnly(org.forgerock.openam.tokens.CoreTokenField)
-
updateAsync
void updateAsync(Token token, org.forgerock.util.Options options) throws CoreTokenException
Updates an existing Token in the store asynchronously. If the Token does not exist in the store then a Token is created. If the Token did exist in the store then it is updated. Not all fields of the Token can be updated, see the Token class for more details.- Parameters:
token- Non null Token to update.options- Non null Options for the operation.- Throws:
CoreTokenException- If there was an error while performing the differentTokenBlobStrategys on the provided Token.- See Also:
Token.isFieldReadOnly(org.forgerock.openam.tokens.CoreTokenField)
-
delete
void delete(Token token) throws CoreTokenException
Delete the Token from the store synchronously.- Parameters:
token- Non null Token to be deleted from the store.- Throws:
CoreTokenException- If the delete operation has failed.
-
deleteAsync
void deleteAsync(Token token) throws CoreTokenException
Deletes the Token from the store asynchronously.- Parameters:
token- Non null Token to be deleted from the store.- Throws:
CoreTokenException
-
delete
void delete(String tokenId) throws CoreTokenException
Delete the Token from the store synchronously based on its id. Note: It is often more efficient to delete the token based on the Id if you already have this information, rather than reading the Token first before removing it.- Parameters:
tokenId- The non null Token Id of the token to remove.- Throws:
CoreTokenException- If the delete operation has failed.
-
delete
void delete(String tokenId, org.forgerock.util.Options options) throws CoreTokenException
Delete the Token from the store synchronously based on its id. Note: It is often more efficient to delete the token based on the Id if you already have this information, rather than reading the Token first before removing it.- Parameters:
tokenId- The non null Token Id of the token to remove.options- The non null Options for the operation.- Throws:
CoreTokenException- If the delete operation has failed.
-
deleteAsync
void deleteAsync(String tokenId) throws CoreTokenException
Delete the Token from the store asynchronously based on its id. Note: It is often more efficient to delete the token based on the Id if you already have this information, rather than reading the Token first before removing it.- Parameters:
tokenId- The non null Token Id of the token to remove.- Throws:
CoreTokenException
-
deleteAsync
void deleteAsync(String tokenId, org.forgerock.util.Options options) throws CoreTokenException
Delete the Token from the store asynchronously based on its id. Note: It is often more efficient to delete the token based on the Id if you already have this information, rather than reading the Token first before removing it.- Parameters:
tokenId- The non null Token Id of the token to remove.options- The non null Options for the operation.- Throws:
CoreTokenException
-
delete
int delete(Map<CoreTokenField,Object> query) throws CoreTokenException
Delete a collection of Tokens from the Token Store asynchronously using a filter to narrow down the Tokens to be deleted.- Parameters:
query- Non null filters which will be combined logically using AND.- Returns:
- total number of tokens deleted by query.
- Throws:
CoreTokenException- If there was an error while looking up the deletable Tokens.
-
addContinuousQueryListener
void addContinuousQueryListener(ContinuousQueryListener listener, TokenFilter filter) throws CoreTokenException
Performs a continuous query against the persistent store using the provided TokenFilter. The filter is assembled by the TokenFilterBuilder which provides the options on how to turn the query being performed. The filter is appropriate to the underlying persistent layer type. The continuous query will begin and the listener will be attached.- Parameters:
listener- A listener which is capable of handling the results from this continuous query.filter- Non null filter.- Throws:
CoreTokenException- If there was any error whilst performing the query.- See Also:
TokenFilter,TokenFilterBuilder
-
removeContinuousQueryListener
void removeContinuousQueryListener(ContinuousQueryListener listener, TokenFilter filter) throws CoreTokenException
Removes aContinuousQueryListenerfrom a specifiedTokenFilter.- Parameters:
listener- A listener which is already associated with a running continuous query.filter- Non null filter.- Throws:
CoreTokenException- See Also:
TokenFilter,TokenFilterBuilder
-
stopContinuousQuery
void stopContinuousQuery(TokenFilter filter)
Removes allContinuousQueryListeners and stops aContinuousQuerygenerated for a specifiedTokenFilter.- Parameters:
filter- Non null filter.- See Also:
ContinuousQueryListener,ContinuousQuery
-
query
Collection<Token> query(TokenFilter filter) throws CoreTokenException
Performs a synchronous query against the persistent store using the provided TokenFilter. The filter is assembled by the TokenFilterBuilder which provides the options on how to turn the query being performed.- Parameters:
filter- Non null filter.- Returns:
- Non null, but maybe empty.
- Throws:
CoreTokenException- If there was any error whilst performing the query.- See Also:
TokenFilter,TokenFilterBuilder
-
attributeQuery
Collection<PartialToken> attributeQuery(TokenFilter tokenFilter) throws CoreTokenException
Performs a partial Token query against the store synchronously. That is, a query which is aimed at specific attributes of a Token, rather than whole Tokens. The return result will consist of PartialTokens for this purpose. This function is useful for example, finding all Token IDs that match a certain criteria.- Parameters:
tokenFilter- Non null TokenFilter, with the return attributes defined.- Returns:
- Non null, but maybe empty.
- Throws:
CoreTokenException- If there was any error whilst performing the query.- See Also:
TokenFilter.addReturnAttribute(org.forgerock.openam.tokens.CoreTokenField),TokenFilterBuilder,PartialToken
-
deleteOnQueryAsync
void deleteOnQueryAsync(TokenFilter tokenFilter) throws CoreTokenException
Performs an asynchronous query against the persistent store using the provided TokenFilter and then deletes the matching tokens from the store.- Parameters:
tokenFilter- Non null filter.- Throws:
CoreTokenException- If there was a problem queuing the task to be performed.- See Also:
TokenFilterBuilder
-
-