diff options
Diffstat (limited to 'OpenSim/Data/DB4o/DB4oGridData.cs')
-rw-r--r-- | OpenSim/Data/DB4o/DB4oGridData.cs | 188 |
1 files changed, 0 insertions, 188 deletions
diff --git a/OpenSim/Data/DB4o/DB4oGridData.cs b/OpenSim/Data/DB4o/DB4oGridData.cs deleted file mode 100644 index c388cb6..0000000 --- a/OpenSim/Data/DB4o/DB4oGridData.cs +++ /dev/null | |||
@@ -1,188 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using libsecondlife; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace OpenSim.Data.DB4o | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// A grid server storage mechanism employing the DB4o database system | ||
37 | /// </summary> | ||
38 | internal class DB4oGridData : GridDataBase | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// The database manager object | ||
42 | /// </summary> | ||
43 | private DB4oGridManager manager; | ||
44 | |||
45 | /// <summary> | ||
46 | /// Called when the plugin is first loaded (as constructors are not called) | ||
47 | /// </summary> | ||
48 | override public void Initialise() | ||
49 | { | ||
50 | manager = new DB4oGridManager("gridserver.yap"); | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Returns a list of regions within the specified ranges | ||
55 | /// </summary> | ||
56 | /// <param name="a">minimum X coordinate</param> | ||
57 | /// <param name="b">minimum Y coordinate</param> | ||
58 | /// <param name="c">maximum X coordinate</param> | ||
59 | /// <param name="d">maximum Y coordinate</param> | ||
60 | /// <returns>An array of region profiles</returns> | ||
61 | override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | ||
62 | { | ||
63 | return null; | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned) | ||
68 | /// </summary> | ||
69 | /// <param name="handle">The handle to search for</param> | ||
70 | /// <returns>A region profile</returns> | ||
71 | override public RegionProfileData GetProfileByHandle(ulong handle) | ||
72 | { | ||
73 | lock (manager.simProfiles) | ||
74 | { | ||
75 | foreach (LLUUID UUID in manager.simProfiles.Keys) | ||
76 | { | ||
77 | if (manager.simProfiles[UUID].regionHandle == handle) | ||
78 | { | ||
79 | return manager.simProfiles[UUID]; | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); | ||
84 | } | ||
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> | ||
91 | override public RegionProfileData GetProfileByLLUUID(LLUUID uuid) | ||
92 | { | ||
93 | lock (manager.simProfiles) | ||
94 | { | ||
95 | if (manager.simProfiles.ContainsKey(uuid)) | ||
96 | return manager.simProfiles[uuid]; | ||
97 | } | ||
98 | throw new Exception("Unable to find profile with UUID (" + uuid.ToString() + | ||
99 | "). Total Registered Regions: " + manager.simProfiles.Count); | ||
100 | } | ||
101 | |||
102 | override public RegionProfileData GetProfileByString(string regionName) | ||
103 | { | ||
104 | throw new Exception("GetProfileByString Not supported in DB4oGridData"); | ||
105 | //return null; | ||
106 | } | ||
107 | |||
108 | /// <summary> | ||
109 | /// Adds a new specified region to the database | ||
110 | /// </summary> | ||
111 | /// <param name="profile">The profile to add</param> | ||
112 | /// <returns>A dataresponse enum indicating success</returns> | ||
113 | override public DataResponse AddProfile(RegionProfileData profile) | ||
114 | { | ||
115 | lock (manager.simProfiles) | ||
116 | { | ||
117 | if (manager.AddRow(profile)) | ||
118 | { | ||
119 | return DataResponse.RESPONSE_OK; | ||
120 | } | ||
121 | else | ||
122 | { | ||
123 | return DataResponse.RESPONSE_ERROR; | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | |||
128 | override public DataResponse UpdateProfile(RegionProfileData profile) | ||
129 | { | ||
130 | return AddProfile(profile); | ||
131 | } | ||
132 | |||
133 | /// <summary> | ||
134 | /// Authenticates a new region using the shared secrets. NOT SECURE. | ||
135 | /// </summary> | ||
136 | /// <param name="uuid">The UUID the region is authenticating with</param> | ||
137 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> | ||
138 | /// <param name="key">The shared secret</param> | ||
139 | /// <returns>Authenticated?</returns> | ||
140 | override public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) | ||
141 | { | ||
142 | if (manager.simProfiles[uuid].regionRecvKey == key) | ||
143 | return true; | ||
144 | return false; | ||
145 | } | ||
146 | |||
147 | /// <summary> | ||
148 | /// Shuts down the database | ||
149 | /// </summary> | ||
150 | override public void Close() | ||
151 | { | ||
152 | manager = null; | ||
153 | } | ||
154 | |||
155 | /// <summary> | ||
156 | /// // Returns a list of avatar and UUIDs that match the query | ||
157 | /// </summary> | ||
158 | public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) | ||
159 | { | ||
160 | //Do nothing yet | ||
161 | List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); | ||
162 | return returnlist; | ||
163 | } | ||
164 | |||
165 | /// <summary> | ||
166 | /// Returns the providers name | ||
167 | /// </summary> | ||
168 | /// <returns>The name of the storage system</returns> | ||
169 | override public string getName() | ||
170 | { | ||
171 | return "DB4o Grid Provider"; | ||
172 | } | ||
173 | |||
174 | /// <summary> | ||
175 | /// Returns the providers version | ||
176 | /// </summary> | ||
177 | /// <returns>The version of the storage system</returns> | ||
178 | override public string getVersion() | ||
179 | { | ||
180 | return "0.1"; | ||
181 | } | ||
182 | |||
183 | override public ReservationData GetReservationAtPoint(uint x, uint y) | ||
184 | { | ||
185 | return null; | ||
186 | } | ||
187 | } | ||
188 | } | ||