/// <summary>Loads a node from its id.</summary>
 /// <remarks>
 /// Loads a node from its id. Tries to get if from memory, if not present
 /// then loads it from odb storage
 /// </remarks>
 /// <param name="id">The id of the nod</param>
 /// <returns>The node with the specific id</returns>
 public virtual NeoDatis.Btree.IBTreeNode LoadNodeById(object id)
 {
     NeoDatis.Odb.OID oid = (NeoDatis.Odb.OID)id;
     // Check if node is in memory
     NeoDatis.Btree.IBTreeNode node = (NeoDatis.Btree.IBTreeNode)oids[oid];
     if (node != null)
     {
         nbLoadNodesFromCache++;
         return(node);
     }
     nbLoadNodes++;
     // else load from odb
     try
     {
         if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
         {
             NeoDatis.Tool.DLogger.Debug("Loading node with id " + oid);
         }
         if (oid == null)
         {
             throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Btree.BTreeError.InvalidIdForBtree
                                                        .AddParameter(oid));
         }
         NeoDatis.Btree.IBTreeNode pn = (NeoDatis.Btree.IBTreeNode)engine.GetObjectFromOid
                                            (oid);
         pn.SetId(oid);
         if (tree != null)
         {
             pn.SetBTree(tree);
         }
         // Keep the node in memory
         oids.Add(oid, pn);
         return(pn);
     }
     catch (System.Exception e)
     {
         throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Btree.BTreeError.InternalError
                                                    , e);
     }
 }
Exemple #2
0
 private NeoDatis.Odb.ObjectValues ConvertObject(NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
                                                 values)
 {
     NeoDatis.Odb.Impl.Core.Query.List.Values.DefaultObjectValues dov = new NeoDatis.Odb.Impl.Core.Query.List.Values.DefaultObjectValues
                                                                            (returnArraySize);
     NeoDatis.Odb.Core.Query.Execution.IQueryFieldAction qfa = null;
     for (int i = 0; i < returnArraySize; i++)
     {
         qfa = queryFieldActions[i];
         qfa.Execute(values.GetObjectInfoHeader().GetOid(), values);
         object o = qfa.GetValue();
         // When Values queries return objects, they actually return the oid of the object
         // So we must load it here
         if (o != null && o is NeoDatis.Odb.OID)
         {
             NeoDatis.Odb.Impl.Core.Oid.OdbObjectOID oid = (NeoDatis.Odb.Impl.Core.Oid.OdbObjectOID
                                                            )o;
             o = engine.GetObjectFromOid(oid);
         }
         dov.Set(i, qfa.GetAlias(), o);
     }
     return(dov);
 }
 public virtual object GetObjectFromId(NeoDatis.Odb.OID id)
 {
     return(storageEngine.GetObjectFromOid(id));
 }