Class TokenDataStore<T>
- java.lang.Object
-
- org.forgerock.openam.sm.datalayer.store.TokenDataStore<T>
-
- Type Parameters:
T- The object type being stored.
public class TokenDataStore<T> extends Object
A generic token store that can read an write a java bean,T, that has annotations to support conversion to and from a Token.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTokenDataStore.FilterTypeDifferent ways to combine criteria in a filter.
-
Constructor Summary
Constructors Constructor Description TokenDataStore(JavaBeanAdapter<T> adapter, TaskExecutor taskExecutor, TaskFactory taskFactory)Create a new TokenDataStore.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate(T obj)Create an object.voiddelete(String id)Remove an object with the given ID from the store.Set<T>query(org.forgerock.util.query.QueryFilter<String> query)Query the store for instances.Tread(String id)Reads aTout of the store using its OpenAM Unique ID.voidupdate(T obj)Update a given instance.
-
-
-
Constructor Detail
-
TokenDataStore
public TokenDataStore(JavaBeanAdapter<T> adapter, TaskExecutor taskExecutor, TaskFactory taskFactory)
Create a new TokenDataStore. This could be called from an extension class, or constructed as a raw store.- Parameters:
adapter- The Java bean token adapter for the type of bean being stored as tokens.taskExecutor- The data layer task executor, for executing operations on the data store. Should be aSimpleTaskExecutor.taskFactory- The task factory for creating data store operations.
-
-
Method Detail
-
create
public void create(T obj) throws ServerException
Create an object. The id field will be populated with the resulting identifier.- Parameters:
obj- The object being created.- Throws:
ServerException- When an error occurs during creation.
-
read
public T read(String id) throws NotFoundException, ServerException
Reads aTout of the store using its OpenAM Unique ID.- Parameters:
id- The OpenAM Unique ID assigned to the object.- Returns:
- The object, T.
- Throws:
NotFoundException- If the object is not found.ServerException- When the object cannot be loaded.
-
update
public void update(T obj) throws NotFoundException, ServerException
Update a given instance.- Parameters:
obj- The object being updated.- Throws:
ServerException- When the object cannot be found, or an error occurs during update.NotFoundException
-
delete
public void delete(String id) throws NotFoundException, ServerException
Remove an object with the given ID from the store.- Parameters:
id- The identifier of the object being removed.- Throws:
ServerException- When an error occurs during removal.NotFoundException
-
query
public Set<T> query(org.forgerock.util.query.QueryFilter<String> query) throws ServerException
Query the store for instances.- Parameters:
query- The criteria of the query, usingTbean property names as fields.- Returns:
- A set of all matching objects.
- Throws:
ServerException- When an error occurs when querying the store.
-
-