Class BackupXmlConfigurationPersister
java.lang.Object
org.jboss.as.controller.persistence.AbstractConfigurationPersister
org.jboss.as.controller.persistence.XmlConfigurationPersister
org.jboss.as.controller.persistence.BackupXmlConfigurationPersister
- All Implemented Interfaces:
ConfigurationPersister,ExtensibleConfigurationPersister,SubsystemXmlWriterRegistry
An XML configuration persister which backs up the old file before overwriting it.
- Author:
- David M. Lloyd
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.as.controller.persistence.ConfigurationPersister
ConfigurationPersister.PersistenceResource, ConfigurationPersister.SnapshotInfo -
Field Summary
Fields inherited from class org.jboss.as.controller.persistence.XmlConfigurationPersister
storedFields inherited from interface org.jboss.as.controller.persistence.ConfigurationPersister
NULL_SNAPSHOT_INFO -
Constructor Summary
ConstructorsConstructorDescriptionBackupXmlConfigurationPersister(ConfigurationFile file, QName rootElement, org.jboss.staxmapper.XMLElementReader<List<org.jboss.dmr.ModelNode>> rootParser, org.jboss.staxmapper.XMLElementWriter<ModelMarshallingContext> rootDeparser, boolean suppressLoad) Construct a new instance.BackupXmlConfigurationPersister(ConfigurationFile file, QName rootElement, org.jboss.staxmapper.XMLElementReader<List<org.jboss.dmr.ModelNode>> rootParser, org.jboss.staxmapper.XMLElementWriter<ModelMarshallingContext> rootDeparser, boolean reload, boolean allowEmpty) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteSnapshot(String name) Deletes a snapshot using its name.booleanOverrides the default behavior to returnfalseuntilsuccessfulBoot()has been called.Gets the names of the snapshots in the snapshots directoryvoidregisterAdditionalRootElement(QName anotherRoot, org.jboss.staxmapper.XMLElementReader<List<org.jboss.dmr.ModelNode>> parser) Take a snapshot of the current configuration.store(org.jboss.dmr.ModelNode model, Set<PathAddress> affectedAddresses) Persist the given configuration model ifConfigurationPersister.isPersisting()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.Methods inherited from class org.jboss.as.controller.persistence.XmlConfigurationPersister
hasStored, load, successfulBootMethods inherited from class org.jboss.as.controller.persistence.AbstractConfigurationPersister
marshallAsXml, registerSubsystemWriter, unregisterSubsystemWriterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.as.controller.persistence.ConfigurationPersister
publish
-
Constructor Details
-
BackupXmlConfigurationPersister
public BackupXmlConfigurationPersister(ConfigurationFile file, QName rootElement, org.jboss.staxmapper.XMLElementReader<List<org.jboss.dmr.ModelNode>> rootParser, org.jboss.staxmapper.XMLElementWriter<ModelMarshallingContext> rootDeparser, boolean suppressLoad) Construct a new instance.- Parameters:
file- the configuration base filerootElement- the root element of the configuration filerootParser- the root model parserrootDeparser- the root model deparser
-
BackupXmlConfigurationPersister
public BackupXmlConfigurationPersister(ConfigurationFile file, QName rootElement, org.jboss.staxmapper.XMLElementReader<List<org.jboss.dmr.ModelNode>> rootParser, org.jboss.staxmapper.XMLElementWriter<ModelMarshallingContext> rootDeparser, boolean reload, boolean allowEmpty) Construct a new instance.- Parameters:
file- the configuration base filerootElement- the root element of the configuration filerootParser- the root model parserrootDeparser- the root model deparserreload-trueif this is a reloadallowEmpty-trueiftrueit is ok for this file to be 0 bytes otherwise this is an error
-
-
Method Details
-
registerAdditionalRootElement
public void registerAdditionalRootElement(QName anotherRoot, org.jboss.staxmapper.XMLElementReader<List<org.jboss.dmr.ModelNode>> parser) - Overrides:
registerAdditionalRootElementin classXmlConfigurationPersister
-
successfulBoot
Description copied from interface:ConfigurationPersisterCalled once the xml has been successfully parsed, translated into updates, executed in the target controller and all services have started successfully.- Specified by:
successfulBootin interfaceConfigurationPersister- Overrides:
successfulBootin classAbstractConfigurationPersister- Throws:
ConfigurationPersistenceException- if a configuration persistence problem occurs- See Also:
-
isPersisting
public boolean isPersisting()Overrides the default behavior to returnfalseuntilsuccessfulBoot()has been called.- Returns:
trueifsuccessfulBoot()has been called;falseotherwise
-
store
public ConfigurationPersister.PersistenceResource store(org.jboss.dmr.ModelNode model, Set<PathAddress> affectedAddresses) throws ConfigurationPersistenceException Description copied from class:XmlConfigurationPersisterPersist the given configuration model ifConfigurationPersister.isPersisting()would returntrue, otherwise return a no-opConfigurationPersister.PersistenceResource.- Specified by:
storein interfaceConfigurationPersister- Overrides:
storein classXmlConfigurationPersister- 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
-
snapshot
Description copied from interface:ConfigurationPersisterTake a snapshot of the current configuration.comment- optionnal message- Returns:
- the file location of the snapshot
- Throws:
ConfigurationPersistenceException- if a problem happened when creating the snapshot
-
listSnapshots
Description copied from interface:ConfigurationPersisterGets the names of the snapshots in the snapshots directory- Specified by:
listSnapshotsin interfaceConfigurationPersister- Overrides:
listSnapshotsin classAbstractConfigurationPersister- Returns:
- the snapshot info. This will never return null
-
deleteSnapshot
Description copied from interface:ConfigurationPersisterDeletes a snapshot using its name.- Specified by:
deleteSnapshotin interfaceConfigurationPersister- Overrides:
deleteSnapshotin classAbstractConfigurationPersister- Parameters:
name- the name of the snapshot (as returned byConfigurationPersister.SnapshotInfo.names()returned fromConfigurationPersister.listSnapshots(). The whole name is not needed, just enough to uniquely identify it.
-