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

Fields
Modifier and Type
Field
Description
`private final Map<String,Map<String,MutableStorageRecord<?>>>`
`contextMap`
The underlying map of data records.
`private boolean`
`dirty`
Dirty bit.
`private ClientStorageService.ClientStorageSource`
`source`
Data source.

## Constructor Summary

Constructors
Constructor
Description
`AbstractClientStorageServiceStore()`
Reconstitute stored data.

## Method Summary

Modifier and Type
Method
Description
`abstract void`
`doLoad(String raw)`
Reconstitute stored data.
`Map<String,Map<String,MutableStorageRecord<?>>>`
`getContextMap()`
Get the map of contexts to manipulate during operations.
`ClientStorageService.ClientStorageSource`
`getSource()`
Get the data source.
`boolean`
`isDirty()`
Get the dirty bit for the current data.
`void`
`load(String raw, ClientStorageService.ClientStorageSource src)`
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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### contextMap

@Nonnull private final Map<String,Map<String,MutableStorageRecord<?>>> contextMap
The underlying map of data records.

### source

@Nullable private ClientStorageService.ClientStorageSource source
Data source.

### dirty

private boolean dirty
Dirty bit.

## Constructor Details

### AbstractClientStorageServiceStore

AbstractClientStorageServiceStore()
Reconstitute stored data.

## Method Details

### getSource

@Nullable public ClientStorageService.ClientStorageSource getSource()
Get the data source.

Specified by:
  `getSource` in interface `ClientStorageServiceStore`
Returns:
  data source

### isDirty

public boolean isDirty()
Get the dirty bit for the current data.

Specified by:
  `isDirty` in interface `ClientStorageServiceStore`
Returns:
  status of dirty bit

### setDirty

public void setDirty(boolean flag)
Set the dirty bit for the current data.

Specified by:
  `setDirty` in interface `ClientStorageServiceStore`
Parameters:
  `flag` - dirty bit to set

### getContextMap

@Nonnull @Live public Map<String,Map<String,MutableStorageRecord<?>>> getContextMap()
Get the map of contexts to manipulate during operations.

Specified by:
  `getContextMap` in interface `ClientStorageServiceStore`
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 interface `ClientStorageServiceStore`
Parameters:
  `raw` - serialized data to load
  `src` - 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:
  `save` in interface `ClientStorageServiceStore`
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