Interface ConfigurationPersister
-
- All Known Subinterfaces:
ExtensibleConfigurationPersister
- All Known Implementing Classes:
AbstractConfigurationPersister
,BackupXmlConfigurationPersister
,NullConfigurationPersister
,XmlConfigurationPersister
public interface ConfigurationPersister
The configuration persister for a model.- Author:
- David M. Lloyd
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ConfigurationPersister.PersistenceResource
Callback for use by callers tostore(org.jboss.dmr.ModelNode, java.util.Set)
to control whether the stored model should be flushed to permanent storage.static interface
ConfigurationPersister.SnapshotInfo
Contains the info about the configuration snapshots
-
Field Summary
Fields Modifier and Type Field Description static ConfigurationPersister.SnapshotInfo
NULL_SNAPSHOT_INFO
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
deleteSnapshot(String name)
Deletes a snapshot using its name.default boolean
isPersisting()
Gets whether a call tostore(ModelNode, Set)
will return aConfigurationPersister.PersistenceResource
that will actually persist to persistent storage.ConfigurationPersister.SnapshotInfo
listSnapshots()
Gets the names of the snapshots in the snapshots directoryList<org.jboss.dmr.ModelNode>
load()
Load the configuration model, returning it as a list of updates to be executed by the controller.void
marshallAsXml(org.jboss.dmr.ModelNode model, OutputStream output)
Marshals the given configuration model to XML, writing to the given stream.default String
publish(String target)
Publish the current configurationdefault String
snapshot(String name, String message)
Take a snapshot of the current configuration.ConfigurationPersister.PersistenceResource
store(org.jboss.dmr.ModelNode model, Set<PathAddress> affectedAddresses)
Persist the given configuration model ifisPersisting()
would returntrue
, otherwise return a no-opConfigurationPersister.PersistenceResource
.void
successfulBoot()
Called once the xml has been successfully parsed, translated into updates, executed in the target controller and all services have started successfully.
-
-
-
Field Detail
-
NULL_SNAPSHOT_INFO
static final ConfigurationPersister.SnapshotInfo NULL_SNAPSHOT_INFO
-
-
Method Detail
-
isPersisting
default boolean isPersisting()
Gets whether a call tostore(ModelNode, Set)
will return aConfigurationPersister.PersistenceResource
that will actually persist to persistent storage. Some implementations may returnfalse
untilsuccessfulBoot()
is invoked. If this returnsfalse
the caller can safely omit any call tostore(ModelNode, Set)
.The default implementation always returns
true
- Returns:
true
if a call tostore(ModelNode, Set)
will return an object that actually writes
-
store
ConfigurationPersister.PersistenceResource store(org.jboss.dmr.ModelNode model, Set<PathAddress> affectedAddresses) throws ConfigurationPersistenceException
Persist the given configuration model ifisPersisting()
would returntrue
, otherwise return a no-opConfigurationPersister.PersistenceResource
.- Parameters:
model
- the model to persistaffectedAddresses
- the addresses of the resources that were changed- Returns:
- callback to use to control whether the stored model should be flushed to permanent storage. Will not be
null
- Throws:
ConfigurationPersistenceException
- if a configuration persistence problem occurs
-
marshallAsXml
void marshallAsXml(org.jboss.dmr.ModelNode model, OutputStream output) throws ConfigurationPersistenceException
Marshals the given configuration model to XML, writing to the given stream.- Parameters:
model
- the model to persistoutput
- the stream- Throws:
ConfigurationPersistenceException
- if a configuration persistence problem occurs
-
load
List<org.jboss.dmr.ModelNode> load() throws ConfigurationPersistenceException
Load the configuration model, returning it as a list of updates to be executed by the controller.- Returns:
- the configuration model as a list of updates to be executed by the controller.
- Throws:
ConfigurationPersistenceException
- if a configuration persistence problem occurs
-
successfulBoot
void successfulBoot() throws ConfigurationPersistenceException
Called once the xml has been successfully parsed, translated into updates, executed in the target controller and all services have started successfully.- Throws:
ConfigurationPersistenceException
- if a configuration persistence problem occurs- See Also:
isPersisting()
-
snapshot
default String snapshot(String name, String message) throws ConfigurationPersistenceException
Take a snapshot of the current configuration.- Parameters:
message
- optionnal message- Returns:
- the file location of the snapshot
- Throws:
ConfigurationPersistenceException
- if a problem happened when creating the snapshot
-
publish
default String publish(String target) throws ConfigurationPersistenceException
Publish the current configuration- Parameters:
target
- the target destination of the publication.- Returns:
- the location of the published configuration
- Throws:
ConfigurationPersistenceException
- if a problem happened when publishing
-
listSnapshots
ConfigurationPersister.SnapshotInfo listSnapshots()
Gets the names of the snapshots in the snapshots directory- Returns:
- the snapshot info. This will never return null
-
deleteSnapshot
void deleteSnapshot(String name)
Deletes a snapshot using its name.- Parameters:
name
- the name of the snapshot (as returned byConfigurationPersister.SnapshotInfo.names()
returned fromlistSnapshots()
. The whole name is not needed, just enough to uniquely identify it.- Throws:
IllegalArgumentException
- if there is no snapshot with the given name, or if the name resolves to more than one snapshot.
-
-