001package jmri.jmrix.openlcb.configurexml; 002 003import jmri.InstanceManager; 004import jmri.jmrix.openlcb.OlcbConfigurationManager; 005import org.jdom2.Element; 006 007/** 008 * Provides load and store functionality for configuring OlcbTurnoutManagers. 009 * <p> 010 * Uses the store method from the abstract base class, but provides a load 011 * method here. 012 * 013 * @author Bob Jacobsen Copyright: Copyright (c) 2008, 2010 014 * @since 2.3.1 015 */ 016public class OlcbTurnoutManagerXml extends jmri.managers.configurexml.AbstractTurnoutManagerConfigXML { 017 018 public OlcbTurnoutManagerXml() { 019 super(); 020 } 021 022 @Override 023 public void setStoreElementClass(Element turnouts) { 024 turnouts.setAttribute("class", this.getClass().getName()); 025 } 026 027 @Override 028 public boolean load(Element shared, Element perNode) { 029 // We tell the Turnout managers that we will be loading turnouts from XML and they should 030 // expect additional property set sequences. This is somewhat tricky in the face of 031 // possibly multiple OpenLCB buses registered. 032 for (OlcbConfigurationManager cfg : InstanceManager.getList(OlcbConfigurationManager 033 .class)) { 034 cfg.getTurnoutManager().startLoad(); 035 } 036 037 // load individual turnouts 038 boolean ret = loadTurnouts(shared, perNode); 039 040 // Notifies OpenLCB turnout managers that the loading of XML is complete. 041 for (OlcbConfigurationManager cfg : InstanceManager.getList(OlcbConfigurationManager 042 .class)) { 043 cfg.getTurnoutManager().finishLoad(); 044 } 045 return ret; 046 } 047 048// private final static Logger log = LoggerFactory.getLogger(OlcbTurnoutManagerXml.class); 049 050}