aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorUbitUmarov2016-07-04 08:30:07 +0100
committerUbitUmarov2016-07-04 08:30:07 +0100
commit1d9e343b7ea5a8b36751fc334cd51b5573a1bb15 (patch)
tree628b676a51022801ad25c83c4ecfbd0a90d7977a /OpenSim/Services
parentadd OSSL osGetPhysicsEngineName(). this returns a string with name and versio... (diff)
parentMerge branch 'master' of opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-1d9e343b7ea5a8b36751fc334cd51b5573a1bb15.zip
opensim-SC-1d9e343b7ea5a8b36751fc334cd51b5573a1bb15.tar.gz
opensim-SC-1d9e343b7ea5a8b36751fc334cd51b5573a1bb15.tar.bz2
opensim-SC-1d9e343b7ea5a8b36751fc334cd51b5573a1bb15.tar.xz
Merge branch 'master' of opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs14
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs29
-rw-r--r--OpenSim/Services/HypergridService/HGInventoryService.cs4
-rw-r--r--OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs8
-rw-r--r--OpenSim/Services/Interfaces/IInventoryService.cs4
-rw-r--r--OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs10
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs24
7 files changed, 41 insertions, 52 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
index c7d658a..d80e660 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
@@ -520,10 +520,10 @@ namespace OpenSim.Services.Connectors
520 return CheckReturn(ret); 520 return CheckReturn(ret);
521 } 521 }
522 522
523 public InventoryItemBase GetItem(InventoryItemBase item) 523 public InventoryItemBase GetItem(UUID principalID, UUID itemID)
524 { 524 {
525 InventoryItemBase retrieved = null; 525 InventoryItemBase retrieved = null;
526 if (m_ItemCache.TryGetValue(item.ID, out retrieved)) 526 if (m_ItemCache.TryGetValue(itemID, out retrieved))
527 { 527 {
528 return retrieved; 528 return retrieved;
529 } 529 }
@@ -532,7 +532,8 @@ namespace OpenSim.Services.Connectors
532 { 532 {
533 Dictionary<string, object> ret = MakeRequest("GETITEM", 533 Dictionary<string, object> ret = MakeRequest("GETITEM",
534 new Dictionary<string, object> { 534 new Dictionary<string, object> {
535 { "ID", item.ID.ToString() } 535 { "ID", itemID.ToString() },
536 { "PRINCIPAL", principalID.ToString() }
536 }); 537 });
537 538
538 if (!CheckReturn(ret)) 539 if (!CheckReturn(ret))
@@ -545,7 +546,7 @@ namespace OpenSim.Services.Connectors
545 m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e); 546 m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e);
546 } 547 }
547 548
548 m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); 549 m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS);
549 550
550 return retrieved; 551 return retrieved;
551 } 552 }
@@ -613,13 +614,14 @@ namespace OpenSim.Services.Connectors
613 return itemArr; 614 return itemArr;
614 } 615 }
615 616
616 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 617 public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
617 { 618 {
618 try 619 try
619 { 620 {
620 Dictionary<string, object> ret = MakeRequest("GETFOLDER", 621 Dictionary<string, object> ret = MakeRequest("GETFOLDER",
621 new Dictionary<string, object> { 622 new Dictionary<string, object> {
622 { "ID", folder.ID.ToString() } 623 { "ID", folderID.ToString() },
624 { "PRINCIPAL", principalID.ToString() }
623 }); 625 });
624 626
625 if (!CheckReturn(ret)) 627 if (!CheckReturn(ret))
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index e793420..3d35834 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -277,17 +277,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
277 /// </summary> 277 /// </summary>
278 /// <param name="item"></param> 278 /// <param name="item"></param>
279 /// <returns></returns> 279 /// <returns></returns>
280 public InventoryItemBase GetItem(InventoryItemBase item) 280 public InventoryItemBase GetItem(UUID principalID, UUID itemID)
281 { 281 {
282 InventoryItemBase retrieved = null; 282 InventoryItemBase retrieved = null;
283 if (m_ItemCache.TryGetValue(item.ID, out retrieved)) 283 if (m_ItemCache.TryGetValue(itemID, out retrieved))
284 return retrieved; 284 return retrieved;
285 285
286 NameValueCollection requestArgs = new NameValueCollection 286 NameValueCollection requestArgs = new NameValueCollection
287 { 287 {
288 { "RequestMethod", "GetInventoryNode" }, 288 { "RequestMethod", "GetInventoryNode" },
289 { "ItemID", item.ID.ToString() }, 289 { "ItemID", itemID.ToString() },
290 { "OwnerID", item.Owner.ToString() }, 290 { "OwnerID", principalID.ToString() },
291 { "IncludeFolders", "1" }, 291 { "IncludeFolders", "1" },
292 { "IncludeItems", "1" }, 292 { "IncludeItems", "1" },
293 { "ChildrenOnly", "1" } 293 { "ChildrenOnly", "1" }
@@ -303,17 +303,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
303 // and sanity check just in case 303 // and sanity check just in case
304 for (int i = 0; i < items.Count; i++) 304 for (int i = 0; i < items.Count; i++)
305 { 305 {
306 if (items[i].ID == item.ID) 306 if (items[i].ID == itemID)
307 { 307 {
308 retrieved = items[i]; 308 retrieved = items[i];
309 m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); 309 m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS);
310 return retrieved; 310 return retrieved;
311 } 311 }
312 } 312 }
313 } 313 }
314 } 314 }
315 315
316 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found"); 316 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + itemID + " owned by " + principalID + " not found");
317 return null; 317 return null;
318 } 318 }
319 319
@@ -321,13 +321,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
321 { 321 {
322 InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length]; 322 InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length];
323 int i = 0; 323 int i = 0;
324 InventoryItemBase item = new InventoryItemBase();
325 item.Owner = principalID;
326 foreach (UUID id in itemIDs) 324 foreach (UUID id in itemIDs)
327 { 325 result[i++] = GetItem(principalID, id);
328 item.ID = id;
329 result[i++] = GetItem(item);
330 }
331 326
332 return result; 327 return result;
333 } 328 }
@@ -337,13 +332,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
337 /// </summary> 332 /// </summary>
338 /// <param name="folder"></param> 333 /// <param name="folder"></param>
339 /// <returns></returns> 334 /// <returns></returns>
340 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 335 public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
341 { 336 {
342 NameValueCollection requestArgs = new NameValueCollection 337 NameValueCollection requestArgs = new NameValueCollection
343 { 338 {
344 { "RequestMethod", "GetInventoryNode" }, 339 { "RequestMethod", "GetInventoryNode" },
345 { "ItemID", folder.ID.ToString() }, 340 { "ItemID", folderID.ToString() },
346 { "OwnerID", folder.Owner.ToString() }, 341 { "OwnerID", principalID.ToString() },
347 { "IncludeFolders", "1" }, 342 { "IncludeFolders", "1" },
348 { "IncludeItems", "0" }, 343 { "IncludeItems", "0" },
349 { "ChildrenOnly", "1" } 344 { "ChildrenOnly", "1" }
@@ -353,7 +348,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
353 if (response["Success"].AsBoolean() && response["Items"] is OSDArray) 348 if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
354 { 349 {
355 OSDArray items = (OSDArray)response["Items"]; 350 OSDArray items = (OSDArray)response["Items"];
356 List<InventoryFolderBase> folders = GetFoldersFromResponse(items, folder.ID, true); 351 List<InventoryFolderBase> folders = GetFoldersFromResponse(items, folderID, true);
357 352
358 if (folders.Count > 0) 353 if (folders.Count > 0)
359 return folders[0]; 354 return folders[0];
diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs
index 9158b41..a0d25e3 100644
--- a/OpenSim/Services/HypergridService/HGInventoryService.cs
+++ b/OpenSim/Services/HypergridService/HGInventoryService.cs
@@ -291,9 +291,9 @@ namespace OpenSim.Services.HypergridService
291 //{ 291 //{
292 //} 292 //}
293 293
294 public override InventoryItemBase GetItem(InventoryItemBase item) 294 public override InventoryItemBase GetItem(UUID principalID, UUID itemID)
295 { 295 {
296 InventoryItemBase it = base.GetItem(item); 296 InventoryItemBase it = base.GetItem(principalID, itemID);
297 if (it != null) 297 if (it != null)
298 { 298 {
299 UserAccount user = m_Cache.GetUser(it.CreatorId); 299 UserAccount user = m_Cache.GetUser(it.CreatorId);
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
index 40eb6d4..7f14e8e 100644
--- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
+++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
@@ -383,7 +383,7 @@ namespace OpenSim.Services.HypergridService
383 // Check the items' current folders 383 // Check the items' current folders
384 foreach (InventoryItemBase item in items) 384 foreach (InventoryItemBase item in items)
385 { 385 {
386 InventoryItemBase originalItem = base.GetItem(item); 386 InventoryItemBase originalItem = base.GetItem(item.Owner, item.ID);
387 if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) 387 if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder))
388 { 388 {
389 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); 389 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner);
@@ -401,7 +401,7 @@ namespace OpenSim.Services.HypergridService
401 401
402 public new InventoryItemBase GetItem(InventoryItemBase item) 402 public new InventoryItemBase GetItem(InventoryItemBase item)
403 { 403 {
404 InventoryItemBase it = base.GetItem(item); 404 InventoryItemBase it = base.GetItem(item.Owner, item.ID);
405 if (it == null) 405 if (it == null)
406 { 406 {
407 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}", 407 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}",
@@ -426,9 +426,9 @@ namespace OpenSim.Services.HypergridService
426 return it; 426 return it;
427 } 427 }
428 428
429 public new InventoryFolderBase GetFolder(InventoryFolderBase folder) 429 public new InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
430 { 430 {
431 InventoryFolderBase f = base.GetFolder(folder); 431 InventoryFolderBase f = base.GetFolder(principalID, folderID);
432 432
433 if (f != null) 433 if (f != null)
434 { 434 {
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs
index 4289bba..c0c9ba8 100644
--- a/OpenSim/Services/Interfaces/IInventoryService.cs
+++ b/OpenSim/Services/Interfaces/IInventoryService.cs
@@ -161,7 +161,7 @@ namespace OpenSim.Services.Interfaces
161 /// </summary> 161 /// </summary>
162 /// <param name="item"></param> 162 /// <param name="item"></param>
163 /// <returns>null if no item was found, otherwise the found item</returns> 163 /// <returns>null if no item was found, otherwise the found item</returns>
164 InventoryItemBase GetItem(InventoryItemBase item); 164 InventoryItemBase GetItem(UUID userID, UUID itemID);
165 165
166 /// <summary> 166 /// <summary>
167 /// Get multiple items, given by their UUIDs 167 /// Get multiple items, given by their UUIDs
@@ -175,7 +175,7 @@ namespace OpenSim.Services.Interfaces
175 /// </summary> 175 /// </summary>
176 /// <param name="folder"></param> 176 /// <param name="folder"></param>
177 /// <returns></returns> 177 /// <returns></returns>
178 InventoryFolderBase GetFolder(InventoryFolderBase folder); 178 InventoryFolderBase GetFolder(UUID userID, UUID folderID);
179 179
180 /// <summary> 180 /// <summary>
181 /// Does the given user have an inventory structure? 181 /// Does the given user have an inventory structure?
diff --git a/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs
index 9e3fa69..3cfd125 100644
--- a/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs
+++ b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs
@@ -90,8 +90,7 @@ namespace OpenSim.Services.InventoryService.Tests
90 90
91 Assert.That(xis.AddItem(itemToStore), Is.True); 91 Assert.That(xis.AddItem(itemToStore), Is.True);
92 92
93 InventoryItemBase itemRetrieved = new InventoryItemBase(itemId); 93 InventoryItemBase itemRetrieved = xis.GetItem(UUID.Zero, itemId);
94 itemRetrieved = xis.GetItem(itemRetrieved);
95 94
96 Assert.That(itemRetrieved, Is.Not.Null); 95 Assert.That(itemRetrieved, Is.Not.Null);
97 Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId)); 96 Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
@@ -139,8 +138,7 @@ namespace OpenSim.Services.InventoryService.Tests
139 138
140 Assert.That(xis.UpdateItem(itemToStore), Is.True); 139 Assert.That(xis.UpdateItem(itemToStore), Is.True);
141 140
142 InventoryItemBase itemRetrieved = new InventoryItemBase(itemId); 141 InventoryItemBase itemRetrieved = xis.GetItem(UUID.Zero, itemId);
143 itemRetrieved = xis.GetItem(itemRetrieved);
144 142
145 Assert.That(itemRetrieved, Is.Not.Null); 143 Assert.That(itemRetrieved, Is.Not.Null);
146 Assert.That(itemRetrieved.Name, Is.EqualTo(itemName2)); 144 Assert.That(itemRetrieved.Name, Is.EqualTo(itemName2));
@@ -162,7 +160,7 @@ namespace OpenSim.Services.InventoryService.Tests
162 160
163 Assert.That(xis.UpdateItem(itemToStore), Is.True); 161 Assert.That(xis.UpdateItem(itemToStore), Is.True);
164 162
165 itemRetrieved = xis.GetItem(itemRetrieved); 163 itemRetrieved = xis.GetItem(itemRetrieved.Owner, itemRetrieved.ID);
166 164
167 Assert.That(itemRetrieved, Is.Not.Null); 165 Assert.That(itemRetrieved, Is.Not.Null);
168 Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId)); 166 Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
@@ -174,4 +172,4 @@ namespace OpenSim.Services.InventoryService.Tests
174 Assert.That(itemRetrieved.Name, Is.EqualTo(itemName3)); 172 Assert.That(itemRetrieved.Name, Is.EqualTo(itemName3));
175 } 173 }
176 } 174 }
177} \ No newline at end of file 175}
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index b75193f..004c4bf 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -315,8 +315,7 @@ namespace OpenSim.Services.InventoryService
315 inventory.Items.Add(ConvertToOpenSim(i)); 315 inventory.Items.Add(ConvertToOpenSim(i));
316 } 316 }
317 317
318 InventoryFolderBase f = new InventoryFolderBase(folderID, principalID); 318 InventoryFolderBase f = GetFolder(principalID, folderID);
319 f = GetFolder(f);
320 if (f != null) 319 if (f != null)
321 { 320 {
322 inventory.Version = f.Version; 321 inventory.Version = f.Version;
@@ -359,7 +358,7 @@ namespace OpenSim.Services.InventoryService
359 { 358 {
360// m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID); 359// m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID);
361 360
362 InventoryFolderBase check = GetFolder(folder); 361 InventoryFolderBase check = GetFolder(folder.Owner, folder.ID);
363 if (check != null) 362 if (check != null)
364 return false; 363 return false;
365 364
@@ -402,7 +401,7 @@ namespace OpenSim.Services.InventoryService
402// m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID); 401// m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID);
403 402
404 XInventoryFolder xFolder = ConvertFromOpenSim(folder); 403 XInventoryFolder xFolder = ConvertFromOpenSim(folder);
405 InventoryFolderBase check = GetFolder(folder); 404 InventoryFolderBase check = GetFolder(folder.Owner, folder.ID);
406 405
407 if (check == null) 406 if (check == null)
408 return AddFolder(folder); 407 return AddFolder(folder);
@@ -512,7 +511,7 @@ namespace OpenSim.Services.InventoryService
512// m_log.InfoFormat( 511// m_log.InfoFormat(
513// "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); 512// "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
514 513
515 InventoryItemBase retrievedItem = GetItem(item); 514 InventoryItemBase retrievedItem = GetItem(item.Owner, item.ID);
516 515
517 if (retrievedItem == null) 516 if (retrievedItem == null)
518 { 517 {
@@ -598,11 +597,11 @@ namespace OpenSim.Services.InventoryService
598 return true; 597 return true;
599 } 598 }
600 599
601 public virtual InventoryItemBase GetItem(InventoryItemBase item) 600 public virtual InventoryItemBase GetItem(UUID principalID, UUID itemID)
602 { 601 {
603 XInventoryItem[] items = m_Database.GetItems( 602 XInventoryItem[] items = m_Database.GetItems(
604 new string[] { "inventoryID" }, 603 new string[] { "inventoryID" },
605 new string[] { item.ID.ToString() }); 604 new string[] { itemID.ToString() });
606 605
607 if (items.Length == 0) 606 if (items.Length == 0)
608 return null; 607 return null;
@@ -614,22 +613,17 @@ namespace OpenSim.Services.InventoryService
614 { 613 {
615 InventoryItemBase[] items = new InventoryItemBase[ids.Length]; 614 InventoryItemBase[] items = new InventoryItemBase[ids.Length];
616 int i = 0; 615 int i = 0;
617 InventoryItemBase item = new InventoryItemBase();
618 item.Owner = userID;
619 foreach (UUID id in ids) 616 foreach (UUID id in ids)
620 { 617 items[i++] = GetItem(userID, id);
621 item.ID = id;
622 items[i++] = GetItem(item);
623 }
624 618
625 return items; 619 return items;
626 } 620 }
627 621
628 public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) 622 public virtual InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
629 { 623 {
630 XInventoryFolder[] folders = m_Database.GetFolders( 624 XInventoryFolder[] folders = m_Database.GetFolders(
631 new string[] { "folderID"}, 625 new string[] { "folderID"},
632 new string[] { folder.ID.ToString() }); 626 new string[] { folderID.ToString() });
633 627
634 if (folders.Length == 0) 628 if (folders.Length == 0)
635 return null; 629 return null;