001package jmri.jmrix.bidib.configurexml; 002 003import jmri.InstanceManager; 004import org.jdom2.Element; 005import org.slf4j.Logger; 006import org.slf4j.LoggerFactory; 007import jmri.jmrix.bidib.BiDiBReporterManager; 008import jmri.managers.ProxyReporterManager; 009 010/** 011 * Provides load and store functionality for configuring BiDiBReporterManagers. 012 * <p> 013 * Uses the store method from the abstract base class, but provides a load 014 * method here. 015 * 016 * @author Bob Jacobsen Copyright: Copyright (c) 2008 017 * @author Eckart Meyer Copyright (C) 2019 018 * @since 4.5.4 019 */ 020public class BiDiBReporterManagerXml extends jmri.managers.configurexml.AbstractReporterManagerConfigXML { 021 022 public BiDiBReporterManagerXml() { 023 super(); 024 } 025 026 @Override 027 public void setStoreElementClass(Element sensors) { 028 sensors.setAttribute("class", this.getClass().getName()); 029 } 030 031 @Override 032 public void load(Element element, Object o) { 033 log.error("Invalid method called"); 034 } 035 036 @Override 037 public boolean load(Element shared, Element perNode) { 038 // load individual reporters 039 boolean result = loadReporters(shared); 040 041 if (result) { 042 ProxyReporterManager rm = (ProxyReporterManager)InstanceManager.getDefault(jmri.ReporterManager.class); 043 //log.debug("Reporter Manager List: {}", rm.getManagerList()); 044 BiDiBReporterManager mgr = (BiDiBReporterManager)rm.getManagerList().get(0); 045 if (mgr != null ) { 046 mgr.updateAll(); 047 } 048 } 049 050 return result; 051 } 052 053 private static final Logger log = LoggerFactory.getLogger(BiDiBReporterManagerXml.class); 054}