net.jinx.db
Class XMLHierarchy

java.lang.Object
  extended by net.jinx.db.Hierarchy
      extended by net.jinx.db.SimpleHierarchy
          extended by net.jinx.db.MemoryHierarchy
              extended by net.jinx.db.XMLHierarchy
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LockingXMLHierarchy

public class XMLHierarchy
extends MemoryHierarchy

Lightning-fast, memory resident, persistable Hierarchy implementation. This class, if given a file, will store it's data to disk when commit() is called.

NOTE: Serializing an instance of this class will cause it to lose it's connection to it's files and when it is deserialized it will function like a MemoryHierarchy.

API Stability: Stable.

See Also:
Serialized Form

Constructor Summary
XMLHierarchy()
          Deprecated. use either the SimpleHierarchy or MemoryHierarchy classes in this package instead, depending on if you need commit/rollback ability or not. If all you need is the very basic capability this constructor once provided, use SimpleHierarchy.
XMLHierarchy(java.io.File xmlfile)
          Constructs a persistent XMLHierarchy object using xmlfile.
XMLHierarchy(java.io.File xmlfile, java.io.File logfile)
          Constructs a persistent XMLHierarchy object using xmlfile.
XMLHierarchy(java.lang.String xf)
          Constructs a persistent XMLHierarchy object using the given name as the name of the file to use.
XMLHierarchy(java.lang.String xf, java.lang.String lf)
          Constructs a persistent XMLHierarchy object using xf as the name of the file to use.
 
Method Summary
 void close()
          Closes this XMLHierarchy.
 void commit()
          Same as in the super-class, only it also dumps a copy out to disk.
static void main(java.lang.String[] args)
           
 
Methods inherited from class net.jinx.db.MemoryHierarchy
getLog, rollback
 
Methods inherited from class net.jinx.db.SimpleHierarchy
attributes, clearAttributes, clearNodes, createNode, deleteNode, getAttributeObject, getNode, hasAttribute, nodes, removeAttribute, setAttributeObject
 
Methods inherited from class net.jinx.db.Hierarchy
addListener, clear, copyTo, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, parseFromProperties, parseFromXML, propertyChanged, removeListener, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, storeToProperties, storeToXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHierarchy

public XMLHierarchy()
Deprecated. use either the SimpleHierarchy or MemoryHierarchy classes in this package instead, depending on if you need commit/rollback ability or not. If all you need is the very basic capability this constructor once provided, use SimpleHierarchy.

Constructs a non-persistent XMLHierarchy object.


XMLHierarchy

public XMLHierarchy(java.lang.String xf)
Constructs a persistent XMLHierarchy object using the given name as the name of the file to use. It will also append ".log" on the end and use that as an additional file for backup and crash recovery purposes. This implies a call to rollback().

Parameters:
xf - the name of the file that stores xml data.

XMLHierarchy

public XMLHierarchy(java.lang.String xf,
                    java.lang.String lf)
Constructs a persistent XMLHierarchy object using xf as the name of the file to use. It will also use lf as an additional file for backup and crash recovery purposes. This implies a call to rollback().

Parameters:
xf - the name of the file that stores xml data.
lf - the name of the file that stores crash-recovery data.

XMLHierarchy

public XMLHierarchy(java.io.File xmlfile)
Constructs a persistent XMLHierarchy object using xmlfile. It will also append ".log" on the end of the file name and use that as an additional file for backup and crash recovery purposes. This implies a call to rollback().

Parameters:
xmlfile - the file that stores xml data.

XMLHierarchy

public XMLHierarchy(java.io.File xmlfile,
                    java.io.File logfile)
Constructs a persistent XMLHierarchy object using xmlfile. It will also use logfilef as an additional file for backup and crash recovery purposes. This implies a call to rollback().

Parameters:
xmlfile - the file that stores xml data.
logfile - the file that stores crash-recovery data.
Method Detail

close

public void close()
Closes this XMLHierarchy. Further commits will only commit to the in-memeory commit/rollback log.

Overrides:
close in class MemoryHierarchy

commit

public void commit()
Same as in the super-class, only it also dumps a copy out to disk.

Overrides:
commit in class MemoryHierarchy

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception