diff options
author | Adam Frisby | 2007-05-05 21:49:24 +0000 |
---|---|---|
committer | Adam Frisby | 2007-05-05 21:49:24 +0000 |
commit | 51da80a8506f08511c45e8fd87044989f8221b87 (patch) | |
tree | b7951215e4a07f1742766540ea4f9464fbdd4061 | |
parent | Run prebuild to generate working project files. (diff) | |
download | opensim-SC_OLD-51da80a8506f08511c45e8fd87044989f8221b87.zip opensim-SC_OLD-51da80a8506f08511c45e8fd87044989f8221b87.tar.gz opensim-SC_OLD-51da80a8506f08511c45e8fd87044989f8221b87.tar.bz2 opensim-SC_OLD-51da80a8506f08511c45e8fd87044989f8221b87.tar.xz |
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.
4 files changed, 187 insertions, 0 deletions
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 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenGrid.Framework.Data; | ||
5 | using libsecondlife; | ||
6 | |||
7 | |||
8 | namespace OpenGrid.Framework.Data.DB4o | ||
9 | { | ||
10 | class DB4oGridData : IGridData | ||
11 | { | ||
12 | DB4oManager manager; | ||
13 | |||
14 | public void Initialise() { | ||
15 | manager = new DB4oManager("gridserver.yap"); | ||
16 | } | ||
17 | |||
18 | public SimProfileData GetProfileByHandle(ulong handle) { | ||
19 | lock (manager.profiles) | ||
20 | { | ||
21 | foreach (LLUUID UUID in manager.profiles.Keys) | ||
22 | { | ||
23 | if (manager.profiles[UUID].regionHandle == handle) | ||
24 | { | ||
25 | return manager.profiles[UUID]; | ||
26 | } | ||
27 | } | ||
28 | } | ||
29 | throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); | ||
30 | } | ||
31 | |||
32 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) | ||
33 | { | ||
34 | lock (manager.profiles) | ||
35 | { | ||
36 | if (manager.profiles.ContainsKey(uuid)) | ||
37 | return manager.profiles[uuid]; | ||
38 | } | ||
39 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")"); | ||
40 | } | ||
41 | |||
42 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { | ||
43 | if (manager.profiles[uuid].regionRecvKey == key) | ||
44 | return true; | ||
45 | return false; | ||
46 | } | ||
47 | |||
48 | public void Close() | ||
49 | { | ||
50 | manager = null; | ||
51 | } | ||
52 | |||
53 | public string getName() | ||
54 | { | ||
55 | return "DB4o Grid Provider"; | ||
56 | } | ||
57 | |||
58 | public string getVersion() | ||
59 | { | ||
60 | return "0.1"; | ||
61 | } | ||
62 | } | ||
63 | } | ||
diff --git a/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGrid.Framework.Data.DB4o/DB4oManager.cs new file mode 100644 index 0000000..f889636 --- /dev/null +++ b/OpenGrid.Framework.Data.DB4o/DB4oManager.cs | |||
@@ -0,0 +1,27 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using Db4objects.Db4o; | ||
5 | using OpenGrid.Framework.Data; | ||
6 | using libsecondlife; | ||
7 | |||
8 | namespace OpenGrid.Framework.Data.DB4o | ||
9 | { | ||
10 | class DB4oManager | ||
11 | { | ||
12 | public Dictionary<LLUUID, SimProfileData> profiles = new Dictionary<LLUUID, SimProfileData>(); | ||
13 | |||
14 | public DB4oManager(string db4odb) | ||
15 | { | ||
16 | IObjectContainer database; | ||
17 | database = Db4oFactory.OpenFile(db4odb); | ||
18 | IObjectSet result = database.Get(typeof(SimProfileData)); | ||
19 | foreach(SimProfileData row in result) { | ||
20 | profiles.Add(row.UUID, row); | ||
21 | } | ||
22 | database.Close(); | ||
23 | } | ||
24 | |||
25 | |||
26 | } | ||
27 | } | ||
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 0000000..c20b8ec --- /dev/null +++ b/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj | |||
@@ -0,0 +1,62 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ProductVersion>8.0.50727</ProductVersion> | ||
6 | <SchemaVersion>2.0</SchemaVersion> | ||
7 | <ProjectGuid>{2E05D4B8-4D75-4F40-A99C-CD007C35E598}</ProjectGuid> | ||
8 | <OutputType>Library</OutputType> | ||
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
10 | <RootNamespace>OpenGrid.Framework.Data.DB4o</RootNamespace> | ||
11 | <AssemblyName>OpenGrid.Framework.Data.DB4o</AssemblyName> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
14 | <DebugSymbols>true</DebugSymbols> | ||
15 | <DebugType>full</DebugType> | ||
16 | <Optimize>false</Optimize> | ||
17 | <OutputPath>bin\Debug\</OutputPath> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <ErrorReport>prompt</ErrorReport> | ||
20 | <WarningLevel>4</WarningLevel> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
23 | <DebugType>pdbonly</DebugType> | ||
24 | <Optimize>true</Optimize> | ||
25 | <OutputPath>bin\Release\</OutputPath> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <ErrorReport>prompt</ErrorReport> | ||
28 | <WarningLevel>4</WarningLevel> | ||
29 | </PropertyGroup> | ||
30 | <ItemGroup> | ||
31 | <Reference Include="Db4objects.Db4o, Version=6.0.1.0, Culture=neutral, PublicKeyToken=6199cd4f203aa8eb, processorArchitecture=MSIL"> | ||
32 | <SpecificVersion>False</SpecificVersion> | ||
33 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> | ||
34 | </Reference> | ||
35 | <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
36 | <SpecificVersion>False</SpecificVersion> | ||
37 | <HintPath>..\bin\libsecondlife.dll</HintPath> | ||
38 | </Reference> | ||
39 | <Reference Include="System" /> | ||
40 | <Reference Include="System.Data" /> | ||
41 | <Reference Include="System.Xml" /> | ||
42 | </ItemGroup> | ||
43 | <ItemGroup> | ||
44 | <Compile Include="DB4oGridData.cs" /> | ||
45 | <Compile Include="DB4oManager.cs" /> | ||
46 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
47 | </ItemGroup> | ||
48 | <ItemGroup> | ||
49 | <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj"> | ||
50 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | ||
51 | <Name>OpenGrid.Framework.Data</Name> | ||
52 | </ProjectReference> | ||
53 | </ItemGroup> | ||
54 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
55 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
56 | Other similar extension points exist, see Microsoft.Common.targets. | ||
57 | <Target Name="BeforeBuild"> | ||
58 | </Target> | ||
59 | <Target Name="AfterBuild"> | ||
60 | </Target> | ||
61 | --> | ||
62 | </Project> \ 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 0000000..dc4a9a1 --- /dev/null +++ b/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,35 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGrid.Framework.Data.DB4o")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework.Data.DB4o")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||