Package jmri

Interface ConfigureManager

  • All Known Implementing Classes:
    AppsConfigurationManager, ConfigXmlManager, JmriConfigurationManager

    public interface ConfigureManager
    Provide load/store capabilities for general configuration.

    Areas of responsibility:

    • Register and deregister configuration objects so they can eventually be stored.
    • Invoke the load and store operations as needed
    • Give access to the configuration objects for independent GUIs

    The managed items are divided into four types:

    1. "Prefs" - handled first on read, these are the general preferences controlling how the program starts up
    2. "Config" - layout configuration information, e.g. turnout, signal, etc - generally, all NamedBeanManagers
    3. "Tool" - (Not really clear yet, but present)
    4. "User" - typically information about panels and windows, these are handled last during startup - all the jmri.display panel types

    The configuration manager is generally located through the InstanceManager.

    The original implementation was via the jmri.configurexml package.


    This file is part of JMRI.

    JMRI is free 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.

    See Also:
    InstanceManager, ConfigXmlManager
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void deregister​(java.lang.Object o)  
      java.net.URL find​(java.lang.String filename)
      Provide a method-specific way of locating a file to be loaded from a name.
      java.lang.Object findInstance​(java.lang.Class<?> c, int index)
      Find the ith instance of an object of particular class that's been registered for storage.
      java.util.List<java.lang.Object> getInstanceList​(java.lang.Class<?> c)
      Returns a list of instances stored for a given class.
      XmlFile.Validate getValidate()
      Get the scope of validation of XML files when loading.
      boolean load​(java.io.File file)
      Create the objects defined in a particular configuration file
      boolean load​(java.io.File file, boolean registerDeferred)
      Create the objects defined in a particular configuration file
      boolean load​(java.net.URL file)
      Create the objects defined in a particular configuration file
      boolean load​(java.net.URL file, boolean registerDeferred)
      Create the objects defined in a particular configuration file
      boolean loadDeferred​(java.io.File file)
      Create the objects defined in a particular configuration file that have been deferred until after basic GUI construction completed
      boolean loadDeferred​(java.net.URL file)
      Create the objects defined in a particular configuration file that have been deferred until after basic GUI construction completed
      boolean makeBackup​(java.io.File file)
      Make a backup file.
      void registerConfig​(java.lang.Object o)  
      void registerConfig​(java.lang.Object o, int x)  
      void registerPref​(java.lang.Object o)  
      void registerTool​(java.lang.Object o)  
      void registerUser​(java.lang.Object o)  
      void registerUserPrefs​(java.lang.Object o)  
      void removePrefItems()  
      void setValidate​(XmlFile.Validate validate)
      Control the scope of validation of XML files when loading.
      boolean storeConfig​(java.io.File file)
      Stores just configuration information.
      void storePrefs()
      Stores just preferences information.
      void storePrefs​(java.io.File file)
      Stores just preferences information.
      boolean storeUser​(java.io.File file)
      Stores user and config information.
      void storeUserPrefs​(java.io.File file)
      Stores just user preferences information.
    • Method Detail

      • deregister

        void deregister​(java.lang.Object o)
      • findInstance

        java.lang.Object findInstance​(java.lang.Class<?> c,
                                      int index)
        Find the ith instance of an object of particular class that's been registered for storage.

        Note that the index of an object can change when other objects are stored or removed. The index is for indexing over the objects stored at a moment, not for use as an identification number.

        There may be synchronization issues associated with this, although they are expected to be rare in practice.

        Parameters:
        c - Class of the desired objects
        index - a 1-based index of the object to return
        Returns:
        an object of class c or null
      • getInstanceList

        java.util.List<java.lang.Object> getInstanceList​(java.lang.Class<?> c)
        Returns a list of instances stored for a given class.
        Parameters:
        c - Class of the desired objects
        Returns:
        an List of objects of class c or null
      • storePrefs

        void storePrefs()
        Stores just preferences information.

        Where that information is stored is implementation-specific.

      • storePrefs

        void storePrefs​(java.io.File file)
        Stores just preferences information.
        Parameters:
        file - the to store preferences into
      • storeUserPrefs

        void storeUserPrefs​(java.io.File file)
        Stores just user preferences information.
        Parameters:
        file - the file to store user preferences into
      • storeConfig

        boolean storeConfig​(java.io.File file)
        Stores just configuration information.
        Parameters:
        file - Output file
        Returns:
        true if successful; false otherwise
      • storeUser

        boolean storeUser​(java.io.File file)
        Stores user and config information.
        Parameters:
        file - Output file
        Returns:
        true if succeeded
      • load

        boolean load​(java.io.File file)
              throws JmriException
        Create the objects defined in a particular configuration file
        Parameters:
        file - Input file
        Returns:
        true if succeeded
        Throws:
        JmriException - if unable to load file due to internal error
      • load

        boolean load​(java.net.URL file)
              throws JmriException
        Create the objects defined in a particular configuration file
        Parameters:
        file - Input URL
        Returns:
        true if succeeded
        Throws:
        JmriException - if unable to load URL due to internal error
      • load

        boolean load​(java.io.File file,
                     boolean registerDeferred)
              throws JmriException
        Create the objects defined in a particular configuration file
        Parameters:
        file - Input file
        registerDeferred - true to register actions for deferred load
        Returns:
        true if succeeded
        Throws:
        JmriException - if problem during load
        Since:
        2.11.2
      • load

        boolean load​(java.net.URL file,
                     boolean registerDeferred)
              throws JmriException
        Create the objects defined in a particular configuration file
        Parameters:
        file - Input URL
        registerDeferred - true to register actions for deferred load
        Returns:
        true if succeeded
        Throws:
        JmriException - if problem during load
        Since:
        2.11.2
      • loadDeferred

        boolean loadDeferred​(java.io.File file)
                      throws JmriException
        Create the objects defined in a particular configuration file that have been deferred until after basic GUI construction completed
        Parameters:
        file - Input file
        Returns:
        true if succeeded
        Throws:
        JmriException - if problem during load
        Since:
        2.11.2
        See Also:
        XmlAdapter.loadDeferred()
      • loadDeferred

        boolean loadDeferred​(java.net.URL file)
                      throws JmriException
        Create the objects defined in a particular configuration file that have been deferred until after basic GUI construction completed
        Parameters:
        file - Input URL
        Returns:
        true if succeeded
        Throws:
        JmriException - if problem during load
        Since:
        2.11.2
        See Also:
        XmlAdapter.loadDeferred()
      • find

        java.net.URL find​(java.lang.String filename)
        Provide a method-specific way of locating a file to be loaded from a name.
        Parameters:
        filename - Local filename, perhaps without path information
        Returns:
        Corresponding URL
      • makeBackup

        boolean makeBackup​(java.io.File file)
        Make a backup file.
        Parameters:
        file - to be backed up
        Returns:
        true if successful
      • setValidate

        void setValidate​(XmlFile.Validate validate)
        Control the scope of validation of XML files when loading.
        Parameters:
        validate - the validation scope