Interface ConfigurationPersister
-
- All Known Subinterfaces:
ExtensibleConfigurationPersister
- All Known Implementing Classes:
AbstractConfigurationPersister,BackupXmlConfigurationPersister,NullConfigurationPersister,XmlConfigurationPersister
public interface ConfigurationPersisterThe configuration persister for a model.- Author:
- David M. Lloyd
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceConfigurationPersister.PersistenceResourceCallback 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 interfaceConfigurationPersister.SnapshotInfoContains the info about the configuration snapshots
-
Field Summary
Fields Modifier and Type Field Description static ConfigurationPersister.SnapshotInfoNULL_SNAPSHOT_INFO
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voiddeleteSnapshot(String name)Deletes a snapshot using its name.default booleanisPersisting()Gets whether a call tostore(ModelNode, Set)will return aConfigurationPersister.PersistenceResourcethat will actually persist to persistent storage.ConfigurationPersister.SnapshotInfolistSnapshots()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.voidmarshallAsXml(org.jboss.dmr.ModelNode model, OutputStream output)Marshals the given configuration model to XML, writing to the given stream.default Stringpublish(String target)Publish the current configurationdefault Stringsnapshot()Deprecated.use #snapshot(String name, String message) instead.default Stringsnapshot(String name, String message)Take a snapshot of the current configuration.ConfigurationPersister.PersistenceResourcestore(org.jboss.dmr.ModelNode model, Set<PathAddress> affectedAddresses)Persist the given configuration model ifisPersisting()would returntrue, otherwise return a no-opConfigurationPersister.PersistenceResource.voidsuccessfulBoot()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.PersistenceResourcethat will actually persist to persistent storage. Some implementations may returnfalseuntilsuccessfulBoot()is invoked. If this returnsfalsethe caller can safely omit any call tostore(ModelNode, Set).The default implementation always returns
true- Returns:
trueif 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
-
marshallAsXml
void marshallAsXml(org.jboss.dmr.ModelNode model, OutputStream output) throws ConfigurationPersistenceExceptionMarshals 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
-
successfulBoot
void successfulBoot() throws ConfigurationPersistenceExceptionCalled once the xml has been successfully parsed, translated into updates, executed in the target controller and all services have started successfully.- Throws:
ConfigurationPersistenceException- See Also:
isPersisting()
-
snapshot
@Deprecated default String snapshot() throws ConfigurationPersistenceException
Deprecated.use #snapshot(String name, String message) instead.Take a snapshot of the current configuration- Returns:
- the file location of the snapshot
- Throws:
ConfigurationPersistenceException- if a problem happened when creating the snapshot
-
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.
-
-