diff options
author | gareth | 2007-05-07 16:32:30 +0000 |
---|---|---|
committer | gareth | 2007-05-07 16:32:30 +0000 |
commit | 3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1 (patch) | |
tree | 5d6b1009685278b214100a7901bd4feaeed584da /OpenGrid.Framework.Data.DB4o | |
parent | Updated to have uniform build number (diff) | |
download | opensim-SC_OLD-3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1.zip opensim-SC_OLD-3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1.tar.gz opensim-SC_OLD-3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1.tar.bz2 opensim-SC_OLD-3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1.tar.xz |
Merged 0.1-prestable back into trunk :(
Diffstat (limited to 'OpenGrid.Framework.Data.DB4o')
-rw-r--r-- | OpenGrid.Framework.Data.DB4o/DB4oGridData.cs | 22 | ||||
-rw-r--r-- | OpenGrid.Framework.Data.DB4o/DB4oManager.cs | 68 | ||||
-rw-r--r-- | OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj | 38 |
3 files changed, 97 insertions, 31 deletions
diff --git a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs index c853b50..caf7eb0 100644 --- a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs +++ b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs | |||
@@ -9,20 +9,20 @@ namespace OpenGrid.Framework.Data.DB4o | |||
9 | { | 9 | { |
10 | class DB4oGridData : IGridData | 10 | class DB4oGridData : IGridData |
11 | { | 11 | { |
12 | DB4oManager manager; | 12 | DB4oGridManager manager; |
13 | 13 | ||
14 | public void Initialise() { | 14 | public void Initialise() { |
15 | manager = new DB4oManager("gridserver.yap"); | 15 | manager = new DB4oGridManager("gridserver.yap"); |
16 | } | 16 | } |
17 | 17 | ||
18 | public SimProfileData GetProfileByHandle(ulong handle) { | 18 | public SimProfileData GetProfileByHandle(ulong handle) { |
19 | lock (manager.profiles) | 19 | lock (manager.simProfiles) |
20 | { | 20 | { |
21 | foreach (LLUUID UUID in manager.profiles.Keys) | 21 | foreach (LLUUID UUID in manager.simProfiles.Keys) |
22 | { | 22 | { |
23 | if (manager.profiles[UUID].regionHandle == handle) | 23 | if (manager.simProfiles[UUID].regionHandle == handle) |
24 | { | 24 | { |
25 | return manager.profiles[UUID]; | 25 | return manager.simProfiles[UUID]; |
26 | } | 26 | } |
27 | } | 27 | } |
28 | } | 28 | } |
@@ -31,17 +31,17 @@ namespace OpenGrid.Framework.Data.DB4o | |||
31 | 31 | ||
32 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) | 32 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) |
33 | { | 33 | { |
34 | lock (manager.profiles) | 34 | lock (manager.simProfiles) |
35 | { | 35 | { |
36 | if (manager.profiles.ContainsKey(uuid)) | 36 | if (manager.simProfiles.ContainsKey(uuid)) |
37 | return manager.profiles[uuid]; | 37 | return manager.simProfiles[uuid]; |
38 | } | 38 | } |
39 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")"); | 39 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")"); |
40 | } | 40 | } |
41 | 41 | ||
42 | public DataResponse AddProfile(SimProfileData profile) | 42 | public DataResponse AddProfile(SimProfileData profile) |
43 | { | 43 | { |
44 | lock (manager.profiles) | 44 | lock (manager.simProfiles) |
45 | { | 45 | { |
46 | if (manager.AddRow(profile)) | 46 | if (manager.AddRow(profile)) |
47 | { | 47 | { |
@@ -55,7 +55,7 @@ namespace OpenGrid.Framework.Data.DB4o | |||
55 | } | 55 | } |
56 | 56 | ||
57 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { | 57 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { |
58 | if (manager.profiles[uuid].regionRecvKey == key) | 58 | if (manager.simProfiles[uuid].regionRecvKey == key) |
59 | return true; | 59 | return true; |
60 | return false; | 60 | return false; |
61 | } | 61 | } |
diff --git a/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGrid.Framework.Data.DB4o/DB4oManager.cs index 3ebcee2..aaa6e91 100644 --- a/OpenGrid.Framework.Data.DB4o/DB4oManager.cs +++ b/OpenGrid.Framework.Data.DB4o/DB4oManager.cs | |||
@@ -7,19 +7,19 @@ using libsecondlife; | |||
7 | 7 | ||
8 | namespace OpenGrid.Framework.Data.DB4o | 8 | namespace OpenGrid.Framework.Data.DB4o |
9 | { | 9 | { |
10 | class DB4oManager | 10 | class DB4oGridManager |
11 | { | 11 | { |
12 | public Dictionary<LLUUID, SimProfileData> profiles = new Dictionary<LLUUID, SimProfileData>(); | 12 | public Dictionary<LLUUID, SimProfileData> simProfiles = new Dictionary<LLUUID, SimProfileData>(); |
13 | string dbfl; | 13 | string dbfl; |
14 | 14 | ||
15 | public DB4oManager(string db4odb) | 15 | public DB4oGridManager(string db4odb) |
16 | { | 16 | { |
17 | dbfl = db4odb; | 17 | dbfl = db4odb; |
18 | IObjectContainer database; | 18 | IObjectContainer database; |
19 | database = Db4oFactory.OpenFile(dbfl); | 19 | database = Db4oFactory.OpenFile(dbfl); |
20 | IObjectSet result = database.Get(typeof(SimProfileData)); | 20 | IObjectSet result = database.Get(typeof(SimProfileData)); |
21 | foreach(SimProfileData row in result) { | 21 | foreach(SimProfileData row in result) { |
22 | profiles.Add(row.UUID, row); | 22 | simProfiles.Add(row.UUID, row); |
23 | } | 23 | } |
24 | database.Close(); | 24 | database.Close(); |
25 | } | 25 | } |
@@ -31,7 +31,65 @@ namespace OpenGrid.Framework.Data.DB4o | |||
31 | /// <returns>Successful?</returns> | 31 | /// <returns>Successful?</returns> |
32 | public bool AddRow(SimProfileData row) | 32 | public bool AddRow(SimProfileData row) |
33 | { | 33 | { |
34 | profiles.Add(row.UUID, row); | 34 | if (simProfiles.ContainsKey(row.UUID)) |
35 | { | ||
36 | simProfiles[row.UUID] = row; | ||
37 | } | ||
38 | else | ||
39 | { | ||
40 | simProfiles.Add(row.UUID, row); | ||
41 | } | ||
42 | |||
43 | try | ||
44 | { | ||
45 | IObjectContainer database; | ||
46 | database = Db4oFactory.OpenFile(dbfl); | ||
47 | database.Set(row); | ||
48 | database.Close(); | ||
49 | return true; | ||
50 | } | ||
51 | catch (Exception e) | ||
52 | { | ||
53 | return false; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | |||
58 | } | ||
59 | |||
60 | class DB4oUserManager | ||
61 | { | ||
62 | public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); | ||
63 | string dbfl; | ||
64 | |||
65 | public DB4oUserManager(string db4odb) | ||
66 | { | ||
67 | dbfl = db4odb; | ||
68 | IObjectContainer database; | ||
69 | database = Db4oFactory.OpenFile(dbfl); | ||
70 | IObjectSet result = database.Get(typeof(UserProfileData)); | ||
71 | foreach (UserProfileData row in result) | ||
72 | { | ||
73 | userProfiles.Add(row.UUID, row); | ||
74 | } | ||
75 | database.Close(); | ||
76 | } | ||
77 | |||
78 | /// <summary> | ||
79 | /// Adds a new profile to the database (Warning: Probably slow.) | ||
80 | /// </summary> | ||
81 | /// <param name="row">The profile to add</param> | ||
82 | /// <returns>Successful?</returns> | ||
83 | public bool AddRow(UserProfileData row) | ||
84 | { | ||
85 | if (userProfiles.ContainsKey(row.UUID)) | ||
86 | { | ||
87 | userProfiles[row.UUID] = row; | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | userProfiles.Add(row.UUID, row); | ||
92 | } | ||
35 | 93 | ||
36 | try | 94 | try |
37 | { | 95 | { |
diff --git a/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj b/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj index 45a2d44..6ef93c2 100644 --- a/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj +++ b/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj | |||
@@ -1,4 +1,4 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{39BD9497-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{39BD9497-0000-0000-0000-000000000000}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenGrid.Framework.Data.DB4o</AssemblyName> | 13 | <AssemblyName>OpenGrid.Framework.Data.DB4o</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 18 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Data.DB4o</RootNamespace> | 21 | <RootNamespace>OpenGrid.Framework.Data.DB4o</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,26 +61,27 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="System" > | 68 | <Reference Include="System"> |
62 | <HintPath>System.dll</HintPath> | 69 | <HintPath>System.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="System.Xml" > | 72 | <Reference Include="System.Xml"> |
66 | <HintPath>System.Xml.dll</HintPath> | 73 | <HintPath>System.Xml.dll</HintPath> |
67 | <Private>False</Private> | 74 | <Private>False</Private> |
68 | </Reference> | 75 | </Reference> |
69 | <Reference Include="System.Data" > | 76 | <Reference Include="System.Data"> |
70 | <HintPath>System.Data.dll</HintPath> | 77 | <HintPath>System.Data.dll</HintPath> |
71 | <Private>False</Private> | 78 | <Private>False</Private> |
72 | </Reference> | 79 | </Reference> |
73 | <Reference Include="libsecondlife.dll" > | 80 | <Reference Include="libsecondlife.dll"> |
74 | <HintPath>..\bin\libsecondlife.dll</HintPath> | 81 | <HintPath>..\bin\libsecondlife.dll</HintPath> |
75 | <Private>False</Private> | 82 | <Private>False</Private> |
76 | </Reference> | 83 | </Reference> |
77 | <Reference Include="Db4objects.Db4o.dll" > | 84 | <Reference Include="Db4objects.Db4o.dll"> |
78 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> | 85 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> |
79 | <Private>False</Private> | 86 | <Private>False</Private> |
80 | </Reference> | 87 | </Reference> |
@@ -84,7 +91,7 @@ | |||
84 | <Name>OpenGrid.Framework.Data</Name> | 91 | <Name>OpenGrid.Framework.Data</Name> |
85 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | 92 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> |
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 93 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
87 | <Private>False</Private> | 94 | <Private>False</Private> |
88 | </ProjectReference> | 95 | </ProjectReference> |
89 | </ItemGroup> | 96 | </ItemGroup> |
90 | <ItemGroup> | 97 | <ItemGroup> |
@@ -94,6 +101,7 @@ | |||
94 | <Compile Include="DB4oManager.cs"> | 101 | <Compile Include="DB4oManager.cs"> |
95 | <SubType>Code</SubType> | 102 | <SubType>Code</SubType> |
96 | </Compile> | 103 | </Compile> |
104 | <Compile Include="DB4oUserData.cs" /> | ||
97 | <Compile Include="Properties\AssemblyInfo.cs"> | 105 | <Compile Include="Properties\AssemblyInfo.cs"> |
98 | <SubType>Code</SubType> | 106 | <SubType>Code</SubType> |
99 | </Compile> | 107 | </Compile> |
@@ -105,4 +113,4 @@ | |||
105 | <PostBuildEvent> | 113 | <PostBuildEvent> |
106 | </PostBuildEvent> | 114 | </PostBuildEvent> |
107 | </PropertyGroup> | 115 | </PropertyGroup> |
108 | </Project> | 116 | </Project> \ No newline at end of file |