* Highly experimental: Added DB4o DataStore support. Untested.

afrisby
Adam Frisby 2007-07-29 07:54:49 +00:00
parent 039d46e8fa
commit 50250a3a3a
2 changed files with 63 additions and 7 deletions

View File

@ -3,15 +3,34 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
using OpenSim.Region.Interfaces; using OpenSim.Region.Interfaces;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using libsecondlife; using libsecondlife;
using Db4objects.Db4o; 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 public class DB4oDataStore : IRegionDataStore
{ {
private IObjectContainer db; private IObjectContainer db;
@ -30,12 +49,25 @@ namespace OpenSim.DataStore.NullStorage
public void RemoveObject(LLUUID obj) 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<SceneObject> LoadObjects() public List<SceneObject> LoadObjects()
{ {
return new List<SceneObject>(); IObjectSet result = db.Get(typeof(SceneObject));
List<SceneObject> retvals = new List<SceneObject>();
foreach (Object obj in result)
{
retvals.Add((SceneObject)obj);
}
return retvals;
} }
public void StoreTerrain(double[,] ter) public void StoreTerrain(double[,] ter)
@ -48,19 +80,19 @@ namespace OpenSim.DataStore.NullStorage
return null; 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<OpenSim.Region.Environment.Parcel> LoadParcels() public List<Land> LoadLandObjects()
{ {
return new List<OpenSim.Region.Environment.Parcel>(); return new List<Land>();
} }
public void Shutdown() public void Shutdown()

View File

@ -595,6 +595,30 @@
</Options> </Options>
</Configuration> </Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/>
<Reference name="System.Xml"/>
<Reference name="libsecondlife.dll"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.Environment"/>
<Reference name="OpenSim.Framework.Console"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenSim.DataStore.DB4o" path="OpenSim/Region/Storage/OpenSim.DataStore.DB4o" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/> <Reference name="System" localCopy="false"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>