Class OptionsFile

  • All Implemented Interfaces:
    InstanceManagerAutoDefault

    public class OptionsFile
    extends XmlFile
    implements InstanceManagerAutoDefault
    Handles reading and writing of Dispatcher options to disk as an XML file called "dispatcher-options.xml" in the user's preferences area.

    This class manipulates the files conforming to the dispatcher-options DTD

    The file is written when the user requests that options be saved. If the dispatcheroptions.xml file is present when Dispatcher is started, it is read and options set accordingly

    This file is part of JMRI.

    JMRI is open source software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

    JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    • Method Detail

      • setDefaultFileName

        public static void setDefaultFileName​(java.lang.String testLocation)
      • readDispatcherOptions

        public void readDispatcherOptions​(DispatcherFrame f)
                                   throws org.jdom2.JDOMException,
                                          java.io.IOException
        Read Dispatcher Options from a file in the user's preferences directory. If the file containing Dispatcher Options does not exist, this routine returns quietly.

        The lename attribute is deprecated at 5.1.3. The current value will be retained.

        Parameters:
        f - The dispatcher instance.
        Throws:
        org.jdom2.JDOMException - if dispatcher parameter logically incorrect
        java.io.IOException - if dispatcher parameter not found
      • writeDispatcherOptions

        public void writeDispatcherOptions​(DispatcherFrame f)
                                    throws java.io.IOException
        Write out Dispatcher options to a file in the user's preferences directory.

        The lename attribute is deprecated at 5.1.3. The current value will be retained.

        Parameters:
        f - Dispatcher instance.
        Throws:
        java.io.IOException - Thrown if dispatcher option file not found