Class 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 Details

    • NonceCache

      public NonceCache()
    • NonceCache

      public NonceCache(int maxLifeTime)
  • Method Details

    • addToCache

      public void addToCache(String id, 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(String id, 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.