diff options
author | Melanie Thielker | 2016-07-04 03:35:48 +0100 |
---|---|---|
committer | Melanie Thielker | 2016-07-04 03:35:48 +0100 |
commit | ea8f3c83bf96453e8223d918933d5708fa49a3cc (patch) | |
tree | 288972a5d6f112426da2b5ab109fe18ba5aedc2e /OpenSim/Services/Connectors | |
parent | increase xmlrpc timeout in xmlrpcgroups, disable its cache until its entries ... (diff) | |
download | opensim-SC_OLD-ea8f3c83bf96453e8223d918933d5708fa49a3cc.zip opensim-SC_OLD-ea8f3c83bf96453e8223d918933d5708fa49a3cc.tar.gz opensim-SC_OLD-ea8f3c83bf96453e8223d918933d5708fa49a3cc.tar.bz2 opensim-SC_OLD-ea8f3c83bf96453e8223d918933d5708fa49a3cc.tar.xz |
Finally remove the requirement for an InventoryItem/FolderBase object to
be passed into inventory queries.
This makes the API more homogenous and also will more clearly show
coding
errors related to HG inventory where the .Owner field has a meaning
for a query but wasn't always set.
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | 14 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | 29 |
2 files changed, 20 insertions, 23 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]; |