From 51da80a8506f08511c45e8fd87044989f8221b87 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 5 May 2007 21:49:24 +0000 Subject: Grid Framework for DB4o - supports all framework.data interfaces. *** Important Note *** Framework.Data interfaces are not yet complete (they are strictly read-only right now), because of this, write support is not yet implemented. --- OpenGrid.Framework.Data.DB4o/DB4oGridData.cs | 63 ++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 OpenGrid.Framework.Data.DB4o/DB4oGridData.cs (limited to 'OpenGrid.Framework.Data.DB4o/DB4oGridData.cs') diff --git a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs new file mode 100644 index 0000000..d15e343 --- /dev/null +++ b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenGrid.Framework.Data; +using libsecondlife; + + +namespace OpenGrid.Framework.Data.DB4o +{ + class DB4oGridData : IGridData + { + DB4oManager manager; + + public void Initialise() { + manager = new DB4oManager("gridserver.yap"); + } + + public SimProfileData GetProfileByHandle(ulong handle) { + lock (manager.profiles) + { + foreach (LLUUID UUID in manager.profiles.Keys) + { + if (manager.profiles[UUID].regionHandle == handle) + { + return manager.profiles[UUID]; + } + } + } + throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); + } + + public SimProfileData GetProfileByLLUUID(LLUUID uuid) + { + lock (manager.profiles) + { + if (manager.profiles.ContainsKey(uuid)) + return manager.profiles[uuid]; + } + throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")"); + } + + public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { + if (manager.profiles[uuid].regionRecvKey == key) + return true; + return false; + } + + public void Close() + { + manager = null; + } + + public string getName() + { + return "DB4o Grid Provider"; + } + + public string getVersion() + { + return "0.1"; + } + } +} -- cgit v1.1