org.opensaml.util.storage
Interface StorageService<KeyType,ValueType>

Type Parameters:
KeyType - object type of the keys
ValueType - object type of the values
All Known Implementing Classes:
MapBasedStorageService

public interface StorageService<KeyType,ValueType>

Generic data storage facility for use by services that require some degree of persistence. Implementations will vary in how much persistence they can supply.


Method Summary
 boolean contains(KeyType key)
          Checks if a given key exists.
 ValueType get(KeyType key)
          Gets the value stored under a particular key.
 java.util.Collection<KeyType> getKeys()
          Gets the keys for entries in the storage service.
 ValueType put(KeyType key, ValueType value)
          Adds a value, indexed by a key, in to storage.
 ValueType remove(KeyType key)
          Removes an item from storage.
 

Method Detail

contains

boolean contains(KeyType key)
Checks if a given key exists.

Parameters:
key - the key to check
Returns:
true of the given key exists, false if not

getKeys

java.util.Collection<KeyType> getKeys()
Gets the keys for entries in the storage service. Note: this operation may be very expensive

Returns:
list of keys currently within the store

get

ValueType get(KeyType key)
Gets the value stored under a particular key.

Parameters:
key - the key
Returns:
the value for that key, or null if there is no value for the given key

put

ValueType put(KeyType key,
              ValueType value)
Adds a value, indexed by a key, in to storage. Note that implementations of this service may determine, on its own, when to evict items from storage, the expiration time given here is meant only as a system provided hint.

Parameters:
key - the key
value - the value
Returns:
the value that was registered under that key previously, if there was a previous value

remove

ValueType remove(KeyType key)
Removes an item from storage.

Parameters:
key - the key to the value to remove
Returns:
the value that was removed