diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Framework/Data.DB4o/DB4oGridData.cs | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Framework/Data.DB4o/DB4oGridData.cs')
-rw-r--r-- | OpenSim/Framework/Data.DB4o/DB4oGridData.cs | 324 |
1 files changed, 162 insertions, 162 deletions
diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index 5fec367..e57a3aa 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs | |||
@@ -1,162 +1,162 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | 31 | ||
32 | namespace OpenSim.Framework.Data.DB4o | 32 | namespace OpenSim.Framework.Data.DB4o |
33 | { | 33 | { |
34 | /// <summary> | 34 | /// <summary> |
35 | /// A grid server storage mechanism employing the DB4o database system | 35 | /// A grid server storage mechanism employing the DB4o database system |
36 | /// </summary> | 36 | /// </summary> |
37 | class DB4oGridData : IGridData | 37 | class DB4oGridData : IGridData |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// The database manager object | 40 | /// The database manager object |
41 | /// </summary> | 41 | /// </summary> |
42 | DB4oGridManager manager; | 42 | DB4oGridManager manager; |
43 | 43 | ||
44 | /// <summary> | 44 | /// <summary> |
45 | /// Called when the plugin is first loaded (as constructors are not called) | 45 | /// Called when the plugin is first loaded (as constructors are not called) |
46 | /// </summary> | 46 | /// </summary> |
47 | public void Initialise() { | 47 | public void Initialise() { |
48 | manager = new DB4oGridManager("gridserver.yap"); | 48 | manager = new DB4oGridManager("gridserver.yap"); |
49 | } | 49 | } |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// Returns a list of regions within the specified ranges | 52 | /// Returns a list of regions within the specified ranges |
53 | /// </summary> | 53 | /// </summary> |
54 | /// <param name="a">minimum X coordinate</param> | 54 | /// <param name="a">minimum X coordinate</param> |
55 | /// <param name="b">minimum Y coordinate</param> | 55 | /// <param name="b">minimum Y coordinate</param> |
56 | /// <param name="c">maximum X coordinate</param> | 56 | /// <param name="c">maximum X coordinate</param> |
57 | /// <param name="d">maximum Y coordinate</param> | 57 | /// <param name="d">maximum Y coordinate</param> |
58 | /// <returns>An array of region profiles</returns> | 58 | /// <returns>An array of region profiles</returns> |
59 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | 59 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) |
60 | { | 60 | { |
61 | return null; | 61 | return null; |
62 | } | 62 | } |
63 | 63 | ||
64 | /// <summary> | 64 | /// <summary> |
65 | /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned) | 65 | /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned) |
66 | /// </summary> | 66 | /// </summary> |
67 | /// <param name="handle">The handle to search for</param> | 67 | /// <param name="handle">The handle to search for</param> |
68 | /// <returns>A region profile</returns> | 68 | /// <returns>A region profile</returns> |
69 | public SimProfileData GetProfileByHandle(ulong handle) { | 69 | public SimProfileData GetProfileByHandle(ulong handle) { |
70 | lock (manager.simProfiles) | 70 | lock (manager.simProfiles) |
71 | { | 71 | { |
72 | foreach (LLUUID UUID in manager.simProfiles.Keys) | 72 | foreach (LLUUID UUID in manager.simProfiles.Keys) |
73 | { | 73 | { |
74 | if (manager.simProfiles[UUID].regionHandle == handle) | 74 | if (manager.simProfiles[UUID].regionHandle == handle) |
75 | { | 75 | { |
76 | return manager.simProfiles[UUID]; | 76 | return manager.simProfiles[UUID]; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | } | 79 | } |
80 | throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); | 80 | throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); |
81 | } | 81 | } |
82 | 82 | ||
83 | /// <summary> | 83 | /// <summary> |
84 | /// Returns a specific region | 84 | /// Returns a specific region |
85 | /// </summary> | 85 | /// </summary> |
86 | /// <param name="uuid">The region ID code</param> | 86 | /// <param name="uuid">The region ID code</param> |
87 | /// <returns>A region profile</returns> | 87 | /// <returns>A region profile</returns> |
88 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) | 88 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) |
89 | { | 89 | { |
90 | lock (manager.simProfiles) | 90 | lock (manager.simProfiles) |
91 | { | 91 | { |
92 | if (manager.simProfiles.ContainsKey(uuid)) | 92 | if (manager.simProfiles.ContainsKey(uuid)) |
93 | return manager.simProfiles[uuid]; | 93 | return manager.simProfiles[uuid]; |
94 | } | 94 | } |
95 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count); | 95 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count); |
96 | } | 96 | } |
97 | 97 | ||
98 | /// <summary> | 98 | /// <summary> |
99 | /// Adds a new specified region to the database | 99 | /// Adds a new specified region to the database |
100 | /// </summary> | 100 | /// </summary> |
101 | /// <param name="profile">The profile to add</param> | 101 | /// <param name="profile">The profile to add</param> |
102 | /// <returns>A dataresponse enum indicating success</returns> | 102 | /// <returns>A dataresponse enum indicating success</returns> |
103 | public DataResponse AddProfile(SimProfileData profile) | 103 | public DataResponse AddProfile(SimProfileData profile) |
104 | { | 104 | { |
105 | lock (manager.simProfiles) | 105 | lock (manager.simProfiles) |
106 | { | 106 | { |
107 | if (manager.AddRow(profile)) | 107 | if (manager.AddRow(profile)) |
108 | { | 108 | { |
109 | return DataResponse.RESPONSE_OK; | 109 | return DataResponse.RESPONSE_OK; |
110 | } | 110 | } |
111 | else | 111 | else |
112 | { | 112 | { |
113 | return DataResponse.RESPONSE_ERROR; | 113 | return DataResponse.RESPONSE_ERROR; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | /// <summary> | 118 | /// <summary> |
119 | /// Authenticates a new region using the shared secrets. NOT SECURE. | 119 | /// Authenticates a new region using the shared secrets. NOT SECURE. |
120 | /// </summary> | 120 | /// </summary> |
121 | /// <param name="uuid">The UUID the region is authenticating with</param> | 121 | /// <param name="uuid">The UUID the region is authenticating with</param> |
122 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> | 122 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> |
123 | /// <param name="key">The shared secret</param> | 123 | /// <param name="key">The shared secret</param> |
124 | /// <returns>Authenticated?</returns> | 124 | /// <returns>Authenticated?</returns> |
125 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { | 125 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { |
126 | if (manager.simProfiles[uuid].regionRecvKey == key) | 126 | if (manager.simProfiles[uuid].regionRecvKey == key) |
127 | return true; | 127 | return true; |
128 | return false; | 128 | return false; |
129 | } | 129 | } |
130 | 130 | ||
131 | /// <summary> | 131 | /// <summary> |
132 | /// Shuts down the database | 132 | /// Shuts down the database |
133 | /// </summary> | 133 | /// </summary> |
134 | public void Close() | 134 | public void Close() |
135 | { | 135 | { |
136 | manager = null; | 136 | manager = null; |
137 | } | 137 | } |
138 | 138 | ||
139 | /// <summary> | 139 | /// <summary> |
140 | /// Returns the providers name | 140 | /// Returns the providers name |
141 | /// </summary> | 141 | /// </summary> |
142 | /// <returns>The name of the storage system</returns> | 142 | /// <returns>The name of the storage system</returns> |
143 | public string getName() | 143 | public string getName() |
144 | { | 144 | { |
145 | return "DB4o Grid Provider"; | 145 | return "DB4o Grid Provider"; |
146 | } | 146 | } |
147 | 147 | ||
148 | /// <summary> | 148 | /// <summary> |
149 | /// Returns the providers version | 149 | /// Returns the providers version |
150 | /// </summary> | 150 | /// </summary> |
151 | /// <returns>The version of the storage system</returns> | 151 | /// <returns>The version of the storage system</returns> |
152 | public string getVersion() | 152 | public string getVersion() |
153 | { | 153 | { |
154 | return "0.1"; | 154 | return "0.1"; |
155 | } | 155 | } |
156 | 156 | ||
157 | public ReservationData GetReservationAtPoint(uint x, uint y) | 157 | public ReservationData GetReservationAtPoint(uint x, uint y) |
158 | { | 158 | { |
159 | return null; | 159 | return null; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } | 162 | } |