diff options
Diffstat (limited to 'OpenGrid.Framework.Data.DB4o/DB4oGridData.cs')
-rw-r--r-- | OpenGrid.Framework.Data.DB4o/DB4oGridData.cs | 63 |
1 files changed, 63 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 | } | ||