public class FilePersistenceStrategy extends Object implements PersistenceStrategy
PersistenceStrategy
that serializes the
Identity
to a file.Constructor and Description |
---|
FilePersistenceStrategy(String path)
Create a new FilePersistenceStrategy.
|
Modifier and Type | Method and Description |
---|---|
Identity |
getIdentity(String name)
Retrieves an
Identity from the backend. |
Identity |
persistIdentity(Identity identity)
Persists the
Identity in the backend. |
boolean |
removeIdentity(Identity identity)
Removes an
Identity from the backend. |
Identity |
updateIdentity(Identity identity)
Updates the
Identity in the backend. |
public FilePersistenceStrategy(String path)
path
- directory where the files will be stored.public Identity persistIdentity(Identity identity)
PersistenceStrategy
Identity
in the backend.persistIdentity
in interface PersistenceStrategy
identity
- Identity
to be persisted.Identity
or null
if persistence failed.PersistenceStrategy.persistIdentity(Identity).
public Identity getIdentity(String name)
PersistenceStrategy
Identity
from the backend.getIdentity
in interface PersistenceStrategy
name
- unique name of the Identity
.Identity
or null
if not found.PersistenceStrategy.getIdentity(String).
public boolean removeIdentity(Identity identity)
PersistenceStrategy
Identity
from the backend.removeIdentity
in interface PersistenceStrategy
identity
- Identity
to be removed.true
if successfully removed, false
otherwise.PersistenceStrategy.removeIdentity(Identity).
public Identity updateIdentity(Identity identity)
PersistenceStrategy
Identity
in the backend.updateIdentity
in interface PersistenceStrategy
identity
- Identity
to be updated.Identity
or null
if the update was not successful.PersistenceStrategy.updateIdentity(Identity).
Copyright © 2020 JBoss by Red Hat. All rights reserved.