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 OlcbReporterManagers. 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 * @author Balazs Racz Copyright: Copyright (c) 2023 015 * @since 5.3.5 016 */ 017public class OlcbReporterManagerXml extends jmri.managers.configurexml.AbstractReporterManagerConfigXML { 018 019 public OlcbReporterManagerXml() { 020 super(); 021 } 022 023 @Override 024 public void setStoreElementClass(Element turnouts) { 025 turnouts.setAttribute("class", this.getClass().getName()); 026 } 027 028 @Override 029 public boolean load(Element shared, Element perNode) { 030 // We tell the Reporter managers that we will be loading reporters from XML and they should 031 // expect additional property set sequences. This is somewhat tricky in the face of 032 // possibly multiple OpenLCB buses registered. 033 for (OlcbConfigurationManager cfg : InstanceManager.getList(OlcbConfigurationManager 034 .class)) { 035 cfg.getReporterManager().startLoad(); 036 } 037 038 // load individual turnouts 039 boolean ret = loadReporters(shared); 040 041 // Notifies OpenLCB turnout managers that the loading of XML is complete. 042 for (OlcbConfigurationManager cfg : InstanceManager.getList(OlcbConfigurationManager 043 .class)) { 044 cfg.getReporterManager().finishLoad(); 045 } 046 return ret; 047 } 048 049// private final static Logger log = LoggerFactory.getLogger(OlcbReporterManagerXml.class); 050}