|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.XmlFile
jmri.configurexml.ConfigXmlManager
public class ConfigXmlManager
Provides the mechanisms for storing an entire layout configuration to XML. "Layout" refers to the hardware: Specific communcation systems, etc.
| Field Summary | |
|---|---|
static String |
dtdVersion
Define the current DTD version string for the layout-config DTD. |
static String |
fileLocation
|
| Fields inherited from class jmri.jmrit.XmlFile |
|---|
dtdLocation, xsltLocation |
| Constructor Summary | |
|---|---|
ConfigXmlManager()
|
|
| Method Summary | |
|---|---|
static String |
adapterName(Object o)
Find the name of the adapter class for an object. |
protected void |
addConfigStore(Element root)
|
protected void |
addPrefsStore(Element root)
|
protected void |
addToolsStore(Element root)
|
protected void |
addUserStore(Element root)
|
void |
deregister(Object o)
|
static Element |
elementFromObject(Object o)
|
protected void |
finalStore(Element root,
File file)
|
File |
find(String f)
Find a file by looking in xml/layout/ in the preferences directory, if that exists in xml/layout/ in the application directory, if that exists in xml/ in the preferences directory, if that exists in xml/ in the application directory, if that exists at top level in the application directory |
Object |
findInstance(Class<?> c,
int index)
Find the ith instance of an object of particular class that's been registered for storage. |
protected Element |
initStore()
|
boolean |
load(File fi)
Create the objects defined in a particular configuration file |
boolean |
makeBackup(File file)
Make a backup file. |
void |
registerConfig(Object o)
|
void |
registerPref(Object o)
|
void |
registerTool(Object o)
|
void |
registerUser(Object o)
Register an object whose state is to be tracked. |
void |
removePrefItems()
Remove the registered preference items. |
void |
storeAll(File file)
Writes config, tools and user to a file. |
void |
storeConfig(File file)
Writes prefs to a file. |
void |
storePrefs(File file)
Writes prefs to a file. |
void |
storeUser(File file)
Writes user and config info to a file. |
| Methods inherited from class jmri.jmrit.XmlFile |
|---|
addDefaultInfo, backupFileName, checkFile, createFileNameWithDate, dumpElement, ensurePrefsPresent, findFile, getRootViaURI, getVerify, makeBackupFile, makeBackupFile, newDocument, prefsDir, reportError1, reportError2, revertBackupFile, rootFromFile, rootFromName, rootFromURL, setVerify, userFileChooser, userFileChooser, userFileChooser, userFileChooser, userFileLocationDefault, writeXML, xmlDir |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String dtdVersion
public static String fileLocation
| Constructor Detail |
|---|
public ConfigXmlManager()
| Method Detail |
|---|
public void registerPref(Object o)
registerPref in interface ConfigureManagerpublic void removePrefItems()
removePrefItems in interface ConfigureManager
public Object findInstance(Class<?> c,
int index)
ConfigureManagerNote 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.
findInstance in interface ConfigureManagerc - Class of the desired objectsindex - a 1-based index of the object to return
public void registerConfig(Object o)
registerConfig in interface ConfigureManagerpublic void registerTool(Object o)
registerTool in interface ConfigureManagerpublic void registerUser(Object o)
registerUser in interface ConfigureManagero - The object, which must have an
associated adapter class.public void deregister(Object o)
deregister in interface ConfigureManagerpublic static String adapterName(Object o)
o - object of a configurable type
protected Element initStore()
protected void addPrefsStore(Element root)
protected void addConfigStore(Element root)
protected void addToolsStore(Element root)
protected void addUserStore(Element root)
protected void finalStore(Element root,
File file)
public void storeAll(File file)
storeAll in interface ConfigureManagerfile - public void storePrefs(File file)
storePrefs in interface ConfigureManagerfile - public void storeConfig(File file)
storeConfig in interface ConfigureManagerfile - public void storeUser(File file)
Config is included here because it doesnt hurt to read it again, and the user data (typically a panel) requires it to be present first.
storeUser in interface ConfigureManagerfile - public boolean makeBackup(File file)
ConfigureManager
makeBackup in interface ConfigureManagerfile - to be backed up
public static Element elementFromObject(Object o)
public boolean load(File fi)
ConfigureManager
load in interface ConfigureManagerfi - Input file
public File find(String f)
find in interface ConfigureManagerf - Local filename, perhaps without path information
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||