org.apache.rahas
Class SimpleTokenStore

java.lang.Object
  extended by org.apache.rahas.SimpleTokenStore
All Implemented Interfaces:
TokenStorage

public class SimpleTokenStore
extends java.lang.Object
implements TokenStorage

In-memory implementation of the token storage


Field Summary
protected  edu.emory.mathcs.backport.java.util.concurrent.locks.Lock readLock
           
protected  edu.emory.mathcs.backport.java.util.concurrent.locks.ReadWriteLock readWriteLock
          We use a read write lock to improve concurrency while avoiding concurrent modification exceptions.
protected  java.util.Map tokens
           
protected  edu.emory.mathcs.backport.java.util.concurrent.locks.Lock writeLock
           
 
Fields inherited from interface org.apache.rahas.TokenStorage
TOKEN_STORAGE_KEY
 
Constructor Summary
SimpleTokenStore()
           
 
Method Summary
 void add(Token token)
          Add the given token to the list.
 Token[] getCancelledTokens()
          Return the list of CANCELLED tokens
 Token[] getExpiredTokens()
          Return the list of EXPIRED tokens.
static java.lang.String getIdFromSTR(org.apache.axiom.om.OMElement str)
           
 Token[] getRenewedTokens()
          Return the list of RENEWED tokens.
 Token getToken(java.lang.String id)
          Returns the Token of the given id
 java.lang.String[] getTokenIdentifiers()
          Return the list of all token identifiers.
 Token[] getValidTokens()
          Return the list of ISSUED and RENEWED tokens.
protected  void processTokenExpiry()
           
 void update(Token token)
          Update an existing token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokens

protected java.util.Map tokens

readWriteLock

protected final edu.emory.mathcs.backport.java.util.concurrent.locks.ReadWriteLock readWriteLock
We use a read write lock to improve concurrency while avoiding concurrent modification exceptions. We allow concurrent reads and avoid concurrent reads and modifications ReentrantReadWriteLock supports a maximum of 65535 recursive write locks and 65535 read locks


readLock

protected final edu.emory.mathcs.backport.java.util.concurrent.locks.Lock readLock

writeLock

protected final edu.emory.mathcs.backport.java.util.concurrent.locks.Lock writeLock
Constructor Detail

SimpleTokenStore

public SimpleTokenStore()
Method Detail

add

public void add(Token token)
         throws TrustException
Description copied from interface: TokenStorage
Add the given token to the list.

Specified by:
add in interface TokenStorage
Parameters:
token - The token to be added
Throws:
TrustException

update

public void update(Token token)
            throws TrustException
Description copied from interface: TokenStorage
Update an existing token.

Specified by:
update in interface TokenStorage
Throws:
TrustException

getTokenIdentifiers

public java.lang.String[] getTokenIdentifiers()
                                       throws TrustException
Description copied from interface: TokenStorage
Return the list of all token identifiers.

Specified by:
getTokenIdentifiers in interface TokenStorage
Returns:
As array of token identifiers
Throws:
TrustException

getValidTokens

public Token[] getValidTokens()
                       throws TrustException
Description copied from interface: TokenStorage
Return the list of ISSUED and RENEWED tokens.

Specified by:
getValidTokens in interface TokenStorage
Returns:
An array of ISSUED and RENEWED Tokens.
Throws:
TrustException

getRenewedTokens

public Token[] getRenewedTokens()
                         throws TrustException
Description copied from interface: TokenStorage
Return the list of RENEWED tokens.

Specified by:
getRenewedTokens in interface TokenStorage
Returns:
An array of RENEWED Tokens
Throws:
TrustException

getCancelledTokens

public Token[] getCancelledTokens()
                           throws TrustException
Description copied from interface: TokenStorage
Return the list of CANCELLED tokens

Specified by:
getCancelledTokens in interface TokenStorage
Returns:
An array of CANCELLED Tokens
Throws:
TrustException

getExpiredTokens

public Token[] getExpiredTokens()
                         throws TrustException
Description copied from interface: TokenStorage
Return the list of EXPIRED tokens. If there are no EXPIRED tokens null will be returned

Specified by:
getExpiredTokens in interface TokenStorage
Returns:
An array of expired Tokens
Throws:
TrustException

getToken

public Token getToken(java.lang.String id)
               throws TrustException
Description copied from interface: TokenStorage
Returns the Token of the given id

Specified by:
getToken in interface TokenStorage
Returns:
The requested Token identified by the give id
Throws:
TrustException

processTokenExpiry

protected void processTokenExpiry()
                           throws TrustException
Throws:
TrustException

getIdFromSTR

public static java.lang.String getIdFromSTR(org.apache.axiom.om.OMElement str)