aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/GridDataBase.cs3
-rw-r--r--OpenSim/Data/IGridData.cs11
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGridData.cs27
-rw-r--r--OpenSim/Data/MySQL/MySQLGridData.cs13
-rw-r--r--OpenSim/Data/NHibernate/NHibernateGridData.cs14
-rw-r--r--OpenSim/Data/SQLite/SQLiteGridData.cs10
-rw-r--r--OpenSim/Data/Tests/BasicGridTest.cs8
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs2
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs4
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridDBService.cs6
-rw-r--r--OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs13
11 files changed, 42 insertions, 69 deletions
diff --git a/OpenSim/Data/GridDataBase.cs b/OpenSim/Data/GridDataBase.cs
index 5a30455..a03488b 100644
--- a/OpenSim/Data/GridDataBase.cs
+++ b/OpenSim/Data/GridDataBase.cs
@@ -38,9 +38,8 @@ namespace OpenSim.Data
38 public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); 38 public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
39 public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum); 39 public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
40 public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); 40 public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
41 public abstract DataResponse AddProfile(RegionProfileData profile); 41 public abstract DataResponse StoreProfile(RegionProfileData profile);
42 public abstract ReservationData GetReservationAtPoint(uint x, uint y); 42 public abstract ReservationData GetReservationAtPoint(uint x, uint y);
43 public abstract DataResponse UpdateProfile(RegionProfileData profile);
44 public abstract DataResponse DeleteProfile(string uuid); 43 public abstract DataResponse DeleteProfile(string uuid);
45 44
46 public abstract void Initialise(); 45 public abstract void Initialise();
diff --git a/OpenSim/Data/IGridData.cs b/OpenSim/Data/IGridData.cs
index 4bf8646..8bd3811 100644
--- a/OpenSim/Data/IGridData.cs
+++ b/OpenSim/Data/IGridData.cs
@@ -99,18 +99,11 @@ namespace OpenSim.Data
99 bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); 99 bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
100 100
101 /// <summary> 101 /// <summary>
102 /// Adds a new profile to the database 102 /// Adds or updates a profile in the database
103 /// </summary> 103 /// </summary>
104 /// <param name="profile">The profile to add</param> 104 /// <param name="profile">The profile to add</param>
105 /// <returns>RESPONSE_OK if successful, error if not.</returns> 105 /// <returns>RESPONSE_OK if successful, error if not.</returns>
106 DataResponse AddProfile(RegionProfileData profile); 106 DataResponse StoreProfile(RegionProfileData profile);
107
108 /// <summary>
109 /// Updates a profile in the database
110 /// </summary>
111 /// <param name="profile"></param>
112 /// <returns></returns>
113 DataResponse UpdateProfile(RegionProfileData profile);
114 107
115 /// <summary> 108 /// <summary>
116 /// Remove a profile from the database 109 /// Remove a profile from the database
diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs
index 0ebbf4e..8a3d332 100644
--- a/OpenSim/Data/MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs
@@ -272,26 +272,23 @@ namespace OpenSim.Data.MSSQL
272 /// </summary> 272 /// </summary>
273 /// <param name="profile">The profile to add</param> 273 /// <param name="profile">The profile to add</param>
274 /// <returns>A dataresponse enum indicating success</returns> 274 /// <returns>A dataresponse enum indicating success</returns>
275 override public DataResponse AddProfile(RegionProfileData profile) 275 override public DataResponse StoreProfile(RegionProfileData profile)
276 { 276 {
277 if (InsertRegionRow(profile)) 277 if (GetProfileByUUID(profile.UUID) == null)
278 { 278 {
279 return DataResponse.RESPONSE_OK; 279 if (InsertRegionRow(profile))
280 {
281 return DataResponse.RESPONSE_OK;
282 }
280 } 283 }
281 return DataResponse.RESPONSE_ERROR; 284 else
282 }
283
284 /// <summary>
285 /// Update the specified region in the database
286 /// </summary>
287 /// <param name="profile">The profile to update</param>
288 /// <returns>A dataresponse enum indicating success</returns>
289 override public DataResponse UpdateProfile(RegionProfileData profile)
290 {
291 if (UpdateRegionRow(profile))
292 { 285 {
293 return DataResponse.RESPONSE_OK; 286 if (UpdateRegionRow(profile))
287 {
288 return DataResponse.RESPONSE_OK;
289 }
294 } 290 }
291
295 return DataResponse.RESPONSE_ERROR; 292 return DataResponse.RESPONSE_ERROR;
296 } 293 }
297 294
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs
index 0a5800b..1ec2609 100644
--- a/OpenSim/Data/MySQL/MySQLGridData.cs
+++ b/OpenSim/Data/MySQL/MySQLGridData.cs
@@ -391,7 +391,7 @@ namespace OpenSim.Data.MySQL
391 /// </summary> 391 /// </summary>
392 /// <param name="profile">The profile to add</param> 392 /// <param name="profile">The profile to add</param>
393 /// <returns>Successful?</returns> 393 /// <returns>Successful?</returns>
394 override public DataResponse AddProfile(RegionProfileData profile) 394 override public DataResponse StoreProfile(RegionProfileData profile)
395 { 395 {
396 MySQLSuperManager dbm = GetLockedConnection(); 396 MySQLSuperManager dbm = GetLockedConnection();
397 try { 397 try {
@@ -408,17 +408,6 @@ namespace OpenSim.Data.MySQL
408 } 408 }
409 409
410 /// <summary> 410 /// <summary>
411 /// Update a sim profile
412 /// </summary>
413 /// <param name="profile">The profile to update</param>
414 /// <returns>Sucessful?</returns>
415 /// <remarks>Same as AddProfile</remarks>
416 override public DataResponse UpdateProfile(RegionProfileData profile)
417 {
418 return AddProfile(profile);
419 }
420
421 /// <summary>
422 /// Deletes a sim profile from the database 411 /// Deletes a sim profile from the database
423 /// </summary> 412 /// </summary>
424 /// <param name="uuid">the sim UUID</param> 413 /// <param name="uuid">the sim UUID</param>
diff --git a/OpenSim/Data/NHibernate/NHibernateGridData.cs b/OpenSim/Data/NHibernate/NHibernateGridData.cs
index fe8da59..018af62 100644
--- a/OpenSim/Data/NHibernate/NHibernateGridData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateGridData.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Data.NHibernate
117 throw new NotImplementedException(); 117 throw new NotImplementedException();
118 } 118 }
119 119
120 public override DataResponse AddProfile(RegionProfileData profile) 120 public override DataResponse StoreProfile(RegionProfileData profile)
121 { 121 {
122 if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null) 122 if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null)
123 { 123 {
@@ -126,21 +126,9 @@ namespace OpenSim.Data.NHibernate
126 } 126 }
127 else 127 else
128 { 128 {
129 return DataResponse.RESPONSE_ERROR;
130 }
131 }
132
133 public override DataResponse UpdateProfile(RegionProfileData profile)
134 {
135 if (manager.Get(typeof(RegionProfileData), profile.Uuid) != null)
136 {
137 manager.Update(profile); 129 manager.Update(profile);
138 return DataResponse.RESPONSE_OK; 130 return DataResponse.RESPONSE_OK;
139 } 131 }
140 else
141 {
142 return DataResponse.RESPONSE_ERROR;
143 }
144 } 132 }
145 133
146 public override DataResponse DeleteProfile(string uuid) 134 public override DataResponse DeleteProfile(string uuid)
diff --git a/OpenSim/Data/SQLite/SQLiteGridData.cs b/OpenSim/Data/SQLite/SQLiteGridData.cs
index 4107594..18abb88 100644
--- a/OpenSim/Data/SQLite/SQLiteGridData.cs
+++ b/OpenSim/Data/SQLite/SQLiteGridData.cs
@@ -203,7 +203,7 @@ namespace OpenSim.Data.SQLite
203 /// </summary> 203 /// </summary>
204 /// <param name="profile">The profile to add</param> 204 /// <param name="profile">The profile to add</param>
205 /// <returns>A dataresponse enum indicating success</returns> 205 /// <returns>A dataresponse enum indicating success</returns>
206 override public DataResponse AddProfile(RegionProfileData profile) 206 override public DataResponse StoreProfile(RegionProfileData profile)
207 { 207 {
208 if (database.insertRow(profile)) 208 if (database.insertRow(profile))
209 { 209 {
@@ -215,17 +215,11 @@ namespace OpenSim.Data.SQLite
215 } 215 }
216 } 216 }
217 217
218 override public DataResponse UpdateProfile(RegionProfileData profile) 218 /// <summary>
219 {
220 return AddProfile(profile);
221 }
222
223 /// <summary>
224 /// Deletes a sim profile from the database 219 /// Deletes a sim profile from the database
225 /// </summary> 220 /// </summary>
226 /// <param name="uuid">the sim UUID</param> 221 /// <param name="uuid">the sim UUID</param>
227 /// <returns>Successful?</returns> 222 /// <returns>Successful?</returns>
228 //public DataResponse DeleteProfile(RegionProfileData profile)
229 override public DataResponse DeleteProfile(string uuid) 223 override public DataResponse DeleteProfile(string uuid)
230 { 224 {
231 Dictionary<string, string> param = new Dictionary<string, string>(); 225 Dictionary<string, string> param = new Dictionary<string, string>();
diff --git a/OpenSim/Data/Tests/BasicGridTest.cs b/OpenSim/Data/Tests/BasicGridTest.cs
index de8fb48..df6c669 100644
--- a/OpenSim/Data/Tests/BasicGridTest.cs
+++ b/OpenSim/Data/Tests/BasicGridTest.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Data.Tests
70 reg.Uuid = regionUUID; 70 reg.Uuid = regionUUID;
71 reg.RegionName = regionName; 71 reg.RegionName = regionName;
72 72
73 db.AddProfile(reg); 73 db.StoreProfile(reg);
74 74
75 return reg; 75 return reg;
76 } 76 }
@@ -120,7 +120,7 @@ namespace OpenSim.Data.Tests
120 RegionProfileData retreg = db.GetProfileByUUID(region2); 120 RegionProfileData retreg = db.GetProfileByUUID(region2);
121 retreg.regionName = "Gotham City"; 121 retreg.regionName = "Gotham City";
122 122
123 db.UpdateProfile(retreg); 123 db.StoreProfile(retreg);
124 124
125 retreg = db.GetProfileByUUID(region2); 125 retreg = db.GetProfileByUUID(region2);
126 Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))"); 126 Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))");
@@ -135,13 +135,13 @@ namespace OpenSim.Data.Tests
135 retreg.RegionName = "Gotham Town"; 135 retreg.RegionName = "Gotham Town";
136 retreg.Uuid = region1; 136 retreg.Uuid = region1;
137 137
138 db.AddProfile(retreg); 138 db.StoreProfile(retreg);
139 139
140 retreg = db.GetProfileByUUID(region2); 140 retreg = db.GetProfileByUUID(region2);
141 retreg.RegionName = "Gothan Town"; 141 retreg.RegionName = "Gothan Town";
142 retreg.Uuid = region3; 142 retreg.Uuid = region3;
143 143
144 db.AddProfile(retreg); 144 db.StoreProfile(retreg);
145 145
146 List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10); 146 List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10);
147 147
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index c9f5236..7f1c7e9 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -184,7 +184,7 @@ namespace OpenSim.Framework.Communications.Cache
184 // Commented out for now. The implementation needs to be improved by protecting against race conditions, 184 // Commented out for now. The implementation needs to be improved by protecting against race conditions,
185 // probably by making sure that the update doesn't use the UserCacheInfo.UserProfile directly (possibly via 185 // probably by making sure that the update doesn't use the UserCacheInfo.UserProfile directly (possibly via
186 // returning a read only class from the cache). 186 // returning a read only class from the cache).
187// public bool UpdateProfile(UserProfileData userProfile) 187// public bool StoreProfile(UserProfileData userProfile)
188// { 188// {
189// lock (m_userProfilesById) 189// lock (m_userProfilesById)
190// { 190// {
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index 670c9ff..933fa12 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -110,14 +110,14 @@ namespace OpenSim.Framework.Communications.Tests
110 IUserDataPlugin userDataPlugin = commsManager.UserDataPlugin; 110 IUserDataPlugin userDataPlugin = commsManager.UserDataPlugin;
111 111
112 // Check that we can't update info before it exists 112 // Check that we can't update info before it exists
113 Assert.That(userCacheService.UpdateProfile(newProfile), Is.False); 113 Assert.That(userCacheService.StoreProfile(newProfile), Is.False);
114 Assert.That(userDataPlugin.GetUserByUUID(userId), Is.Null); 114 Assert.That(userDataPlugin.GetUserByUUID(userId), Is.Null);
115 115
116 // Check that we can update a profile once it exists 116 // Check that we can update a profile once it exists
117 LocalUserServices lus = (LocalUserServices)commsManager.UserService; 117 LocalUserServices lus = (LocalUserServices)commsManager.UserService;
118 lus.AddUser(firstName, originalLastName, "pingu", "ted@excellentadventure.com", 1000, 1000, userId); 118 lus.AddUser(firstName, originalLastName, "pingu", "ted@excellentadventure.com", 1000, 1000, userId);
119 119
120 Assert.That(userCacheService.UpdateProfile(newProfile), Is.True); 120 Assert.That(userCacheService.StoreProfile(newProfile), Is.True);
121 UserProfileData retrievedProfile = userCacheService.GetUserDetails(userId).UserProfile; 121 UserProfileData retrievedProfile = userCacheService.GetUserDetails(userId).UserProfile;
122 Assert.That(retrievedProfile.SurName, Is.EqualTo(newLastName)); 122 Assert.That(retrievedProfile.SurName, Is.EqualTo(newLastName));
123 Assert.That(userDataPlugin.GetUserByUUID(userId).SurName, Is.EqualTo(newLastName)); 123 Assert.That(userDataPlugin.GetUserByUUID(userId).SurName, Is.EqualTo(newLastName));
diff --git a/OpenSim/Grid/GridServer.Modules/GridDBService.cs b/OpenSim/Grid/GridServer.Modules/GridDBService.cs
index caa2c10..fd5a09a 100644
--- a/OpenSim/Grid/GridServer.Modules/GridDBService.cs
+++ b/OpenSim/Grid/GridServer.Modules/GridDBService.cs
@@ -206,11 +206,11 @@ namespace OpenSim.Grid.GridServer.Modules
206 { 206 {
207 if (existingSim == null) 207 if (existingSim == null)
208 { 208 {
209 insertResponse = plugin.AddProfile(sim); 209 insertResponse = plugin.StoreProfile(sim);
210 } 210 }
211 else 211 else
212 { 212 {
213 insertResponse = plugin.UpdateProfile(sim); 213 insertResponse = plugin.StoreProfile(sim);
214 } 214 }
215 } 215 }
216 catch (Exception e) 216 catch (Exception e)
@@ -259,7 +259,7 @@ namespace OpenSim.Grid.GridServer.Modules
259 if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) || 259 if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) ||
260 (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey)) 260 (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey))
261 { 261 {
262 plugin.AddProfile(theSim); 262 plugin.StoreProfile(theSim);
263 m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")"); 263 m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")");
264 logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5, 264 logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5,
265 "Region successfully updated and connected to grid."); 265 "Region successfully updated and connected to grid.");
diff --git a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs
index 8ab72dc..3981fe9 100644
--- a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs
@@ -25,6 +25,7 @@
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
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using OpenMetaverse; 30using OpenMetaverse;
30using OpenSim.Framework; 31using OpenSim.Framework;
@@ -46,6 +47,18 @@ namespace OpenSim.Tests.Common.Mock
46 public void Initialise(string connect) {} 47 public void Initialise(string connect) {}
47 public void Dispose() {} 48 public void Dispose() {}
48 49
50 private readonly List<AssetBase> assets = new List<AssetBase>();
51
52 public AssetBase GetAsset(UUID uuid)
53 {
54 return assets.Find(x=>x.FullID == uuid);
55 }
56
57 public void StoreAsset(AssetBase asset)
58 {
59 assets.Add(asset);
60 }
61
49 public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); } 62 public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); }
50 } 63 }
51} \ No newline at end of file 64} \ No newline at end of file