From 50250a3a3af625be69851f1ecf56015abe5bf320 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 29 Jul 2007 07:54:49 +0000 Subject: * Highly experimental: Added DB4o DataStore support. Untested. --- .../OpenSim.DataStore.DB4o/DB4oDataStore.cs | 46 ++++++++++++++++++---- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs index 71275c3..4497a2b 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs @@ -3,15 +3,34 @@ using System.Collections.Generic; using System.Text; using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.LandManagement; using OpenSim.Region.Environment; using OpenSim.Region.Interfaces; using OpenSim.Framework.Console; using libsecondlife; using Db4objects.Db4o; +using Db4objects.Db4o.Query; -namespace OpenSim.DataStore.NullStorage +namespace OpenSim.DataStore.DB4oStorage { + + public class SceneObjectQuery : Predicate + { + private LLUUID globalIDSearch; + + public SceneObjectQuery(LLUUID find) + { + globalIDSearch = find; + } + + public bool Match(SceneObject obj) + { + return obj.rootUUID == globalIDSearch; + } + } + + public class DB4oDataStore : IRegionDataStore { private IObjectContainer db; @@ -30,12 +49,25 @@ namespace OpenSim.DataStore.NullStorage public void RemoveObject(LLUUID obj) { - + IObjectSet result = db.Query(new SceneObjectQuery(obj)); + if (result.Count > 0) + { + SceneObject item = (SceneObject)result.Next(); + db.Delete(item); + } } public List LoadObjects() { - return new List(); + IObjectSet result = db.Get(typeof(SceneObject)); + List retvals = new List(); + + foreach (Object obj in result) + { + retvals.Add((SceneObject)obj); + } + + return retvals; } public void StoreTerrain(double[,] ter) @@ -48,19 +80,19 @@ namespace OpenSim.DataStore.NullStorage return null; } - public void RemoveParcel(uint id) + public void RemoveLandObject(uint id) { } - public void StoreParcel(OpenSim.Region.Environment.Parcel parcel) + public void StoreParcel(Land parcel) { } - public List LoadParcels() + public List LoadLandObjects() { - return new List(); + return new List(); } public void Shutdown() -- cgit v1.1