com.atlassian.crowd.model.token
Class TokenDAOMemory

java.lang.Object
  extended by com.atlassian.crowd.model.token.TokenDAOMemory
All Implemented Interfaces:
TokenDAO, TokenDAOPersistence, ObjectDao

public class TokenDAOMemory
extends Object
implements TokenDAOPersistence

An in-memory implementation of the TokenDAO. This will use the caching manager. Note: this is not thead-safe!


Field Summary
protected static String IDENTIFIER_HASH_CAHE
           
protected static String RANDOM_HASH_CACHE
           
 
Constructor Summary
TokenDAOMemory()
           
 
Method Summary
 Token add(Token token)
           
 Token findByID(long ID)
           
 Token findByIdentifierHash(String identifierHash)
           
 Token findByRandomHash(String randomHash)
           
 Class getPersistentClass()
          The class that is being persisted
 Object load(long ID)
          Loads a persistnce DAO object from the persistence store.
 Collection<Token> loadAll()
          TokenDAOPersistence.loadAll()
 void remove(long directoryId, String name)
           
 void remove(Object persistentObject)
          Removes the DAO object from the persistence store.
 void remove(Token token)
           
 void removeAccessedBefore(Date expiryTime)
           
 void removeAll()
          TokenDAOPersistence.removeAll()
 void removeAll(long directoryId)
           
 void save(Object persistentObject)
          Saves a new DAO object to the persistence store.
 void saveAll(Collection<Token> tokens)
          TokenDAOPersistence.saveAll()
 List<Token> search(EntityQuery query)
           
 void setCacheManager(CacheManager cacheManager)
           
 void update(Object persistentObject)
          Updates an existing DAO object, if the object does not exist it will be added to the persistence store.
 Token update(Token token)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANDOM_HASH_CACHE

protected static final String RANDOM_HASH_CACHE

IDENTIFIER_HASH_CAHE

protected static final String IDENTIFIER_HASH_CAHE
Constructor Detail

TokenDAOMemory

public TokenDAOMemory()
Method Detail

findByRandomHash

public Token findByRandomHash(String randomHash)
                       throws ObjectNotFoundException
Specified by:
findByRandomHash in interface TokenDAO
Throws:
ObjectNotFoundException

findByIdentifierHash

public Token findByIdentifierHash(String identifierHash)
                           throws ObjectNotFoundException
Specified by:
findByIdentifierHash in interface TokenDAO
Throws:
ObjectNotFoundException

add

public Token add(Token token)
Specified by:
add in interface TokenDAO

update

public Token update(Token token)
Specified by:
update in interface TokenDAO
Parameters:
token - token to update.
Returns:
updates the last accessed date on the token (sets it to now).

remove

public void remove(Token token)
Specified by:
remove in interface TokenDAO

search

public List<Token> search(EntityQuery query)
Specified by:
search in interface TokenDAO

findByID

public Token findByID(long ID)
               throws ObjectNotFoundException
Specified by:
findByID in interface TokenDAO
Throws:
ObjectNotFoundException

remove

public void remove(long directoryId,
                   String name)
Specified by:
remove in interface TokenDAO

removeAll

public void removeAll(long directoryId)
Specified by:
removeAll in interface TokenDAO

removeAccessedBefore

public void removeAccessedBefore(Date expiryTime)
Specified by:
removeAccessedBefore in interface TokenDAO

getPersistentClass

public Class getPersistentClass()
Description copied from interface: ObjectDao
The class that is being persisted

Specified by:
getPersistentClass in interface ObjectDao
Returns:
Class

save

public void save(Object persistentObject)
Description copied from interface: ObjectDao
Saves a new DAO object to the persistence store.

Specified by:
save in interface ObjectDao
Parameters:
persistentObject - The object to save.

update

public void update(Object persistentObject)
Description copied from interface: ObjectDao
Updates an existing DAO object, if the object does not exist it will be added to the persistence store.

Specified by:
update in interface ObjectDao
Parameters:
persistentObject - The object to update.

remove

public void remove(Object persistentObject)
Description copied from interface: ObjectDao
Removes the DAO object from the persistence store.

Specified by:
remove in interface ObjectDao
Parameters:
persistentObject - The object to remove.

load

public Object load(long ID)
Description copied from interface: ObjectDao
Loads a persistnce DAO object from the persistence store.

Specified by:
load in interface ObjectDao
Parameters:
ID - The unique identifier of the object to load from the persistence store.
Returns:
Object The populated object from the database

setCacheManager

public void setCacheManager(CacheManager cacheManager)

loadAll

public Collection<Token> loadAll()
TokenDAOPersistence.loadAll()

Specified by:
loadAll in interface TokenDAOPersistence
Returns:
Collection of all active tokens.

saveAll

public void saveAll(Collection<Token> tokens)
TokenDAOPersistence.saveAll()

Specified by:
saveAll in interface TokenDAOPersistence
Parameters:
tokens - all tokens to add.

removeAll

public void removeAll()
TokenDAOPersistence.removeAll()

Specified by:
removeAll in interface TokenDAO
Specified by:
removeAll in interface TokenDAOPersistence


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.