001package jmri.managers.configurexml; 002 003import jmri.InstanceManager; 004import org.jdom2.Element; 005 006/** 007 * Persistency implementation for the default MemoryManager persistence. 008 * <p> 009 * The state of memory objects is not persisted, just their existence. 010 * 011 * @author Bob Jacobsen Copyright: Copyright (c) 2002 012 */ 013public class DefaultMemoryManagerXml extends AbstractMemoryManagerConfigXML { 014 015 public DefaultMemoryManagerXml() { 016 } 017 018 /** 019 * Subclass provides implementation to create the correct top element, 020 * including the type information. Default implementation is to use the 021 * local class here. 022 * 023 * @param memories The top-level element being created 024 */ 025 @Override 026 public void setStoreElementClass(Element memories) { 027 memories.setAttribute("class", this.getClass().getName()); 028 } 029 030 /** 031 * Create a MemoryManager object of the correct class, then register and 032 * fill it. 033 * 034 * @param sharedMemories Top level Element to unpack. 035 * @return true if successful 036 */ 037 @Override 038 public boolean load(Element sharedMemories, Element perNodeMemories) { 039 // ensure the master object exists 040 InstanceManager.memoryManagerInstance(); 041 // load individual routes 042 loadMemories(sharedMemories); 043 return true; 044 } 045 046}