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 aClientStorageService.- Since:
- 4.1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opensaml.storage.impl.client.ClientStorageServiceStore
ClientStorageServiceStore.Factory
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,Map<String,MutableStorageRecord<?>>>contextMapThe underlying map of data records.private booleandirtyDirty bit.private org.slf4j.LoggerlogClass logger.private ClientStorageService.ClientStorageSourcesourceData source.
-
Constructor Summary
Constructors Constructor Description AbstractClientStorageServiceStore()Reconstitute stored data.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voiddoLoad(String raw)Reconstitute stored data.Map<String,Map<String,MutableStorageRecord<?>>>getContextMap()Get the map of contexts to manipulate during operations.ClientStorageService.ClientStorageSourcegetSource()Get the data source.booleanisDirty()Get the dirty bit for the current data.voidload(String raw, ClientStorageService.ClientStorageSource src)Reconstitute stored data.abstract ClientStorageServiceOperationsave(ClientStorageService storageService)Serialize current state of stored data into a storage operation.voidsetDirty(boolean flag)Set the dirty bit for the current data.
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
contextMap
@Nonnull @NonnullElements private final Map<String,Map<String,MutableStorageRecord<?>>> contextMap
The underlying map of data records.
-
source
@Nonnull private ClientStorageService.ClientStorageSource source
Data source.
-
dirty
private boolean dirty
Dirty bit.
-
-
Method Detail
-
getSource
@Nonnull public ClientStorageService.ClientStorageSource getSource()
Get the data source.- Specified by:
getSourcein interfaceClientStorageServiceStore- Returns:
- data source
-
isDirty
public boolean isDirty()
Get the dirty bit for the current data.- Specified by:
isDirtyin interfaceClientStorageServiceStore- Returns:
- status of dirty bit
-
setDirty
public void setDirty(boolean flag)
Set the dirty bit for the current data.- Specified by:
setDirtyin interfaceClientStorageServiceStore- Parameters:
flag- dirty bit to set
-
getContextMap
@Nonnull @NonnullElements @Live public Map<String,Map<String,MutableStorageRecord<?>>> getContextMap()
Get the map of contexts to manipulate during operations.- Specified by:
getContextMapin 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:
loadin interfaceClientStorageServiceStore- Parameters:
raw- serialized data to loadsrc- storage source
-
doLoad
public abstract void doLoad(@Nullable @NotEmpty String raw) throws IOException
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:
savein 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
-
-