org.apache.rampart
Class NonceCache

java.lang.Object
  extended by org.apache.rampart.AbstractUniqueMessageAttributeCache
      extended by org.apache.rampart.NonceCache
All Implemented Interfaces:
UniqueMessageAttributeCache

public class NonceCache
extends AbstractUniqueMessageAttributeCache

This is a basic implementation of UniqueMessageAttributeCache. In this implementation we will cache incomming nonce value for a period of time. The life time can be defined in the services.xml. If not defined the default value will be 5 minutes.


Constructor Summary
NonceCache()
           
NonceCache(int maxLifeTime)
           
 
Method Summary
 void addToCache(java.lang.String id, java.lang.String userName)
          Add value to a cache.
 void clearCache()
          Clears all recorded nonce values/sequence numbers.
 boolean valueExistsInCache(java.lang.String id, java.lang.String userName)
          Checks whether value already exists in the cache for a given user name.
 
Methods inherited from class org.apache.rampart.AbstractUniqueMessageAttributeCache
getMaximumLifeTimeOfAnAttribute, setMaximumLifeTimeOfAnAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonceCache

public NonceCache()

NonceCache

public NonceCache(int maxLifeTime)
Method Detail

addToCache

public void addToCache(java.lang.String id,
                       java.lang.String userName)
Description copied from interface: UniqueMessageAttributeCache
Add value to a cache. Value can be sequence or nonce value.

Parameters:
id - - Nonce value or sequence number.
userName - - User name parameter value of the UserNameToken.

valueExistsInCache

public boolean valueExistsInCache(java.lang.String id,
                                  java.lang.String userName)
Description copied from interface: UniqueMessageAttributeCache
Checks whether value already exists in the cache for a given user name.

Parameters:
id - - Nonce or sequence id value of the newly received message.
userName - - User name parameter value of the UserName token.
Returns:
Returns true if nonce or sequence id is already received for given user name. Else false.

clearCache

public void clearCache()
Description copied from interface: UniqueMessageAttributeCache
Clears all recorded nonce values/sequence numbers.