|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.stratelia.webactiv.util.XMLConfigurationStore
public class XMLConfigurationStore
This object implements and extends the ConfigurationStore interface for XML files. As a ConfigurationStore, it imposes a standard structure on the grove that can be mapped 1-1 with properties, but it offers all necessary methods to handle arbitrary XML structures as well.
The standard structure is the following:
<param>
<param-name>
parameter name
</param-name>
<param-value>
parameter value
</param-value>
<param-description>
parameter description
</param-description>
The parameter description is any arbitrary string that could be used for instance as a tooltip text or a as a label for a configuration tool that should display the use of the given parameter.
Note that symbold such as < or & must be escaped properly when included in the parameter name, value or description.
Constructor Summary | |
---|---|
XMLConfigurationStore()
|
|
XMLConfigurationStore(File file,
String rootString)
|
|
XMLConfigurationStore(String configFileName,
InputStream configFileInputStream,
String rootString)
Creates new XMLConfigurationStore |
Method Summary | |
---|---|
void |
appendChild(Node parent,
Node child)
|
Node |
createElement(String key)
|
Node |
createTextNode(String value)
|
Node |
findNode(Node node,
String name)
|
Node[] |
findNodes(Node node,
String name)
This method returns all children nodes (at any depth, that is, children, grazndchildren, and so on) from the node node whose name matches the name string. |
Node[] |
findNodes(String name)
|
String |
get(String key,
String defaultValue)
|
String[] |
getAllNames()
Returns all first level names from the configuration file |
String |
getAttributeValue(Node n,
String attributeName)
This method returns the value of an attribute of a given node. |
int |
getIntValue(String key)
This method returns a long value for the given key. |
long |
getLongValue(String key)
This method returns a long value for the given key. |
String |
getNodeValue(String nodename)
|
String |
getProperty(String key)
|
String |
getProperty(String key,
String defaultValue)
This method returns the value of a standard-format parameter, that is, it returns the text value of the param-value element that goes with the param-name for the key element. |
String |
getString(String key)
This method is for compatibility with the ResourceLocator |
String[] |
getValues(String key)
This method returns all values for a multi-valued key |
Node |
getXMLParamNode(String nodename)
|
String |
getXMLParamValue(Node n,
String entry,
String key)
This method returns the value of the node entry, starting from the node n. |
String[] |
getXMLParamValues(Node n,
String entry,
String key)
This method returns the values of the node entry, starting from the node n. |
void |
put(String key,
String value)
|
void |
put(String key,
String[] values)
|
void |
putProperty(String key,
String value)
|
void |
putPropety(String key,
String value)
|
void |
replaceValue(Node n,
String key,
String value)
|
void |
serialize()
|
void |
setConfigFileName(String configfilename)
This method sets the config file name. |
Node |
setRoot(String rootString)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLConfigurationStore(String configFileName, InputStream configFileInputStream, String rootString) throws Exception
Exception
public XMLConfigurationStore(File file, String rootString) throws Exception
Exception
public XMLConfigurationStore() throws Exception
Exception
Method Detail |
---|
public Node setRoot(String rootString)
public void serialize() throws FileNotFoundException, IOException
serialize
in interface ConfigurationStore
FileNotFoundException
IOException
public void setConfigFileName(String configfilename)
public String getNodeValue(String nodename)
public String getXMLParamValue(Node n, String entry, String key)
This method returns null if the node wasn't found
public String[] getXMLParamValues(Node n, String entry, String key)
This method returns null if the node wasn't found
public Node getXMLParamNode(String nodename)
public String getAttributeValue(Node n, String attributeName)
n
- the node where the attribute is storedattributeName
- the name of the attribute. Case sensitive.public void putPropety(String key, String value)
public void putProperty(String key, String value)
putProperty
in interface ConfigurationStore
public void replaceValue(Node n, String key, String value)
public Node createElement(String key)
public Node createTextNode(String value)
public void appendChild(Node parent, Node child)
public void put(String key, String value)
put
in interface ConfigurationStore
public void put(String key, String[] values)
public String getProperty(String key, String defaultValue)
getProperty
in interface ConfigurationStore
public String getProperty(String key)
getProperty
in interface ConfigurationStore
public String getString(String key)
getString
in interface ConfigurationStore
public String get(String key, String defaultValue)
get
in interface ConfigurationStore
public long getLongValue(String key) throws XMLConfigurationException
XMLConfigurationException
public int getIntValue(String key) throws XMLConfigurationException
XMLConfigurationException
public String[] getValues(String key)
public Node findNode(Node node, String name)
public Node[] findNodes(String name)
public Node[] findNodes(Node node, String name)
public String[] getAllNames()
getAllNames
in interface ConfigurationStore
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |