|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.caucho.util.RegistryNode
The Registry is a configuration tree based on a key, value pair structure, essentially like an AList.
Constructor Summary | |
RegistryNode()
Zero-arg constructor. |
Method Summary | |
void |
addChild(RegistryNode child)
Adds the node as a child of the current node |
void |
append(RegistryNode next)
Appends the children of the next node as children of this node. |
java.lang.Object |
clone()
Clones the current node. |
RegistryException |
error(java.lang.Exception e)
Returns a configuration error for a given configuration line number. |
RegistryException |
error(java.lang.String msg)
Returns a configuration error for a given configuration line number. |
boolean |
getBoolean()
Returns a boolean value, returning true if no value is specified. |
boolean |
getBoolean(java.lang.String path,
boolean deflt)
Gets a boolean value from a subnode with a default. |
java.util.List |
getChildren()
|
QDate |
getDate()
|
QDate |
getDate(java.lang.String path,
QDate deflt)
|
double |
getDouble()
Returns the node's value interpreted as a double. |
double |
getDouble(java.lang.String path,
double deflt)
Returns a subnode's value interpreted as a double |
java.lang.String |
getErrorMessage(java.lang.String message)
Adds the filename and line to the error message. |
java.lang.String |
getFilename()
Returns the source filename for the configuration node. |
RegistryNode |
getFirstChild()
Returns the first child node or null if there are no children. |
int |
getInt()
Returns the node's value interpreted as an integer |
int |
getInt(java.lang.String path,
int deflt)
Returns a subnode's value interpreted as an integer |
int |
getLine()
Returns the source line number for the configuration node. |
java.lang.String |
getName()
Returns the attribute's name. |
RegistryNode |
getParent()
Returns the parent node. |
java.lang.String |
getPath()
Returns the node's value interpreted as a path. |
java.lang.String |
getPath(java.lang.String path,
java.lang.String deflt)
Returns a subnode's value interpreted as a path. |
long |
getPeriod()
Returns the value as a period. |
long |
getPeriod(java.lang.String path,
long deflt)
Returns the value as a period. |
Registry |
getRoot()
Return the root node |
java.lang.String |
getString()
Returns the node's value interpreted as a string. |
java.lang.String |
getString(java.lang.String path,
java.lang.String deflt)
Returns a subnode's value interpreted as a string. |
java.lang.String |
getValue()
Returns the attribute's value. |
boolean |
isModified()
Returns true if the underlying files have been modified. |
java.util.Iterator |
iterator()
Returns an iterator over the node's children. |
RegistryNode |
lookup(java.lang.String path)
Returns the node corresponding to the path. |
static long |
periodEnd(long now,
long period)
Calculates the next period end. |
void |
print(WriteStream os)
Prints the RegistryNode tree for debugging. |
java.util.Iterator |
select(java.lang.String key)
Returns an iterator over the node's children which match the key. |
void |
setRoot(Registry root)
Return the root node |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RegistryNode()
Method Detail |
public boolean isModified()
public java.lang.String getName()
public java.lang.String getValue()
public java.lang.String getFilename()
public int getLine()
public RegistryNode getParent()
public RegistryNode getFirstChild()
public Registry getRoot()
public void setRoot(Registry root)
public void append(RegistryNode next)
next
- parent of the children to be addedpublic void addChild(RegistryNode child)
child
- new child to be addedpublic boolean getBoolean() throws RegistryException
<flag> <flag>true</flag> <flag>yes</flag>
RegistryException
- if the value isn't true or false.public boolean getBoolean(java.lang.String path, boolean deflt) throws RegistryException
path
- hierarchical path specifying a child nodedeflt
- default value if no node is foundpublic RegistryNode lookup(java.lang.String path)
RegistryNode subnode = node.lookup("web-app/servlet");
path
- slash-separated path selecting a descendent node.public int getInt() throws RegistryException
throws
- RegistryException if the value isn't a valid
integerpublic int getInt(java.lang.String path, int deflt) throws RegistryException
path
- the path to the subnodedeflt
- default value for the intthrows
- RegistryException if the value isn't a valid
integerpublic double getDouble() throws RegistryException
throws
- RegistryException if the value isn't a valid
doublepublic double getDouble(java.lang.String path, double deflt) throws RegistryException
path
- the path to the subnodedeflt
- default value for the doublethrows
- RegistryException if the value isn't a valid
doublepublic java.lang.String getString()
public java.lang.String getString(java.lang.String path, java.lang.String deflt)
path
- the path to the subnodedeflt
- default value for the stringpublic java.lang.String getPath()
getPath
automatically looks up variables in
the System.properties so $foo/bar.xml resolves to the value of $foo.public java.lang.String getPath(java.lang.String path, java.lang.String deflt)
path
- the path to the subnodedeflt
- default value for the stringpublic QDate getDate() throws RegistryException
public QDate getDate(java.lang.String path, QDate deflt) throws RegistryException
public long getPeriod() throws RegistryException
s | seconds |
m | minutes |
h | hours |
D | days |
W | weeks |
M | months |
Y | years |
throws
- RegistryException if the value isn't a valid
periodpublic long getPeriod(java.lang.String path, long deflt) throws RegistryException
s | seconds |
m | minutes |
h | hours |
D | days |
W | weeks |
M | months |
Y | years |
path
- the path to the configuration subnodedeflt
- default periodthrows
- RegistryException if the value isn't a valid
periodpublic static long periodEnd(long now, long period)
public java.util.Iterator iterator()
public java.util.Iterator select(java.lang.String key)
key
- the key for the children to matchpublic java.util.List getChildren()
public RegistryException error(java.lang.String msg)
msg
- the error message.public RegistryException error(java.lang.Exception e)
node
- the configuration node throwing the error.e
- exception thrown for that node.public java.lang.String getErrorMessage(java.lang.String message)
resin.conf:14: unknown tag `foo'
message
- the error messagepublic void print(WriteStream os) throws java.io.IOException
os
- the write stream to print the tree to.public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |