Exemplo n.º 1
0
 public virtual void SetPersister(NeoDatis.Btree.IBTreePersister persister)
 {
     this.persister = persister;
     this.persister.SetBTree(this);
     if (root.GetBTree() == null)
     {
         root.SetBTree(this);
     }
 }
 /// <summary>
 /// saves the bree node Only puts the current node in an 'modified Node' map
 /// to be saved on commit
 /// </summary>
 public virtual object SaveNode(NeoDatis.Btree.IBTreeNode node)
 {
     NeoDatis.Odb.OID oid = null;
     // Here we only save the node if it does not have id,
     // else we just save into the hashmap
     if (node.GetId() == NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
         .NullObjectId)
     {
         try
         {
             nbSaveNodes++;
             // first get the oid. : -2:it could be any value
             oid = engine.GetObjectWriter().GetIdManager().GetNextObjectId(-2);
             node.SetId(oid);
             oid = engine.Store(oid, node);
             if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
             {
                 NeoDatis.Tool.DLogger.Debug("Saved node id " + oid);
             }
             // + " : " +
             // node.toString());
             if (tree != null && node.GetBTree() == null)
             {
                 node.SetBTree(tree);
             }
             oids.Add(oid, node);
             return(oid);
         }
         catch (System.Exception e)
         {
             throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Btree.BTreeError.InternalError
                                                        .AddParameter("While saving node"), e);
         }
     }
     nbSaveNodesInCache++;
     oid = (NeoDatis.Odb.OID)node.GetId();
     oids.Add(oid, node);
     AddModifiedOid(oid);
     return(oid);
 }