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.
0.1-prestable
Adam Frisby 2007-05-05 21:49:24 +00:00
parent fe6ed5391b
commit 51da80a850
4 changed files with 187 additions and 0 deletions

View File

@ -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";
}
}
}

View File

@ -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<LLUUID, SimProfileData> profiles = new Dictionary<LLUUID, SimProfileData>();
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();
}
}
}

View File

@ -0,0 +1,62 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{2E05D4B8-4D75-4F40-A99C-CD007C35E598}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenGrid.Framework.Data.DB4o</RootNamespace>
<AssemblyName>OpenGrid.Framework.Data.DB4o</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Db4objects.Db4o, Version=6.0.1.0, Culture=neutral, PublicKeyToken=6199cd4f203aa8eb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
</Reference>
<Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\libsecondlife.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DB4oGridData.cs" />
<Compile Include="DB4oManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
<Project>{62CDF671-0000-0000-0000-000000000000}</Project>
<Name>OpenGrid.Framework.Data</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -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")]