@ThreadSafeAfterInit
public interface StorageService
extends net.shibboleth.utilities.java.support.component.IdentifiedComponent
StorageCapabilities
interface to describe storage limitations.
Storage is divided into "contexts" identified by a string label. Keys need to be unique only within a given context, so multiple components can share a single store safely as long as they use different labels.
The allowable sizes for contexts and keys can vary and be reported by the implementation to callers, but MUST be at least 255 characters.
Expiration is expressed in milliseconds since the beginning of the epoch, or a null can be used to signify no expiration.
| Modifier and Type | Method and Description |
|---|---|
boolean |
create(java.lang.Object value)
Creates a new record in the store using an annotated object as the source.
|
boolean |
create(java.lang.String context,
java.lang.String key,
java.lang.Object value,
StorageSerializer serializer,
java.lang.Long expiration)
Creates a new record in the store with an expiration, using a custom serialization
process for an arbitrary object.
|
boolean |
create(java.lang.String context,
java.lang.String key,
java.lang.String value,
java.lang.Long expiration)
Creates a new record in the store with an expiration.
|
boolean |
delete(java.lang.Object value)
Deletes an existing record from the store, using an annotated object as the source.
|
boolean |
delete(java.lang.String context,
java.lang.String key)
Deletes an existing record from the store.
|
void |
deleteContext(java.lang.String context)
Forcibly removes all records in a given context along with any
associated resources devoted to maintaining the context.
|
boolean |
deleteWithVersion(long version,
java.lang.Object value)
Deletes an existing record from the store, using an annotated object as the source, if it
currently has a specified version.
|
boolean |
deleteWithVersion(long version,
java.lang.String context,
java.lang.String key)
Deletes an existing record from the store if it currently has a specified version.
|
StorageCapabilities |
getCapabilities()
Returns the capabilities of the underlying store.
|
java.lang.Object |
read(java.lang.Object value)
Returns an existing record from the store, if one exists, and uses it to
update the annotated fields of a target object.
|
StorageRecord |
read(java.lang.String context,
java.lang.String key)
Returns an existing record from the store, if one exists.
|
net.shibboleth.utilities.java.support.collection.Pair<java.lang.Long,StorageRecord> |
read(java.lang.String context,
java.lang.String key,
long version)
Returns an existing record from the store, along with its version.
|
void |
reap(java.lang.String context)
Manually trigger a cleanup of expired records.
|
boolean |
update(java.lang.Object value)
Updates an existing record in the store, using an annotated object as the source.
|
boolean |
update(java.lang.String context,
java.lang.String key,
java.lang.Object value,
StorageSerializer serializer,
java.lang.Long expiration)
Updates an existing record in the store using a custom serialization strategy.
|
boolean |
update(java.lang.String context,
java.lang.String key,
java.lang.String value,
java.lang.Long expiration)
Updates an existing record in the store.
|
void |
updateContextExpiration(java.lang.String context,
java.lang.Long expiration)
Updates the expiration time of all records in the context.
|
boolean |
updateExpiration(java.lang.Object value)
Updates expiration of an existing record in the store, using an annotated object as the source.
|
boolean |
updateExpiration(java.lang.String context,
java.lang.String key,
java.lang.Long expiration)
Updates expiration of an existing record in the store.
|
java.lang.Long |
updateWithVersion(long version,
java.lang.Object value)
Updates an existing record in the store, if a version matches, using an annotated object as the source.
|
java.lang.Long |
updateWithVersion(long version,
java.lang.String context,
java.lang.String key,
java.lang.Object value,
StorageSerializer serializer,
java.lang.Long expiration)
Updates an existing record in the store, if a version matches, using a custom serialization strategy.
|
java.lang.Long |
updateWithVersion(long version,
java.lang.String context,
java.lang.String key,
java.lang.String value,
java.lang.Long expiration)
Updates an existing record in the store, if a version matches.
|
@Nonnull StorageCapabilities getCapabilities()
boolean create(@Nonnull @NotEmpty
java.lang.String context,
@Nonnull @NotEmpty
java.lang.String key,
@Nonnull @NotEmpty
java.lang.String value,
@Nullable @Positive
java.lang.Long expiration)
throws java.io.IOException
context - a storage context labelkey - a key unique to contextvalue - value to storeexpiration - expiration for record, or nulljava.io.IOException - if fatal errors occur in the insertion processboolean create(@Nonnull @NotEmpty
java.lang.String context,
@Nonnull @NotEmpty
java.lang.String key,
@Nonnull
java.lang.Object value,
@Nonnull
StorageSerializer serializer,
@Nullable @Positive
java.lang.Long expiration)
throws java.io.IOException
context - a storage context labelkey - a key unique to contextvalue - object to storeserializer - custom serializer for the objectexpiration - expiration for record, or nulljava.io.IOException - if fatal errors occur in the insertion processboolean create(@Nonnull
java.lang.Object value)
throws java.io.IOException
The individual parameters for the creation are extracted from the object using the annotations in the org.opensaml.storage.annotation package. If any are missing, or a field inaccessible, a runtime exception of some kind will occur.
value - object to storejava.io.IOException - if fatal errors occur in the insertion process@Nullable StorageRecord read(@Nonnull @NotEmpty java.lang.String context, @Nonnull @NotEmpty java.lang.String key) throws java.io.IOException
context - a storage context labelkey - a key unique to contextjava.io.IOException - if errors occur in the read process@Nullable
java.lang.Object read(@Nonnull
java.lang.Object value)
throws java.io.IOException
The context and key to look up are obtained from the target object, and the value and expiration are written back, using the annotations in the org.opensaml.storage.annotation package. If any are missing, or a field inaccessible, a runtime exception of some kind will occur.
value - object to look up and populatejava.io.IOException - if errors occur in the read process@Nonnull net.shibboleth.utilities.java.support.collection.Pair<java.lang.Long,StorageRecord> read(@Nonnull @NotEmpty java.lang.String context, @Nonnull @NotEmpty java.lang.String key, @Positive long version) throws java.io.IOException
The first member of the pair returned will contain the version of the record in the store, or will be null if no record exists. The second member will contain the record read back. If null, the record either didn't exist (if the first member was also null) or the record was the same version as that supplied by the caller.
context - a storage context labelkey - a key unique to contextversion - only return record if newer than supplied versionjava.io.IOException - if errors occur in the read processboolean update(@Nonnull @NotEmpty
java.lang.String context,
@Nonnull @NotEmpty
java.lang.String key,
@Nonnull @NotEmpty
java.lang.String value,
@Nullable @Positive
java.lang.Long expiration)
throws java.io.IOException
context - a storage context labelkey - a key unique to contextvalue - updated valueexpiration - expiration for record, or nulljava.io.IOException - if errors occur in the update process@Nullable
java.lang.Long updateWithVersion(@Positive
long version,
@Nonnull @NotEmpty
java.lang.String context,
@Nonnull @NotEmpty
java.lang.String key,
@Nonnull @NotEmpty
java.lang.String value,
@Nullable @Positive
java.lang.Long expiration)
throws java.io.IOException,
VersionMismatchException
version - only update if the current version matches this valuecontext - a storage context labelkey - a key unique to contextvalue - updated valueexpiration - expiration for record, or nulljava.io.IOException - if errors occur in the update processVersionMismatchException - if the record has already been updated to a newer versionboolean update(@Nonnull @NotEmpty
java.lang.String context,
@Nonnull @NotEmpty
java.lang.String key,
@Nonnull
java.lang.Object value,
@Nonnull
StorageSerializer serializer,
@Nullable @Positive
java.lang.Long expiration)
throws java.io.IOException
context - a storage context labelkey - a key unique to contextvalue - updated valueserializer - custom serializerexpiration - expiration for record, or nulljava.io.IOException - if errors occur in the update process@Nullable
java.lang.Long updateWithVersion(@Positive
long version,
@Nonnull @NotEmpty
java.lang.String context,
@Nonnull @NotEmpty
java.lang.String key,
@Nonnull
java.lang.Object value,
@Nonnull
StorageSerializer serializer,
@Nullable @Positive
java.lang.Long expiration)
throws java.io.IOException,
VersionMismatchException
version - only update if the current version matches this valuecontext - a storage context labelkey - a key unique to contextvalue - updated valueserializer - custom serializerexpiration - expiration for record, or nulljava.io.IOException - if errors occur in the update processVersionMismatchException - if the record has already been updated to a newer versionboolean update(@Nonnull
java.lang.Object value)
throws java.io.IOException
The individual parameters for the update are extracted from the object using the annotations in the org.opensaml.storage.annotation package. If any are missing, or a field inaccessible, a runtime exception of some kind will occur.
value - object to update fromjava.io.IOException - if errors occur in the update process@Nullable
java.lang.Long updateWithVersion(@Positive
long version,
@Nonnull
java.lang.Object value)
throws java.io.IOException,
VersionMismatchException
The individual parameters for the update are extracted from the object using the annotations in the org.opensaml.storage.annotation package. If any are missing, or a field inaccessible, a runtime exception of some kind will occur.
version - only update if the current version matches this valuevalue - object to update fromjava.io.IOException - if errors occur in the update processVersionMismatchException - if the record has already been updated to a newer versionboolean updateExpiration(@Nonnull @NotEmpty
java.lang.String context,
@Nonnull @NotEmpty
java.lang.String key,
@Nullable @Positive
java.lang.Long expiration)
throws java.io.IOException
context - a storage context labelkey - a key unique to contextexpiration - expiration for record, or nulljava.io.IOException - if errors occur in the update processboolean updateExpiration(@Nonnull
java.lang.Object value)
throws java.io.IOException
The individual parameters for the update are extracted from the object using the annotations in the org.opensaml.storage.annotation package. If any are missing, or a field inaccessible, a runtime exception of some kind will occur.
value - object to update fromjava.io.IOException - if errors occur in the update processboolean delete(@Nonnull @NotEmpty
java.lang.String context,
@Nonnull @NotEmpty
java.lang.String key)
throws java.io.IOException
context - a storage context labelkey - a key unique to contextjava.io.IOException - if errors occur in the deletion processboolean deleteWithVersion(@Positive
long version,
@Nonnull @NotEmpty
java.lang.String context,
@Nonnull @NotEmpty
java.lang.String key)
throws java.io.IOException,
VersionMismatchException
version - record version to deletecontext - a storage context labelkey - a key unique to contextjava.io.IOException - if errors occur in the deletion processVersionMismatchException - if the record has already been updated to a newer versionboolean delete(@Nonnull
java.lang.Object value)
throws java.io.IOException
The individual parameters for the deletion are extracted from the object using the annotations in the org.opensaml.storage.annotation package. If any are missing, or a field inaccessible, a runtime exception of some kind will occur.
value - object to deletejava.io.IOException - if errors occur in the deletion processboolean deleteWithVersion(@Positive
long version,
@Nonnull
java.lang.Object value)
throws java.io.IOException,
VersionMismatchException
The individual parameters for the deletion are extracted from the object using the annotations in the org.opensaml.storage.annotation package. If any are missing, or a field inaccessible, a runtime exception of some kind will occur.
version - record version to deletevalue - object to deletejava.io.IOException - if errors occur in the deletion processVersionMismatchException - if the record has already been updated to a newer versionvoid reap(@Nonnull @NotEmpty
java.lang.String context)
throws java.io.IOException
context - a storage context labeljava.io.IOException - if errors occur in the cleanup processvoid updateContextExpiration(@Nonnull @NotEmpty
java.lang.String context,
@Nullable
java.lang.Long expiration)
throws java.io.IOException
context - a storage context labelexpiration - a new expiration timestamp, or nulljava.io.IOException - if errors occur in the cleanup processvoid deleteContext(@Nonnull @NotEmpty
java.lang.String context)
throws java.io.IOException
context - a storage context labeljava.io.IOException - if errors occur in the cleanup process