Package jmri.implementation
Class JmriConfigurationManager
- java.lang.Object
-
- jmri.implementation.JmriConfigurationManager
-
- All Implemented Interfaces:
ConfigureManager
- Direct Known Subclasses:
AppsConfigurationManager
public class JmriConfigurationManager extends java.lang.Object implements ConfigureManager
-
-
Constructor Summary
Constructors Constructor Description JmriConfigurationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidderegister(java.lang.Object o)protected voiddisplayErrorListDialog(java.lang.Object list)java.net.URLfind(java.lang.String filename)Provide a method-specific way of locating a file to be loaded from a name.java.lang.ObjectfindInstance(java.lang.Class<?> c, int index)Find the ith instance of an object of particular class that's been registered for storage.java.util.HashMap<PreferencesManager,InitializationException>getInitializationExceptions()java.util.List<java.lang.Object>getInstanceList(java.lang.Class<?> c)Returns a list of instances stored for a given class.XmlFile.ValidategetValidate()Get the scope of validation of XML files when loading.protected voidhandleQuit()protected voidhandleRestart()protected booleanisEditDialogRestart()booleanload(java.io.File file)Create the objects defined in a particular configuration filebooleanload(java.io.File file, boolean registerDeferred)Create the objects defined in a particular configuration filebooleanload(java.net.URL url)Create the objects defined in a particular configuration filebooleanload(java.net.URL url, boolean registerDeferred)Create the objects defined in a particular configuration filebooleanloadDeferred(java.io.File file)Create the objects defined in a particular configuration file that have been deferred until after basic GUI construction completedbooleanloadDeferred(java.net.URL file)Create the objects defined in a particular configuration file that have been deferred until after basic GUI construction completedbooleanmakeBackup(java.io.File file)Make a backup file.voidregisterConfig(java.lang.Object o)voidregisterConfig(java.lang.Object o, int x)voidregisterPref(java.lang.Object o)voidregisterTool(java.lang.Object o)voidregisterUser(java.lang.Object o)voidregisterUserPrefs(java.lang.Object o)voidremovePrefItems()voidsetValidate(XmlFile.Validate v)Control the scope of validation of XML files when loading.booleanstoreConfig(java.io.File file)Stores just configuration information.voidstorePrefs()Save preferences.voidstorePrefs(java.io.File file)Save preferences.booleanstoreUser(java.io.File file)Stores user and config information.voidstoreUserPrefs(java.io.File file)Stores just user preferences information.
-
-
-
Constructor Detail
-
JmriConfigurationManager
public JmriConfigurationManager()
-
-
Method Detail
-
registerPref
public void registerPref(java.lang.Object o)
- Specified by:
registerPrefin interfaceConfigureManager
-
removePrefItems
public void removePrefItems()
- Specified by:
removePrefItemsin interfaceConfigureManager
-
registerConfig
public void registerConfig(java.lang.Object o)
- Specified by:
registerConfigin interfaceConfigureManager
-
registerConfig
public void registerConfig(java.lang.Object o, int x)
- Specified by:
registerConfigin interfaceConfigureManager
-
registerTool
public void registerTool(java.lang.Object o)
- Specified by:
registerToolin interfaceConfigureManager
-
registerUser
public void registerUser(java.lang.Object o)
- Specified by:
registerUserin interfaceConfigureManager
-
registerUserPrefs
public void registerUserPrefs(java.lang.Object o)
- Specified by:
registerUserPrefsin interfaceConfigureManager
-
deregister
public void deregister(java.lang.Object o)
- Specified by:
deregisterin interfaceConfigureManager
-
findInstance
public java.lang.Object findInstance(java.lang.Class<?> c, int index)
Description copied from interface:ConfigureManagerFind 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.
- Specified by:
findInstancein interfaceConfigureManager- Parameters:
c- Class of the desired objectsindex- a 1-based index of the object to return- Returns:
- an object of class c or null
-
getInstanceList
public java.util.List<java.lang.Object> getInstanceList(java.lang.Class<?> c)
Description copied from interface:ConfigureManagerReturns a list of instances stored for a given class.- Specified by:
getInstanceListin interfaceConfigureManager- Parameters:
c- Class of the desired objects- Returns:
- an List of objects of class c or null
-
storePrefs
public void storePrefs()
Save preferences. Preferences are saved using either theJmriConfigurationProviderorJmriPreferencesProvideras appropriate to the register preferences handler.- Specified by:
storePrefsin interfaceConfigureManager
-
storePrefs
public void storePrefs(java.io.File file)
Save preferences. This method callsstorePrefs().- Specified by:
storePrefsin interfaceConfigureManager- Parameters:
file- Ignored.
-
storeUserPrefs
public void storeUserPrefs(java.io.File file)
Description copied from interface:ConfigureManagerStores just user preferences information.- Specified by:
storeUserPrefsin interfaceConfigureManager- Parameters:
file- the file to store user preferences into
-
storeConfig
public boolean storeConfig(java.io.File file)
Description copied from interface:ConfigureManagerStores just configuration information.- Specified by:
storeConfigin interfaceConfigureManager- Parameters:
file- Output file- Returns:
- true if successful; false otherwise
-
storeUser
public boolean storeUser(java.io.File file)
Description copied from interface:ConfigureManagerStores user and config information.- Specified by:
storeUserin interfaceConfigureManager- Parameters:
file- Output file- Returns:
- true if succeeded
-
load
public boolean load(java.io.File file) throws JmriException
Description copied from interface:ConfigureManagerCreate the objects defined in a particular configuration file- Specified by:
loadin interfaceConfigureManager- Parameters:
file- Input file- Returns:
- true if succeeded
- Throws:
JmriException- if unable to load file due to internal error
-
load
public boolean load(java.net.URL url) throws JmriException
Description copied from interface:ConfigureManagerCreate the objects defined in a particular configuration file- Specified by:
loadin interfaceConfigureManager- Parameters:
url- Input URL- Returns:
- true if succeeded
- Throws:
JmriException- if unable to load URL due to internal error
-
load
public boolean load(java.io.File file, boolean registerDeferred) throws JmriException
Description copied from interface:ConfigureManagerCreate the objects defined in a particular configuration file- Specified by:
loadin interfaceConfigureManager- Parameters:
file- Input fileregisterDeferred- true to register actions for deferred load- Returns:
- true if succeeded
- Throws:
JmriException- if problem during load
-
load
public boolean load(java.net.URL url, boolean registerDeferred) throws JmriException
Description copied from interface:ConfigureManagerCreate the objects defined in a particular configuration file- Specified by:
loadin interfaceConfigureManager- Parameters:
url- Input URLregisterDeferred- true to register actions for deferred load- Returns:
- true if succeeded
- Throws:
JmriException- if problem during load
-
displayErrorListDialog
protected void displayErrorListDialog(java.lang.Object list)
-
isEditDialogRestart
protected boolean isEditDialogRestart()
-
handleRestart
protected void handleRestart()
-
handleQuit
protected void handleQuit()
-
loadDeferred
public boolean loadDeferred(java.io.File file)
Description copied from interface:ConfigureManagerCreate the objects defined in a particular configuration file that have been deferred until after basic GUI construction completed- Specified by:
loadDeferredin interfaceConfigureManager- Parameters:
file- Input file- Returns:
- true if succeeded
- See Also:
XmlAdapter.loadDeferred()
-
loadDeferred
public boolean loadDeferred(java.net.URL file)
Description copied from interface:ConfigureManagerCreate the objects defined in a particular configuration file that have been deferred until after basic GUI construction completed- Specified by:
loadDeferredin interfaceConfigureManager- Parameters:
file- Input URL- Returns:
- true if succeeded
- See Also:
XmlAdapter.loadDeferred()
-
find
public java.net.URL find(java.lang.String filename)
Description copied from interface:ConfigureManagerProvide a method-specific way of locating a file to be loaded from a name.- Specified by:
findin interfaceConfigureManager- Parameters:
filename- Local filename, perhaps without path information- Returns:
- Corresponding
URL
-
makeBackup
public boolean makeBackup(java.io.File file)
Description copied from interface:ConfigureManagerMake a backup file.- Specified by:
makeBackupin interfaceConfigureManager- Parameters:
file- to be backed up- Returns:
- true if successful
-
getInitializationExceptions
public java.util.HashMap<PreferencesManager,InitializationException> getInitializationExceptions()
-
setValidate
public void setValidate(XmlFile.Validate v)
Description copied from interface:ConfigureManagerControl the scope of validation of XML files when loading.- Specified by:
setValidatein interfaceConfigureManager- Parameters:
v- the validation scope
-
getValidate
public XmlFile.Validate getValidate()
Description copied from interface:ConfigureManagerGet the scope of validation of XML files when loading.- Specified by:
getValidatein interfaceConfigureManager- Returns:
- the validation scope
-
-