Package org.opensaml.core.xml.persist

# Interface XMLObjectLoadSaveManager<T extends XMLObject>

Type Parameters:
  `T` - the base type of XML objects being managed

All Known Subinterfaces:
  `ConditionalLoadXMLObjectLoadSaveManager<T>`

All Known Implementing Classes:
  `AbstractConditionalLoadXMLObjectLoadSaveManager`, `FilesystemLoadSaveManager`, `MapLoadSaveManager`

public interface XMLObjectLoadSaveManager<T extends XMLObject>
Interface for a component which is capable of loading and saving instances of `XMLObject`, based on a string key.

The index key strategy used is determined by the caller.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`exists(String key)`
Evaluate whether an object already exists indexed by the supplied key.
`Iterable<Pair<String,T>>`
`listAll()`
Return an iterable of all objects under management, along with their associated index key.
`Set<String>`
`listKeys()`
Return a set of the index keys of all objects under management.
`T`
`load(String key)`
Load a particular object based on the supplied key.
`boolean`
`remove(String key)`
Remove the object indexed by the specified key.
`void`
`save(String key, T xmlObject)`
Save a particular object, indexed by the supplied key.
`void`
`save(String key, T xmlObject, boolean overwrite)`
Save a particular object, indexed by the supplied key.
`boolean`
`updateKey(String currentKey, String newKey)`
Update the key under which a particular object is stored.

## Method Details

### listKeys

@Nonnull @NotLive @Unmodifiable Set<String> listKeys() throws IOException
Return a set of the index keys of all objects under management.

Returns:
  a set of all indexed keys
Throws:
  `IOException` - if there is a fatal error obtaining the keys

### listAll

@Nonnull @NotLive @Unmodifiable Iterable<Pair<String,T>> listAll() throws IOException
Return an iterable of all objects under management, along with their associated index key.

Returns:
  an iterable of all managed objects
Throws:
  `IOException` - if there is a fatal error loading the managed objects

### exists

boolean exists(@Nonnull @NotEmpty String key) throws IOException
Evaluate whether an object already exists indexed by the supplied key.

Parameters:
  `key` - the key of the desired object
Returns:
  true if object exists, false otherwise
Throws:
  `IOException` - if there is a fatal error evaluating object existence

### load

@Nullable T load(@Nonnull @NotEmpty String key) throws IOException
Load a particular object based on the supplied key.

Parameters:
  `key` - the key of the desired object
Returns:
  the object saved under the specified key, or null if there is no such object
Throws:
  `IOException` - if there is a fatal error loading the object

### save

void save(@Nonnull @NotEmpty String key, @Nonnull T xmlObject) throws IOException
Save a particular object, indexed by the supplied key.

An existing object indexed by the supplied key will not be overwritten. Instead an `IOException` will be thrown. For saving with the overwrite option, see `save(String, XMLObject, boolean)`.

Parameters:
  `key` - the key under which to index the object
  `xmlObject` - the object to save
Throws:
  `IOException` - if there is a fatal error saving the object, or if an object already exists indexed by the supplied key

### save

void save(@Nonnull @NotEmpty String key, @Nonnull T xmlObject, boolean overwrite) throws IOException
Save a particular object, indexed by the supplied key.

Parameters:
  `key` - the key under which to index the object
  `xmlObject` - the object to save
  `overwrite` - whether or not to overwrite any existing object indexed by the supplied key
Throws:
  `IOException` - if there is a fatal error saving the object, or if overwrite=false, if an object already exists indexed by the supplied key

### remove

boolean remove(@Nonnull @NotEmpty String key) throws IOException
Remove the object indexed by the specified key.

Parameters:
  `key` - the key of the object to remove
Returns:
  true if the object was found and successfully removed, false if no such object was found
Throws:
  `IOException` - if there was a fatal error removing the object

### updateKey

boolean updateKey(@Nonnull @NotEmpty String currentKey, @Nonnull @NotEmpty String newKey) throws IOException
Update the key under which a particular object is stored.

Parameters:
  `currentKey` - the current key under which the object is stored
  `newKey` - the new key under which the object should be stored
Returns:
  true if the object was found under the current key and the key successfully updated, false if no such object was found
Throws:
  `IOException` - if there was a fatal error updating the key