From 51da80a8506f08511c45e8fd87044989f8221b87 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 5 May 2007 21:49:24 +0000 Subject: [PATCH] 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 +++++++++++++++++++ OpenGrid.Framework.Data.DB4o/DB4oManager.cs | 27 ++++++++ .../OpenGrid.Framework.Data.DB4o.csproj | 62 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 35 +++++++++++ 4 files changed, 187 insertions(+) create mode 100644 OpenGrid.Framework.Data.DB4o/DB4oGridData.cs create mode 100644 OpenGrid.Framework.Data.DB4o/DB4oManager.cs create mode 100644 OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj create mode 100644 OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs diff --git a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs new file mode 100644 index 0000000000..d15e3439f8 --- /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"; + } + } +} diff --git a/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGrid.Framework.Data.DB4o/DB4oManager.cs new file mode 100644 index 0000000000..f88963641f --- /dev/null +++ b/OpenGrid.Framework.Data.DB4o/DB4oManager.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Db4objects.Db4o; +using OpenGrid.Framework.Data; +using libsecondlife; + +namespace OpenGrid.Framework.Data.DB4o +{ + class DB4oManager + { + public Dictionary profiles = new Dictionary(); + + public DB4oManager(string db4odb) + { + IObjectContainer database; + database = Db4oFactory.OpenFile(db4odb); + IObjectSet result = database.Get(typeof(SimProfileData)); + foreach(SimProfileData row in result) { + profiles.Add(row.UUID, row); + } + database.Close(); + } + + + } +} diff --git a/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj b/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj new file mode 100644 index 0000000000..c20b8ecde9 --- /dev/null +++ b/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj @@ -0,0 +1,62 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {2E05D4B8-4D75-4F40-A99C-CD007C35E598} + Library + Properties + OpenGrid.Framework.Data.DB4o + OpenGrid.Framework.Data.DB4o + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\bin\Db4objects.Db4o.dll + + + False + ..\bin\libsecondlife.dll + + + + + + + + + + + + + {62CDF671-0000-0000-0000-000000000000} + OpenGrid.Framework.Data + + + + + \ No newline at end of file diff --git a/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs b/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..dc4a9a1dfd --- /dev/null +++ b/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenGrid.Framework.Data.DB4o")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenGrid.Framework.Data.DB4o")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]