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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceCallback 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 interfaceContains the info about the configuration snapshots -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteSnapshot(String name) Deletes a snapshot using its name.default booleanGets whether a call persist to persistent storage has been successfully completed.default booleanGets whether a call tostore(ModelNode, Set)will return aConfigurationPersister.PersistenceResourcethat will actually persist to persistent storage.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 the current configurationdefault StringTake a snapshot of the current configuration.store(org.jboss.dmr.ModelNode model, Set<PathAddress> affectedAddresses) Persist the given configuration model ifisPersisting()would returntrue, otherwise return a no-opConfigurationPersister.PersistenceResource.voidCalled once the xml has been successfully parsed, translated into updates, executed in the target controller and all services have started successfully.
-
Field Details
-
NULL_SNAPSHOT_INFO
-
-
Method Details
-
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 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
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
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:
-
snapshot
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
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
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.
-