|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jinx.db.Hierarchy net.jinx.db.DefaultHierarchy
public class DefaultHierarchy
Hierarchy implementation based on a pair of Hierarchy objects. The first of
the two is checked for attributes and then failing that, the second is
checked, using it as a source of default values. Calling methods that modify
the Hierarchy modify the first, but not the second.
API Stability: Alpha.
Constructor Summary | |
---|---|
DefaultHierarchy(Hierarchy main,
Hierarchy defaults)
Constructs a new DefaultHierarchy. |
Method Summary | |
---|---|
void |
addListener(HierarchyListener listener)
Allows a HierarchyListener to receive events from this specific Hierarchy, but not any of it's children. |
java.util.Iterator |
attributes()
Provides an Iterator for the attributes that are stored in this Hierarchy, but not any of it's sub-nodes. |
void |
clear()
Clears all attributes and sub-nodes from this Hierarchy. |
void |
clearAttributes()
Clears all attributes from this Hierarchy. |
void |
clearNodes()
Clears all sub-nodes from this hierarchy. |
void |
close()
Closes the Hierarchy. |
void |
commit()
Completes the current transaction. |
void |
copyTo(Hierarchy h)
Recursively copies this Hierarchy object's contents into another. |
Hierarchy |
createNode(java.lang.String name)
Creates a new node with the given name. |
void |
deleteNode(java.lang.String name)
Removes the node with the given name. |
protected java.lang.Object |
getAttributeObject(java.lang.String name)
Gets the attribute's value Object. |
protected Hierarchy |
getDefaults()
|
protected Hierarchy |
getMain()
|
Hierarchy |
getNode(java.lang.String name)
Provides the Hierarchy for the given node name. |
boolean |
hasAttribute(java.lang.String name)
|
java.util.Iterator |
nodes()
Provides an Iterator for the sub-nodes that are direct sub-nodes of this Hierarchy. |
void |
parseFromProperties(java.util.Properties prop)
Sets attributes in this Hierarchy according to a Properties Object. |
void |
parseFromXML(java.io.InputStream in)
Reads attributes and nodes for the Hierarchy from the given InputStream. |
java.lang.Object |
removeAttribute(java.lang.String name)
Remove the value for the given attribute name, returning the previous value. |
void |
rollback()
Discards all changes since the most recent call to commit(). |
protected java.lang.Object |
setAttributeObject(java.lang.String name,
java.lang.Object obj)
Sets an attribute's value Object. |
void |
storeToProperties(java.util.Properties prop)
Stores this Hierarchy tree in a Properties Object. |
void |
storeToXML(java.io.OutputStream o)
Stores the Hierarchy tree to the given java.io.OutputStream as XML. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultHierarchy(Hierarchy main, Hierarchy defaults)
main
- the Hierarchy that is checked for values first.defaults
- the Hierarchy that is checked if main doesn't have a
given value.Method Detail |
---|
protected Hierarchy getDefaults()
protected Hierarchy getMain()
public java.util.Iterator attributes()
Hierarchy
attributes
in class Hierarchy
public void clearAttributes()
Hierarchy
clearAttributes
in class Hierarchy
public void clearNodes()
Hierarchy
clearNodes
in class Hierarchy
public Hierarchy createNode(java.lang.String name)
Hierarchy
createNode
in class Hierarchy
name
- the name of the node.
public void deleteNode(java.lang.String name)
Hierarchy
deleteNode
in class Hierarchy
name
- the name of the node.protected java.lang.Object getAttributeObject(java.lang.String name)
Hierarchy
getAttributeObject
in class Hierarchy
name
- the name of the attribute to access.
public Hierarchy getNode(java.lang.String name)
Hierarchy
getNode
in class Hierarchy
name
- the name of the node to access.
public boolean hasAttribute(java.lang.String name)
hasAttribute
in class Hierarchy
public java.util.Iterator nodes()
Hierarchy
nodes
in class Hierarchy
public java.lang.Object removeAttribute(java.lang.String name)
Hierarchy
removeAttribute
in class Hierarchy
name
- the name of the attribute to access.
protected java.lang.Object setAttributeObject(java.lang.String name, java.lang.Object obj)
Hierarchy
setAttributeObject
in class Hierarchy
name
- the name of the attribute to access.
public void addListener(HierarchyListener listener)
Hierarchy
addListener
in class Hierarchy
listener
- the HierarchyListener to add.public void clear()
Hierarchy
clear
in class Hierarchy
public void close()
Hierarchy
close
in class Hierarchy
public void commit()
Hierarchy
commit
in class Hierarchy
public void copyTo(Hierarchy h)
Hierarchy
copyTo
in class Hierarchy
h
- the Hierarchy to copy to.public void parseFromProperties(java.util.Properties prop)
Hierarchy
parseFromProperties
in class Hierarchy
prop
- the Properties object.public void parseFromXML(java.io.InputStream in) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
Hierarchy
parseFromXML
in class Hierarchy
in
- the InputStream to read from.
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
public void rollback()
Hierarchy
rollback
in class Hierarchy
public void storeToProperties(java.util.Properties prop)
Hierarchy
storeToProperties
in class Hierarchy
prop
- the Properties object.public void storeToXML(java.io.OutputStream o) throws java.io.IOException
Hierarchy
storeToXML
in class Hierarchy
o
- the OutputStream to write to.
java.io.IOException
- if an I/O error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |