jmri
Interface ConfigureManager

All Known Implementing Classes:
ConfigXmlManager

public interface ConfigureManager

Provide load/store capabilities for general configuration.

Areas of responsibility:

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
  3. "Tool" - (Not really clear yet, but present)
  4. "User" - typically information about panels and windows, these are handled last during startup

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.

Author:
Bob Jacobsen Copyright (C) 2002
See Also:
InstanceManager, ConfigXmlManager

Method Summary
 void deregister(Object o)
           
 File find(String filename)
          Provide a method-specific way of locating a file to be loaded from a name.
 Object findInstance(Class<?> c, int index)
          Find the ith instance of an object of particular class that's been registered for storage.
 ArrayList<Object> getInstanceList(Class<?> c)
          Returns a list of instances stored for a given class.
 boolean load(File file)
          Create the objects defined in a particular configuration file
 boolean load(File file, boolean registerDeferred)
          Create the objects defined in a particular configuration file
 boolean loadDeferred(File file)
          Create the objects defined in a particular configuration file that have been deferred until after basic GUI construction completed
 boolean makeBackup(File file)
          Make a backup file.
 void registerConfig(Object o)
           
 void registerConfig(Object o, int x)
           
 void registerPref(Object o)
           
 void registerTool(Object o)
           
 void registerUser(Object o)
           
 void registerUserPrefs(Object o)
           
 void removePrefItems()
           
 void storeAll(File file)
          Stores prefs, config, tools and user information.
 void storeConfig(File file)
          Stores just configuration information.
 void storePrefs()
          Stores just preferences information.
 void storePrefs(File file)
          Stores just preferences information.
 void storeUser(File file)
          Stores just user information.
 void storeUserPrefs(File file)
          Stores just user preferences information.
 

Method Detail

registerPref

void registerPref(Object o)

removePrefItems

void removePrefItems()

registerConfig

void registerConfig(Object o)

registerConfig

void registerConfig(Object o,
                    int x)

registerTool

void registerTool(Object o)

registerUser

void registerUser(Object o)

registerUserPrefs

void registerUserPrefs(Object o)

deregister

void deregister(Object o)

findInstance

Object findInstance(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

ArrayList<Object> getInstanceList(Class<?> c)
Returns a list of instances stored for a given class.

Parameters:
c - Class of the desired objects
Returns:
an ArrayList of objects of class c or null

storeAll

void storeAll(File file)
Stores prefs, config, tools and user information.

Parameters:
file - Output file

storePrefs

void storePrefs()
Stores just preferences information.

Where that information is stored is implementation-specific.


storePrefs

void storePrefs(File file)
Stores just preferences information.


storeUserPrefs

void storeUserPrefs(File file)
Stores just user preferences information.


storeConfig

void storeConfig(File file)
Stores just configuration information.

Parameters:
file - Output file

storeUser

void storeUser(File file)
Stores just user information.

Parameters:
file - Output file

load

boolean load(File file)
             throws JmriException
Create the objects defined in a particular configuration file

Parameters:
file - Input file
Returns:
true if succeeded
Throws:
JmriException

load

boolean load(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
Since:
2.11.2

loadDeferred

boolean loadDeferred(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
Since:
2.11.2
See Also:
XmlAdapter.loadDeferred()

find

File find(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 File object

makeBackup

boolean makeBackup(File file)
Make a backup file.

Parameters:
file - to be backed up
Returns:
true if successful


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads