|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.rad.server.config.UpToDateConfigFile
public class UpToDateConfigFile
The UpToDateConfigFile
encapsulates the access to a xml configuration
file. It's guaranteed that the access to the properties of the file is up-to-date.
That means that changes will be detected automatically.
Constructor Summary | |
---|---|
UpToDateConfigFile(File pConfig)
Creates a new instance of UpToDateConfigFile for a
xml configuration file. |
|
UpToDateConfigFile(File pDirectory,
String pConfig)
Creates a new instance of UpToDateConfigFile for a
xml configuration file. |
Method Summary | |
---|---|
Object |
clone()
|
protected XmlWorker |
createXmlWorker()
Creates the default XmlWorker for reading the file. |
File |
getFile()
Gets the configuration file. |
XmlNode |
getNode(String pName)
Gets the value for a property as xml representation. |
List<XmlNode> |
getNodes(String pName)
Gets the value for a property as xml representation. |
List<String> |
getProperties(String pName)
Gets a list of values for a property which exists more than once. |
String |
getProperty(String pName)
Gets the value of a property from the application configuration file. |
String |
getProperty(String pName,
String pDefault)
Gets the value of a property from the application configuration file. |
boolean |
isSaveImmediate()
Gets it immediate save of changes is enabled. |
boolean |
isUpdateEnabled()
Gets whether the up-to-date option is enabled. |
boolean |
isValid()
Checks if the configuration file exists. |
void |
reload()
Discards all changes and loads the configuration file. |
void |
save()
Saves the changes to the file. |
protected void |
setContent(XmlNode pNode)
Sets the internal data node. |
void |
setNode(String pName,
XmlNode pNode)
Sets a specific node to the application configuration file. |
void |
setProperty(String pName,
String pValue)
Sets the value ofa protperty to the application configuration file. |
void |
setSaveImmediate(boolean pEnabled)
Sets the save immediate option. |
void |
setUpdateEnabled(boolean pEnabled)
Sets the up-to-date option of the configuration. |
protected void |
update()
Loads the configuration from the filesystem. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UpToDateConfigFile(File pDirectory, String pConfig) throws Exception
UpToDateConfigFile
for a
xml configuration file. The configuration will read immediately.
pDirectory
- the directory where to find the configuration filepConfig
- the configuration file name
Exception
- if it is not possible to read the configuration
from the filesystem or the xml content is not validpublic UpToDateConfigFile(File pConfig) throws Exception
UpToDateConfigFile
for a
xml configuration file. The configuration will read immediately.
pConfig
- the configuration file
Exception
- if it is not possible to read the configuration
from the filesystem or the xml content is not validMethod Detail |
---|
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public File getFile()
public boolean isValid()
true
if the configuration file exists otherwise false
protected void update() throws Exception
Exception
- if it is not possible to read the configuration
from the filesystem or the xml content is not validpublic void setProperty(String pName, String pValue) throws Exception
pName
- the property name (e.g. /application/securitymanager/class)pValue
- the value
Exception
- if the configuration is invalidpublic void setNode(String pName, XmlNode pNode) throws Exception
pName
- the property namepNode
- the new node or null
to remove the property
Exception
- if the configuration is invalidpublic String getProperty(String pName) throws Exception
pName
- the property name (e.g /application/securitymanager/class)
Exception
- if the configuration is invalidpublic String getProperty(String pName, String pDefault) throws Exception
pName
- the property name (e.g /application/securitymanager/class)pDefault
- the default value if the property is not available
pDefault
if the property is not available
Exception
- if the configuration is invalidpublic List<String> getProperties(String pName) throws Exception
pName
- the property name
null
if the property is not available
Exception
- if the configuration is invalidpublic List<XmlNode> getNodes(String pName) throws Exception
pName
- the property name
null
if the property is not available
Exception
- if the configuration is invalidpublic XmlNode getNode(String pName) throws Exception
pName
- the property name
null
is the property is not available
Exception
- if the configuration is invalidpublic void setUpdateEnabled(boolean pEnabled)
pEnabled
- true
doesn't update the configuration when
next accessing; false
always keeps the configuration
up-to-datepublic boolean isUpdateEnabled()
true
if the current configuration will be read before
accessing a property, false
if the configuration won't
be read againpublic void setSaveImmediate(boolean pEnabled)
pEnabled
- true
to enable immediate save changes, false
otherwisepublic boolean isSaveImmediate()
true
if changes will saved immediate, false
otherwisepublic void save() throws IOException
IOException
- if the file access failedpublic void reload() throws Exception
Exception
- if an exception occurs during loadingprotected XmlWorker createXmlWorker()
XmlWorker
for reading the file.
protected void setContent(XmlNode pNode)
pNode
- the data node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |