aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-06-01 23:48:52 +0000
committerAdam Frisby2007-06-01 23:48:52 +0000
commit17e422bc673940ffe33b80c29378af65e66501ec (patch)
tree423cab9e0121018263222e8dce3cbf3c59d42a1a /OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
parent* ZOMG Wtf Comments? (diff)
downloadopensim-SC-17e422bc673940ffe33b80c29378af65e66501ec.zip
opensim-SC-17e422bc673940ffe33b80c29378af65e66501ec.tar.gz
opensim-SC-17e422bc673940ffe33b80c29378af65e66501ec.tar.bz2
opensim-SC-17e422bc673940ffe33b80c29378af65e66501ec.tar.xz
* DB4o Storage provider is now well documented
* Added try/catch over user creation (should allow multiple logins on Db4o)
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs77
1 files changed, 77 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
index 546713e..723ff69 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
@@ -1,3 +1,30 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
1using System; 28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using System.Text; 30using System.Text;
@@ -7,19 +34,41 @@ using libsecondlife;
7 34
8namespace OpenGrid.Framework.Data.DB4o 35namespace OpenGrid.Framework.Data.DB4o
9{ 36{
37 /// <summary>
38 /// A grid server storage mechanism employing the DB4o database system
39 /// </summary>
10 class DB4oGridData : IGridData 40 class DB4oGridData : IGridData
11 { 41 {
42 /// <summary>
43 /// The database manager object
44 /// </summary>
12 DB4oGridManager manager; 45 DB4oGridManager manager;
13 46
47 /// <summary>
48 /// Called when the plugin is first loaded (as constructors are not called)
49 /// </summary>
14 public void Initialise() { 50 public void Initialise() {
15 manager = new DB4oGridManager("gridserver.yap"); 51 manager = new DB4oGridManager("gridserver.yap");
16 } 52 }
17 53
54 /// <summary>
55 /// Returns a list of regions within the specified ranges
56 /// </summary>
57 /// <param name="a">minimum X coordinate</param>
58 /// <param name="b">minimum Y coordinate</param>
59 /// <param name="c">maximum X coordinate</param>
60 /// <param name="d">maximum Y coordinate</param>
61 /// <returns>An array of region profiles</returns>
18 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) 62 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
19 { 63 {
20 return null; 64 return null;
21 } 65 }
22 66
67 /// <summary>
68 /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned)
69 /// </summary>
70 /// <param name="handle">The handle to search for</param>
71 /// <returns>A region profile</returns>
23 public SimProfileData GetProfileByHandle(ulong handle) { 72 public SimProfileData GetProfileByHandle(ulong handle) {
24 lock (manager.simProfiles) 73 lock (manager.simProfiles)
25 { 74 {
@@ -34,6 +83,11 @@ namespace OpenGrid.Framework.Data.DB4o
34 throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); 83 throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")");
35 } 84 }
36 85
86 /// <summary>
87 /// Returns a specific region
88 /// </summary>
89 /// <param name="uuid">The region ID code</param>
90 /// <returns>A region profile</returns>
37 public SimProfileData GetProfileByLLUUID(LLUUID uuid) 91 public SimProfileData GetProfileByLLUUID(LLUUID uuid)
38 { 92 {
39 lock (manager.simProfiles) 93 lock (manager.simProfiles)
@@ -44,6 +98,11 @@ namespace OpenGrid.Framework.Data.DB4o
44 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")"); 98 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")");
45 } 99 }
46 100
101 /// <summary>
102 /// Adds a new specified region to the database
103 /// </summary>
104 /// <param name="profile">The profile to add</param>
105 /// <returns>A dataresponse enum indicating success</returns>
47 public DataResponse AddProfile(SimProfileData profile) 106 public DataResponse AddProfile(SimProfileData profile)
48 { 107 {
49 lock (manager.simProfiles) 108 lock (manager.simProfiles)
@@ -59,22 +118,40 @@ namespace OpenGrid.Framework.Data.DB4o
59 } 118 }
60 } 119 }
61 120
121 /// <summary>
122 /// Authenticates a new region using the shared secrets. NOT SECURE.
123 /// </summary>
124 /// <param name="uuid">The UUID the region is authenticating with</param>
125 /// <param name="handle">The location the region is logging into (unused in Db4o)</param>
126 /// <param name="key">The shared secret</param>
127 /// <returns>Authenticated?</returns>
62 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { 128 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) {
63 if (manager.simProfiles[uuid].regionRecvKey == key) 129 if (manager.simProfiles[uuid].regionRecvKey == key)
64 return true; 130 return true;
65 return false; 131 return false;
66 } 132 }
67 133
134 /// <summary>
135 /// Shuts down the database
136 /// </summary>
68 public void Close() 137 public void Close()
69 { 138 {
70 manager = null; 139 manager = null;
71 } 140 }
72 141
142 /// <summary>
143 /// Returns the providers name
144 /// </summary>
145 /// <returns>The name of the storage system</returns>
73 public string getName() 146 public string getName()
74 { 147 {
75 return "DB4o Grid Provider"; 148 return "DB4o Grid Provider";
76 } 149 }
77 150
151 /// <summary>
152 /// Returns the providers version
153 /// </summary>
154 /// <returns>The version of the storage system</returns>
78 public string getVersion() 155 public string getVersion()
79 { 156 {
80 return "0.1"; 157 return "0.1";