Package jmri.configurexml
Class BlockManagerXml
- java.lang.Object
-
- All Implemented Interfaces:
XmlAdapter
public class BlockManagerXml extends AbstractMemoryManagerConfigXML
Persistency implementation for BlockManager persistence.The Block objects are not yet read in, pending a reliable write out!
Every block is written twice. First, the list of blocks is written without contents, so that we're sure they're all created on read-back. Then, they're written out again with contents, including the block references in the path elements.
- Since:
- 2.1.2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.configurexml.AbstractXmlAdapter
AbstractXmlAdapter.EnumIO<T extends java.lang.Enum<T>>, AbstractXmlAdapter.EnumIoMapped<T extends java.lang.Enum<T>>, AbstractXmlAdapter.EnumIoNames<T extends java.lang.Enum<T>>, AbstractXmlAdapter.EnumIoNamesNumbers<T extends java.lang.Enum<T>>, AbstractXmlAdapter.EnumIoOrdinals<T extends java.lang.Enum<T>>
-
-
Constructor Summary
Constructors Constructor Description BlockManagerXml()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
load(org.jdom2.Element sharedBlocks, org.jdom2.Element perNodeBlocks)
Load Blocks into the existing BlockManager.void
loadBeanSetting(Path path, org.jdom2.Element element)
Load BeanSetting into an existing Path.void
loadBlock(org.jdom2.Element element)
Utility method to load the individual Block objects.int
loadOrder()
boolean
loadPath(Block block, org.jdom2.Element element)
Load path into an existing Block from XML.void
setStoreElementClass(org.jdom2.Element memories)
Subclass provides implementation to create the correct top element, including the type information.org.jdom2.Element
store(java.lang.Object o)
Store the contents of a BlockManager.-
Methods inherited from class jmri.managers.configurexml.AbstractMemoryManagerConfigXML
loadMemories
-
Methods inherited from class jmri.managers.configurexml.AbstractNamedBeanManagerConfigXML
checkedNamedBeanHandle, checkedNamedBeanName, checkedNamedBeanReference, getSystemName, getUserName, getUserName, loadCommon, storeCommon
-
Methods inherited from class jmri.configurexml.AbstractXmlAdapter
getAttributeBooleanValue, getAttributeDoubleValue, getAttributeFloatValue, getAttributeIntegerValue, getExceptionHandler, handleException, load, load, load, loadDeferred, setExceptionHandler, store
-
-
-
-
Constructor Detail
-
BlockManagerXml
public BlockManagerXml()
-
-
Method Detail
-
setStoreElementClass
public void setStoreElementClass(org.jdom2.Element memories)
Subclass provides implementation to create the correct top element, including the type information. Default implementation is to use the local class here.- Specified by:
setStoreElementClass
in classAbstractMemoryManagerConfigXML
- Parameters:
memories
- The top-level element being created
-
store
public org.jdom2.Element store(java.lang.Object o)
Store the contents of a BlockManager.- Specified by:
store
in interfaceXmlAdapter
- Overrides:
store
in classAbstractMemoryManagerConfigXML
- Parameters:
o
- Object to store, of type BlockManager- Returns:
- Element containing the complete info
-
load
public boolean load(org.jdom2.Element sharedBlocks, org.jdom2.Element perNodeBlocks) throws JmriConfigureXmlException
Load Blocks into the existing BlockManager.The BlockManager in the InstanceManager is created automatically.
- Specified by:
load
in interfaceXmlAdapter
- Specified by:
load
in classAbstractMemoryManagerConfigXML
- Parameters:
sharedBlocks
- Element containing the block elements to loadperNodeBlocks
- Per-node block elements to load- Returns:
- true if successful
- Throws:
JmriConfigureXmlException
- if error during load
-
loadBlock
public void loadBlock(org.jdom2.Element element) throws JmriConfigureXmlException
Utility method to load the individual Block objects.- Parameters:
element
- Element containing one block- Throws:
JmriConfigureXmlException
- if element contains malformed or schematically invalid XMl
-
loadPath
public boolean loadPath(Block block, org.jdom2.Element element) throws JmriConfigureXmlException
Load path into an existing Block from XML.- Parameters:
block
- Block to receive pathelement
- Element containing path information- Returns:
- true if path added to block; false otherwise
- Throws:
JmriConfigureXmlException
- if element contains malformed or schematically invalid XMl
-
loadBeanSetting
public void loadBeanSetting(Path path, org.jdom2.Element element)
Load BeanSetting into an existing Path.- Parameters:
path
- Path to receive BeanSettingelement
- Element containing beansetting information
-
loadOrder
public int loadOrder()
Description copied from class:AbstractXmlAdapter
- Specified by:
loadOrder
in interfaceXmlAdapter
- Overrides:
loadOrder
in classAbstractMemoryManagerConfigXML
-
-