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. The storage service is partitioned. This is to allow different objects to use the service, each with its own partition, without the worry of conflicting keys.


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

Method Detail

contains

boolean contains(java.lang.String partition,
                 KeyType key)
Checks if a given key exists.

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

getPartitions

java.util.Iterator<java.lang.String> getPartitions()
Gets the partitions within the service. Removal of a partition identifier from the iterator removes the partition from the storage service.

Returns:
partitions within the service

getKeys

java.util.Iterator<KeyType> getKeys(java.lang.String partition)
Gets the keys for entries in the storage service. Removal of a key from the iterator removes the the key and associated value from the store. Note: this operation may be very expensive

Parameters:
partition - partition on which to operate
Returns:
list of keys currently within the store

get

ValueType get(java.lang.String partition,
              KeyType key)
Gets the value stored under a particular key.

Parameters:
partition - partition on which to operate
key - the key
Returns:
the value for that key, or null if there is no value for the given key

put

ValueType put(java.lang.String partition,
              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:
partition - partition on which to operate
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(java.lang.String partition,
                 KeyType key)
Removes an item from storage.

Parameters:
partition - partition on which to operate
key - the key to the value to remove
Returns:
the value that was removed


Copyright © 2006-2011 Internet2. All Rights Reserved.