aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs')
-rw-r--r--OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs83
1 files changed, 83 insertions, 0 deletions
diff --git a/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
new file mode 100644
index 0000000..546713e
--- /dev/null
+++ b/OpenGridServices-Source/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
@@ -0,0 +1,83 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenGrid.Framework.Data;
5using libsecondlife;
6
7
8namespace OpenGrid.Framework.Data.DB4o
9{
10 class DB4oGridData : IGridData
11 {
12 DB4oGridManager manager;
13
14 public void Initialise() {
15 manager = new DB4oGridManager("gridserver.yap");
16 }
17
18 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
19 {
20 return null;
21 }
22
23 public SimProfileData GetProfileByHandle(ulong handle) {
24 lock (manager.simProfiles)
25 {
26 foreach (LLUUID UUID in manager.simProfiles.Keys)
27 {
28 if (manager.simProfiles[UUID].regionHandle == handle)
29 {
30 return manager.simProfiles[UUID];
31 }
32 }
33 }
34 throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")");
35 }
36
37 public SimProfileData GetProfileByLLUUID(LLUUID uuid)
38 {
39 lock (manager.simProfiles)
40 {
41 if (manager.simProfiles.ContainsKey(uuid))
42 return manager.simProfiles[uuid];
43 }
44 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")");
45 }
46
47 public DataResponse AddProfile(SimProfileData profile)
48 {
49 lock (manager.simProfiles)
50 {
51 if (manager.AddRow(profile))
52 {
53 return DataResponse.RESPONSE_OK;
54 }
55 else
56 {
57 return DataResponse.RESPONSE_ERROR;
58 }
59 }
60 }
61
62 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) {
63 if (manager.simProfiles[uuid].regionRecvKey == key)
64 return true;
65 return false;
66 }
67
68 public void Close()
69 {
70 manager = null;
71 }
72
73 public string getName()
74 {
75 return "DB4o Grid Provider";
76 }
77
78 public string getVersion()
79 {
80 return "0.1";
81 }
82 }
83}