org.neodatis.odb.impl.core.btree
Class LazyODBBTreePersister

java.lang.Object
  extended by org.neodatis.odb.impl.core.btree.LazyODBBTreePersister
All Implemented Interfaces:
IBTreePersister, ICommitListener

public class LazyODBBTreePersister
extends java.lang.Object
implements IBTreePersister, ICommitListener

Class that persists the BTree and its node into the NeoDatis ODB Database.

Author:
osmadja

Field Summary
static java.lang.String LOG_ID
           
static int nbLoadNodes
           
static int nbLoadNodesFromCache
           
static int nbLoadTree
           
static int nbSaveNodes
           
static int nbSaveNodesInCache
           
static int nbSaveTree
           
 
Constructor Summary
LazyODBBTreePersister(IStorageEngine engine)
           
LazyODBBTreePersister(ODB odb)
           
 
Method Summary
protected  void addModifiedOid(OID oid)
           
 void afterCommit()
           
 void beforeCommit()
           
 void clear()
           
 void clearModified()
           
 void close()
           
static java.lang.StringBuffer counters()
           
 java.lang.Object deleteNode(IBTreeNode o)
           
 void flush()
           
 OID getNextNodeId()
           
 IBTree loadBTree(java.lang.Object id)
           
 IBTreeNode loadNodeById(java.lang.Object id)
          Loads a node from its id.
 void persist()
           
static void resetCounters()
           
 OID saveBTree(IBTree treeToSave)
           
 java.lang.Object saveNode(IBTreeNode node)
          saves the bree node Only puts the current node in an 'modified Node' map to be saved on commit
 void setBTree(IBTree tree)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_ID

public static final java.lang.String LOG_ID
See Also:
Constant Field Values

nbSaveNodes

public static int nbSaveNodes

nbSaveNodesInCache

public static int nbSaveNodesInCache

nbSaveTree

public static int nbSaveTree

nbLoadNodes

public static int nbLoadNodes

nbLoadTree

public static int nbLoadTree

nbLoadNodesFromCache

public static int nbLoadNodesFromCache
Constructor Detail

LazyODBBTreePersister

public LazyODBBTreePersister(ODB odb)

LazyODBBTreePersister

public LazyODBBTreePersister(IStorageEngine engine)
Method Detail

loadNodeById

public IBTreeNode loadNodeById(java.lang.Object id)
Loads a node from its id. Tries to get if from memory, if not present then loads it from odb storage

Specified by:
loadNodeById in interface IBTreePersister
Parameters:
id - The id of the nod
Returns:
The node with the specific id

saveNode

public java.lang.Object saveNode(IBTreeNode node)
saves the bree node Only puts the current node in an 'modified Node' map to be saved on commit

Specified by:
saveNode in interface IBTreePersister

close

public void close()
           throws java.lang.Exception
Specified by:
close in interface IBTreePersister
Throws:
java.lang.Exception

loadBTree

public IBTree loadBTree(java.lang.Object id)
Specified by:
loadBTree in interface IBTreePersister

saveBTree

public OID saveBTree(IBTree treeToSave)
Specified by:
saveBTree in interface IBTreePersister

getNextNodeId

public OID getNextNodeId()
                  throws java.io.IOException
Throws:
java.io.IOException

persist

public void persist()

afterCommit

public void afterCommit()
Specified by:
afterCommit in interface ICommitListener

beforeCommit

public void beforeCommit()
Specified by:
beforeCommit in interface ICommitListener

deleteNode

public java.lang.Object deleteNode(IBTreeNode o)
Specified by:
deleteNode in interface IBTreePersister

setBTree

public void setBTree(IBTree tree)
Specified by:
setBTree in interface IBTreePersister

resetCounters

public static void resetCounters()

counters

public static java.lang.StringBuffer counters()

clear

public void clear()
Specified by:
clear in interface IBTreePersister

clearModified

public void clearModified()

flush

public void flush()
Specified by:
flush in interface IBTreePersister

addModifiedOid

protected void addModifiedOid(OID oid)