Class JmriConfiguration
- java.lang.Object
-
- jmri.util.prefs.JmriConfiguration
-
- All Implemented Interfaces:
AuxiliaryConfiguration
public abstract class JmriConfiguration extends java.lang.Object implements AuxiliaryConfiguration
-
-
Constructor Summary
Constructors Constructor Description JmriConfiguration()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.io.File
getConfigurationFile(boolean shared)
org.w3c.dom.Element
getConfigurationFragment(java.lang.String elementName, java.lang.String namespace, boolean shared)
Get a configuration fragment as an XML element.protected abstract boolean
isPrivateBackedUp()
protected abstract boolean
isSharedBackedUp()
void
putConfigurationFragment(org.w3c.dom.Element fragment, boolean shared)
Store a configuration fragement as an XML element.boolean
removeConfigurationFragment(java.lang.String elementName, java.lang.String namespace, boolean shared)
Remove a configuration fragment from the configuration.protected abstract void
setPrivateBackedUp(boolean backedUp)
protected abstract void
setSharedBackedUp(boolean backedUp)
-
-
-
Constructor Detail
-
JmriConfiguration
JmriConfiguration()
-
-
Method Detail
-
getConfigurationFile
protected abstract java.io.File getConfigurationFile(boolean shared)
-
isSharedBackedUp
protected abstract boolean isSharedBackedUp()
-
setSharedBackedUp
protected abstract void setSharedBackedUp(boolean backedUp)
-
isPrivateBackedUp
protected abstract boolean isPrivateBackedUp()
-
setPrivateBackedUp
protected abstract void setPrivateBackedUp(boolean backedUp)
-
getConfigurationFragment
public org.w3c.dom.Element getConfigurationFragment(java.lang.String elementName, java.lang.String namespace, boolean shared)
Description copied from interface:AuxiliaryConfiguration
Get a configuration fragment as an XML element.Multiple elements in a configuration file can have the same name as long as they have different namespaces. If using versioned namespaces, this would allow two different versions of JMRI with incompatible preferences for a given element to use the same name without stomping on each other.
Note: Use
JDOMUtil.toJDOMElement(org.w3c.dom.Element)
to convert a non-null result to a JDOMElement
.- Specified by:
getConfigurationFragment
in interfaceAuxiliaryConfiguration
- Parameters:
elementName
- the name of the element.namespace
- the namespace of the element.shared
- true if the fragment is for all computers using this profile, false if the fragment is for just the current computer.- Returns:
- the matching Element or null if a matching element cannot be found.
-
putConfigurationFragment
public void putConfigurationFragment(org.w3c.dom.Element fragment, boolean shared) throws java.lang.IllegalArgumentException
Description copied from interface:AuxiliaryConfiguration
Store a configuration fragement as an XML element.Multiple elements in a configuration file can have the same name as long as they have different namespaces. If using versioned namespaces, this would allow two different versions of JMRI with incompatible preferences for a given element to use the same name without stomping on each other.
Note: Use
JDOMUtil.toW3CElement(org.jdom2.Element)
to convert a JDOMElement
to a W3CElement
. The JDOM element must have a namespace associated with it.- Specified by:
putConfigurationFragment
in interfaceAuxiliaryConfiguration
- Parameters:
fragment
- the XML element. It must have a valid namespace property.shared
- true if the fragment is for all computers using this profile, false if the fragment is for just the current computer.- Throws:
java.lang.IllegalArgumentException
-
removeConfigurationFragment
public boolean removeConfigurationFragment(java.lang.String elementName, java.lang.String namespace, boolean shared) throws java.lang.IllegalArgumentException
Description copied from interface:AuxiliaryConfiguration
Remove a configuration fragment from the configuration.Multiple elements in a configuration file can have the same name as long as they have different namespaces. If using versioned namespaces, this would allow two different versions of JMRI with incompatible preferences for a given element to use the same name without stomping on each other.
- Specified by:
removeConfigurationFragment
in interfaceAuxiliaryConfiguration
- Parameters:
elementName
- the name of the element.namespace
- the namespace of the element.shared
- true if the fragment is for all computers using this profile, false if the fragment is for just the current computer.- Returns:
- true if the fragment could be removed, false otherwise.
- Throws:
java.lang.IllegalArgumentException
-
-