001package jmri.jmrit.logixng.actions.configurexml; 002 003import jmri.*; 004import jmri.configurexml.JmriConfigureXmlException; 005import jmri.jmrit.logixng.*; 006import jmri.jmrit.logixng.actions.ExecuteAction; 007import jmri.jmrit.logixng.util.configurexml.LogixNG_SelectNamedBeanXml; 008 009import org.jdom2.Element; 010 011/** 012 * Handle XML configuration for ExecuteAction objects. 013 * 014 * @author Bob Jacobsen Copyright: Copyright (c) 2004, 2008, 2010 015 * @author Daniel Bergqvist Copyright (C) 2024 016 */ 017public class ExecuteActionXml extends jmri.managers.configurexml.AbstractNamedBeanManagerConfigXML { 018 019 public ExecuteActionXml() { 020 } 021 022 /** 023 * Default implementation for storing the contents of an ExecuteAction 024 * 025 * @param o Object to store, of type TripleLightSignalHead 026 * @return Element containing the complete info 027 */ 028 @Override 029 public Element store(Object o) { 030 ExecuteAction p = (ExecuteAction) o; 031 032 Element element = new Element("ExecuteAction"); 033 element.setAttribute("class", this.getClass().getName()); 034 element.addContent(new Element("systemName").addContent(p.getSystemName())); 035 036 storeCommon(p, element); 037 038 var selectNamedBeanXml = new LogixNG_SelectNamedBeanXml<MaleDigitalActionSocket>(); 039 element.addContent(selectNamedBeanXml.store(p.getSelectNamedBean(), "namedBean")); 040 041 return element; 042 } 043 044 @Override 045 public boolean load(Element shared, Element perNode) throws JmriConfigureXmlException { 046 String sys = getSystemName(shared); 047 String uname = getUserName(shared); 048 ExecuteAction h = new ExecuteAction(sys, uname); 049 050 loadCommon(h, shared); 051 052 var selectNamedBeanXml = new LogixNG_SelectNamedBeanXml<MaleDigitalActionSocket>(); 053 selectNamedBeanXml.load(shared.getChild("namedBean"), h.getSelectNamedBean(), true); 054 055 InstanceManager.getDefault(DigitalActionManager.class).registerAction(h); 056 return true; 057 } 058 059// private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ExecuteActionXml.class); 060}