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 Modifier and Type Method Description voiddeleteSnapshot(String name)Deletes a snapshot using its name.default booleanhasStored()Gets whether a call persist to persistent storage has been successfully completed.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(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
-
hasStored
default boolean hasStored()
Gets whether a call persist to persistent storage has been successfully completed.The default implementation always returns
false- 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- if a configuration persistence problem occurs
-
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- if a configuration persistence problem occurs
-
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- 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.
-
-