Class AbstractMemoryManagerConfigXML

  • All Implemented Interfaces:
    XmlAdapter
    Direct Known Subclasses:
    BlockManagerXml, DefaultMemoryManagerXml

    public abstract class AbstractMemoryManagerConfigXML
    extends AbstractNamedBeanManagerConfigXML
    Provides the abstract base and store functionality for configuring MemoryManagers, working with AbstractMemoryManagers.

    Also serves as base class for BlockManagerXml persistence.

    Typically, a subclass will just implement the load(Element memories) class, relying on implementation here to load the individual Memory objects. Note that these are stored explicitly, so the resolution mechanism doesn't need to see *Xml classes for each specific Memory or AbstractMemory subclass at store time.

    • Method Detail

      • store

        public org.jdom2.Element store​(java.lang.Object o)
        Default implementation for storing the contents of a MemoryManager.
        Parameters:
        o - Object to store, of type MemoryManager
        Returns:
        Element containing the complete info
      • setStoreElementClass

        public abstract 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.
        Parameters:
        memories - The top-level element being created
      • load

        public abstract boolean load​(org.jdom2.Element sharedMemories,
                                     org.jdom2.Element perNodeMemories)
                              throws JmriConfigureXmlException
        Create a MemoryManager object of the correct class, then register and fill it.
        Specified by:
        load in interface XmlAdapter
        Overrides:
        load in class AbstractXmlAdapter
        Parameters:
        sharedMemories - Shared top level Element to unpack.
        perNodeMemories - Per-node top level Element to unpack.
        Returns:
        true if successful
        Throws:
        JmriConfigureXmlException - if error during load.
      • loadMemories

        public void loadMemories​(org.jdom2.Element memories)
        Utility method to load the individual Memory objects. If there's no additional info needed for a specific Memory type, invoke this with the parent of the set of Memory elements.
        Parameters:
        memories - Element containing the Memory elements to load.