Package org.opensaml.storage.impl.client
Class AbstractClientStorageServiceStore
java.lang.Object
org.opensaml.storage.impl.client.AbstractClientStorageServiceStore
- All Implemented Interfaces:
ClientStorageServiceStore
- Direct Known Subclasses:
JSONClientStorageServiceStore
,XMLClientStorageServiceStore
public abstract class AbstractClientStorageServiceStore
extends Object
implements ClientStorageServiceStore
Base class for the storage and reconstitution of data for a
ClientStorageService
.- Since:
- 4.1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensaml.storage.impl.client.ClientStorageServiceStore
ClientStorageServiceStore.Factory
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String,
Map<String, MutableStorageRecord<?>>> The underlying map of data records.private boolean
Dirty bit.private final org.slf4j.Logger
Class logger.Data source. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Reconstitute stored data.Get the map of contexts to manipulate during operations.Get the data source.boolean
isDirty()
Get the dirty bit for the current data.void
Reconstitute stored data.abstract ClientStorageServiceOperation
save
(ClientStorageService storageService) Serialize current state of stored data into a storage operation.void
setDirty
(boolean flag) Set the dirty bit for the current data.
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
contextMap
The underlying map of data records. -
source
Data source. -
dirty
private boolean dirtyDirty bit.
-
-
Constructor Details
-
AbstractClientStorageServiceStore
AbstractClientStorageServiceStore()Reconstitute stored data.
-
-
Method Details
-
getSource
Get the data source.- Specified by:
getSource
in interfaceClientStorageServiceStore
- Returns:
- data source
-
isDirty
public boolean isDirty()Get the dirty bit for the current data.- Specified by:
isDirty
in interfaceClientStorageServiceStore
- Returns:
- status of dirty bit
-
setDirty
public void setDirty(boolean flag) Set the dirty bit for the current data.- Specified by:
setDirty
in interfaceClientStorageServiceStore
- Parameters:
flag
- dirty bit to set
-
getContextMap
@Nonnull @NonnullElements @Live public Map<String,Map<String, getContextMap()MutableStorageRecord<?>>> Get the map of contexts to manipulate during operations.- Specified by:
getContextMap
in interfaceClientStorageServiceStore
- Returns:
- map of contexts to manipulate
-
load
public void load(@Nullable @NotEmpty String raw, @Nonnull ClientStorageService.ClientStorageSource src) Reconstitute stored data.The dirty bit is set based on the result. If successful, the bit is cleared, but if an error occurs, it will be set.
By design this method should not throw under any non-catastrophic conditions.
- Specified by:
load
in interfaceClientStorageServiceStore
- Parameters:
raw
- serialized data to loadsrc
- storage source
-
doLoad
Reconstitute stored data.- Parameters:
raw
- serialized data to load- Throws:
IOException
- if an error occurs
-
save
@Nullable public abstract ClientStorageServiceOperation save(@Nonnull ClientStorageService storageService) throws IOException Serialize current state of stored data into a storage operation.- Specified by:
save
in interfaceClientStorageServiceStore
- Parameters:
storageService
- storage service- Returns:
- the operation, or a null if the data has not been modified since loading or saving
- Throws:
IOException
- if an error occurs
-