|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.proactive.core.xml.XMLPropertiesStore
This class implements a XML based preferences store. Constructor expect a URI pointing to an XML file containing the values. The URI can point to a file using the file protocol : file:///D:/doc/xml/properties.xml The data are loaded and parsed in memory. In order to query the values, the class uses a stripped down version of XPath expressions. The only supported expressions are combination of /, . and @ for the attributes. Here some examples of supported expressions : /a/b/c : returns the value of the node or the node c /a/b/c/ : returns the value of the node or the node c /a/b/c/. : returns the value of the node or the node c e/. : returns the value of the node e which should be a child of the given current node /a/b/c/@t : returns the value of the attribute node or the attribute node t &t : returns the value of the attribute node or the attribute node t which should be a child of the given current node
Constructor Summary | |
XMLPropertiesStore(java.lang.String uri)
Contructs a new intance of XMLPropertiesStore based on th given URI pointing to XML data. |
Method Summary | |
org.w3c.dom.Node[] |
getAllNodes(java.lang.String path)
Returns all child nodes defined by the given path. |
org.w3c.dom.Node[] |
getAllNodes(java.lang.String path,
org.w3c.dom.Node context)
Returns all child nodes defined by the given path. |
int |
getValueAsInt(java.lang.String path,
int defaultValue)
Returns the value defined by the given path as an int. |
int |
getValueAsInt(java.lang.String path,
org.w3c.dom.Node context,
int defaultValue)
Returns the value defined by the given path as a string. |
org.w3c.dom.Node |
getValueAsNode(java.lang.String path)
Returns the value defined by the given path as an int. |
org.w3c.dom.Node |
getValueAsNode(java.lang.String path,
org.w3c.dom.Node context)
Returns the node defined by the given path. |
java.lang.String |
getValueAsString(java.lang.String path)
Returns the value defined by the given path as a string. |
java.lang.String |
getValueAsString(java.lang.String path,
org.w3c.dom.Node context)
Returns the value defined by the given path as a string. |
static org.w3c.dom.Document |
parseFromURI(java.lang.String uri)
Parses the XML data the given URI points to and returns the DOM Document representing that XML. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XMLPropertiesStore(java.lang.String uri) throws java.io.IOException
uri
- the URI of the XML data containing the properties to read
java.io.IOException
- if the XML data cannot be loadedMethod Detail |
public static org.w3c.dom.Document parseFromURI(java.lang.String uri) throws java.io.IOException
uri
- the URI of the XML data containing the data to read
java.io.IOException
- if the XML data cannot be read or parsedpublic java.lang.String getValueAsString(java.lang.String path)
path
- represents the XPath expression leading to the value.
(see restrictions in the class description)
public int getValueAsInt(java.lang.String path, int defaultValue)
path
- represents the XPath expression leading to the value.
(see restrictions in the class description)defaultValue
- the defaultValue to return if the value cannot be found
public org.w3c.dom.Node getValueAsNode(java.lang.String path)
path
- represents the XPath expression leading to the value.
(see restrictions in the class description)
public org.w3c.dom.Node[] getAllNodes(java.lang.String path)
path
- represents the XPath expression leading to the nodes.
(see restrictions in the class description)
public java.lang.String getValueAsString(java.lang.String path, org.w3c.dom.Node context)
path
- represents the XPath expression leading to the value.
It is relative to the given context.context
- the node from which to interprete the XPath expression.
public int getValueAsInt(java.lang.String path, org.w3c.dom.Node context, int defaultValue)
path
- represents the XPath expression leading to the value.
It is relative to the given context.context
- the node from which to interprete the XPath expression.defaultValue
- the defaultValue to return if the value cannot be found
public org.w3c.dom.Node getValueAsNode(java.lang.String path, org.w3c.dom.Node context)
path
- represents the XPath expression leading to the property.
(see restrictions in the class description)context
- the node from which to interprete the XPath expression.
public org.w3c.dom.Node[] getAllNodes(java.lang.String path, org.w3c.dom.Node context)
path
- represents the XPath expression leading to the nodes.
(see restrictions in the class description)context
- the node from which to interprete the XPath expression.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |