diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 131 |
1 files changed, 86 insertions, 45 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index e474ef6..48f228a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -62,6 +62,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
62 | 62 | ||
63 | private InventoryCache m_Cache = new InventoryCache(); | 63 | private InventoryCache m_Cache = new InventoryCache(); |
64 | 64 | ||
65 | /// <summary> | ||
66 | /// Used to serialize inventory requests. | ||
67 | /// </summary> | ||
68 | private object m_Lock = new object(); | ||
69 | |||
65 | protected IUserManagement m_UserManagement; | 70 | protected IUserManagement m_UserManagement; |
66 | protected IUserManagement UserManagementModule | 71 | protected IUserManagement UserManagementModule |
67 | { | 72 | { |
@@ -233,13 +238,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
233 | if (sp != null) | 238 | if (sp != null) |
234 | { | 239 | { |
235 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 240 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
241 | if (aCircuit == null) | ||
242 | return; | ||
243 | if (aCircuit.ServiceURLs == null) | ||
244 | return; | ||
245 | |||
236 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | 246 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) |
237 | { | 247 | { |
238 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | 248 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); |
239 | if (inventoryURL != null && inventoryURL != string.Empty) | 249 | if (inventoryURL != null && inventoryURL != string.Empty) |
240 | { | 250 | { |
241 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | 251 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); |
242 | m_InventoryURLs.Add(userID, inventoryURL); | 252 | m_InventoryURLs[userID] = inventoryURL; |
243 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL); | 253 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL); |
244 | return; | 254 | return; |
245 | } | 255 | } |
@@ -254,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
254 | if (sp == null) | 264 | if (sp == null) |
255 | { | 265 | { |
256 | inventoryURL = UserManagementModule.GetUserServerURL(userID, "InventoryServerURI"); | 266 | inventoryURL = UserManagementModule.GetUserServerURL(userID, "InventoryServerURI"); |
257 | if (inventoryURL != null && inventoryURL != string.Empty) | 267 | if (!string.IsNullOrEmpty(inventoryURL)) |
258 | { | 268 | { |
259 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | 269 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); |
260 | m_InventoryURLs.Add(userID, inventoryURL); | 270 | m_InventoryURLs.Add(userID, inventoryURL); |
@@ -296,7 +306,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
296 | 306 | ||
297 | public bool CreateUserInventory(UUID userID) | 307 | public bool CreateUserInventory(UUID userID) |
298 | { | 308 | { |
299 | return m_LocalGridInventoryService.CreateUserInventory(userID); | 309 | lock (m_Lock) |
310 | return m_LocalGridInventoryService.CreateUserInventory(userID); | ||
300 | } | 311 | } |
301 | 312 | ||
302 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userID) | 313 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userID) |
@@ -304,36 +315,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
304 | string invURL = GetInventoryServiceURL(userID); | 315 | string invURL = GetInventoryServiceURL(userID); |
305 | 316 | ||
306 | if (invURL == null) // not there, forward to local inventory connector to resolve | 317 | if (invURL == null) // not there, forward to local inventory connector to resolve |
307 | return m_LocalGridInventoryService.GetInventorySkeleton(userID); | 318 | lock (m_Lock) |
319 | return m_LocalGridInventoryService.GetInventorySkeleton(userID); | ||
308 | 320 | ||
309 | IInventoryService connector = GetConnector(invURL); | 321 | IInventoryService connector = GetConnector(invURL); |
310 | 322 | ||
311 | return connector.GetInventorySkeleton(userID); | 323 | return connector.GetInventorySkeleton(userID); |
312 | } | 324 | } |
313 | 325 | ||
314 | public InventoryCollection GetUserInventory(UUID userID) | ||
315 | { | ||
316 | string invURL = GetInventoryServiceURL(userID); | ||
317 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetUserInventory for {0} {1}", userID, invURL); | ||
318 | |||
319 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
320 | return m_LocalGridInventoryService.GetUserInventory(userID); | ||
321 | |||
322 | InventoryCollection c = m_Cache.GetUserInventory(userID); | ||
323 | if (c != null) | ||
324 | return c; | ||
325 | |||
326 | IInventoryService connector = GetConnector(invURL); | ||
327 | c = connector.GetUserInventory(userID); | ||
328 | |||
329 | m_Cache.Cache(userID, c); | ||
330 | return c; | ||
331 | } | ||
332 | |||
333 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
334 | { | ||
335 | } | ||
336 | |||
337 | public InventoryFolderBase GetRootFolder(UUID userID) | 326 | public InventoryFolderBase GetRootFolder(UUID userID) |
338 | { | 327 | { |
339 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); | 328 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); |
@@ -344,7 +333,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
344 | string invURL = GetInventoryServiceURL(userID); | 333 | string invURL = GetInventoryServiceURL(userID); |
345 | 334 | ||
346 | if (invURL == null) // not there, forward to local inventory connector to resolve | 335 | if (invURL == null) // not there, forward to local inventory connector to resolve |
347 | return m_LocalGridInventoryService.GetRootFolder(userID); | 336 | lock (m_Lock) |
337 | return m_LocalGridInventoryService.GetRootFolder(userID); | ||
348 | 338 | ||
349 | IInventoryService connector = GetConnector(invURL); | 339 | IInventoryService connector = GetConnector(invURL); |
350 | 340 | ||
@@ -355,7 +345,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
355 | return root; | 345 | return root; |
356 | } | 346 | } |
357 | 347 | ||
358 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | 348 | public InventoryFolderBase GetFolderForType(UUID userID, FolderType type) |
359 | { | 349 | { |
360 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); | 350 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); |
361 | InventoryFolderBase f = m_Cache.GetFolderForType(userID, type); | 351 | InventoryFolderBase f = m_Cache.GetFolderForType(userID, type); |
@@ -365,7 +355,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
365 | string invURL = GetInventoryServiceURL(userID); | 355 | string invURL = GetInventoryServiceURL(userID); |
366 | 356 | ||
367 | if (invURL == null) // not there, forward to local inventory connector to resolve | 357 | if (invURL == null) // not there, forward to local inventory connector to resolve |
368 | return m_LocalGridInventoryService.GetFolderForType(userID, type); | 358 | lock (m_Lock) |
359 | return m_LocalGridInventoryService.GetFolderForType(userID, type); | ||
369 | 360 | ||
370 | IInventoryService connector = GetConnector(invURL); | 361 | IInventoryService connector = GetConnector(invURL); |
371 | 362 | ||
@@ -383,7 +374,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
383 | string invURL = GetInventoryServiceURL(userID); | 374 | string invURL = GetInventoryServiceURL(userID); |
384 | 375 | ||
385 | if (invURL == null) // not there, forward to local inventory connector to resolve | 376 | if (invURL == null) // not there, forward to local inventory connector to resolve |
386 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); | 377 | lock (m_Lock) |
378 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); | ||
387 | 379 | ||
388 | InventoryCollection c = m_Cache.GetFolderContent(userID, folderID); | 380 | InventoryCollection c = m_Cache.GetFolderContent(userID, folderID); |
389 | if (c != null) | 381 | if (c != null) |
@@ -393,8 +385,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
393 | } | 385 | } |
394 | 386 | ||
395 | IInventoryService connector = GetConnector(invURL); | 387 | IInventoryService connector = GetConnector(invURL); |
388 | |||
396 | return connector.GetFolderContent(userID, folderID); | 389 | return connector.GetFolderContent(userID, folderID); |
390 | } | ||
397 | 391 | ||
392 | public InventoryCollection[] GetMultipleFoldersContent(UUID userID, UUID[] folderIDs) | ||
393 | { | ||
394 | string invURL = GetInventoryServiceURL(userID); | ||
395 | |||
396 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
397 | lock (m_Lock) | ||
398 | return m_LocalGridInventoryService.GetMultipleFoldersContent(userID, folderIDs); | ||
399 | |||
400 | else | ||
401 | { | ||
402 | InventoryCollection[] coll = new InventoryCollection[folderIDs.Length]; | ||
403 | int i = 0; | ||
404 | foreach (UUID fid in folderIDs) | ||
405 | coll[i++] = GetFolderContent(userID, fid); | ||
406 | |||
407 | return coll; | ||
408 | } | ||
398 | } | 409 | } |
399 | 410 | ||
400 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | 411 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) |
@@ -404,7 +415,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
404 | string invURL = GetInventoryServiceURL(userID); | 415 | string invURL = GetInventoryServiceURL(userID); |
405 | 416 | ||
406 | if (invURL == null) // not there, forward to local inventory connector to resolve | 417 | if (invURL == null) // not there, forward to local inventory connector to resolve |
407 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); | 418 | lock (m_Lock) |
419 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); | ||
408 | 420 | ||
409 | List<InventoryItemBase> items = m_Cache.GetFolderItems(userID, folderID); | 421 | List<InventoryItemBase> items = m_Cache.GetFolderItems(userID, folderID); |
410 | if (items != null) | 422 | if (items != null) |
@@ -414,8 +426,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
414 | } | 426 | } |
415 | 427 | ||
416 | IInventoryService connector = GetConnector(invURL); | 428 | IInventoryService connector = GetConnector(invURL); |
417 | return connector.GetFolderItems(userID, folderID); | ||
418 | 429 | ||
430 | return connector.GetFolderItems(userID, folderID); | ||
419 | } | 431 | } |
420 | 432 | ||
421 | public bool AddFolder(InventoryFolderBase folder) | 433 | public bool AddFolder(InventoryFolderBase folder) |
@@ -428,7 +440,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
428 | string invURL = GetInventoryServiceURL(folder.Owner); | 440 | string invURL = GetInventoryServiceURL(folder.Owner); |
429 | 441 | ||
430 | if (invURL == null) // not there, forward to local inventory connector to resolve | 442 | if (invURL == null) // not there, forward to local inventory connector to resolve |
431 | return m_LocalGridInventoryService.AddFolder(folder); | 443 | lock (m_Lock) |
444 | return m_LocalGridInventoryService.AddFolder(folder); | ||
432 | 445 | ||
433 | IInventoryService connector = GetConnector(invURL); | 446 | IInventoryService connector = GetConnector(invURL); |
434 | 447 | ||
@@ -445,7 +458,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
445 | string invURL = GetInventoryServiceURL(folder.Owner); | 458 | string invURL = GetInventoryServiceURL(folder.Owner); |
446 | 459 | ||
447 | if (invURL == null) // not there, forward to local inventory connector to resolve | 460 | if (invURL == null) // not there, forward to local inventory connector to resolve |
448 | return m_LocalGridInventoryService.UpdateFolder(folder); | 461 | lock (m_Lock) |
462 | return m_LocalGridInventoryService.UpdateFolder(folder); | ||
449 | 463 | ||
450 | IInventoryService connector = GetConnector(invURL); | 464 | IInventoryService connector = GetConnector(invURL); |
451 | 465 | ||
@@ -464,7 +478,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
464 | string invURL = GetInventoryServiceURL(ownerID); | 478 | string invURL = GetInventoryServiceURL(ownerID); |
465 | 479 | ||
466 | if (invURL == null) // not there, forward to local inventory connector to resolve | 480 | if (invURL == null) // not there, forward to local inventory connector to resolve |
467 | return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs); | 481 | lock (m_Lock) |
482 | return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs); | ||
468 | 483 | ||
469 | IInventoryService connector = GetConnector(invURL); | 484 | IInventoryService connector = GetConnector(invURL); |
470 | 485 | ||
@@ -481,7 +496,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
481 | string invURL = GetInventoryServiceURL(folder.Owner); | 496 | string invURL = GetInventoryServiceURL(folder.Owner); |
482 | 497 | ||
483 | if (invURL == null) // not there, forward to local inventory connector to resolve | 498 | if (invURL == null) // not there, forward to local inventory connector to resolve |
484 | return m_LocalGridInventoryService.MoveFolder(folder); | 499 | lock (m_Lock) |
500 | return m_LocalGridInventoryService.MoveFolder(folder); | ||
485 | 501 | ||
486 | IInventoryService connector = GetConnector(invURL); | 502 | IInventoryService connector = GetConnector(invURL); |
487 | 503 | ||
@@ -498,7 +514,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
498 | string invURL = GetInventoryServiceURL(folder.Owner); | 514 | string invURL = GetInventoryServiceURL(folder.Owner); |
499 | 515 | ||
500 | if (invURL == null) // not there, forward to local inventory connector to resolve | 516 | if (invURL == null) // not there, forward to local inventory connector to resolve |
501 | return m_LocalGridInventoryService.PurgeFolder(folder); | 517 | lock (m_Lock) |
518 | return m_LocalGridInventoryService.PurgeFolder(folder); | ||
502 | 519 | ||
503 | IInventoryService connector = GetConnector(invURL); | 520 | IInventoryService connector = GetConnector(invURL); |
504 | 521 | ||
@@ -515,7 +532,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
515 | string invURL = GetInventoryServiceURL(item.Owner); | 532 | string invURL = GetInventoryServiceURL(item.Owner); |
516 | 533 | ||
517 | if (invURL == null) // not there, forward to local inventory connector to resolve | 534 | if (invURL == null) // not there, forward to local inventory connector to resolve |
518 | return m_LocalGridInventoryService.AddItem(item); | 535 | lock (m_Lock) |
536 | return m_LocalGridInventoryService.AddItem(item); | ||
519 | 537 | ||
520 | IInventoryService connector = GetConnector(invURL); | 538 | IInventoryService connector = GetConnector(invURL); |
521 | 539 | ||
@@ -532,7 +550,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
532 | string invURL = GetInventoryServiceURL(item.Owner); | 550 | string invURL = GetInventoryServiceURL(item.Owner); |
533 | 551 | ||
534 | if (invURL == null) // not there, forward to local inventory connector to resolve | 552 | if (invURL == null) // not there, forward to local inventory connector to resolve |
535 | return m_LocalGridInventoryService.UpdateItem(item); | 553 | lock (m_Lock) |
554 | return m_LocalGridInventoryService.UpdateItem(item); | ||
536 | 555 | ||
537 | IInventoryService connector = GetConnector(invURL); | 556 | IInventoryService connector = GetConnector(invURL); |
538 | 557 | ||
@@ -551,7 +570,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
551 | string invURL = GetInventoryServiceURL(ownerID); | 570 | string invURL = GetInventoryServiceURL(ownerID); |
552 | 571 | ||
553 | if (invURL == null) // not there, forward to local inventory connector to resolve | 572 | if (invURL == null) // not there, forward to local inventory connector to resolve |
554 | return m_LocalGridInventoryService.MoveItems(ownerID, items); | 573 | lock (m_Lock) |
574 | return m_LocalGridInventoryService.MoveItems(ownerID, items); | ||
555 | 575 | ||
556 | IInventoryService connector = GetConnector(invURL); | 576 | IInventoryService connector = GetConnector(invURL); |
557 | 577 | ||
@@ -570,7 +590,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
570 | string invURL = GetInventoryServiceURL(ownerID); | 590 | string invURL = GetInventoryServiceURL(ownerID); |
571 | 591 | ||
572 | if (invURL == null) // not there, forward to local inventory connector to resolve | 592 | if (invURL == null) // not there, forward to local inventory connector to resolve |
573 | return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs); | 593 | lock (m_Lock) |
594 | return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs); | ||
574 | 595 | ||
575 | IInventoryService connector = GetConnector(invURL); | 596 | IInventoryService connector = GetConnector(invURL); |
576 | 597 | ||
@@ -586,13 +607,31 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
586 | string invURL = GetInventoryServiceURL(item.Owner); | 607 | string invURL = GetInventoryServiceURL(item.Owner); |
587 | 608 | ||
588 | if (invURL == null) // not there, forward to local inventory connector to resolve | 609 | if (invURL == null) // not there, forward to local inventory connector to resolve |
589 | return m_LocalGridInventoryService.GetItem(item); | 610 | lock (m_Lock) |
611 | return m_LocalGridInventoryService.GetItem(item); | ||
590 | 612 | ||
591 | IInventoryService connector = GetConnector(invURL); | 613 | IInventoryService connector = GetConnector(invURL); |
592 | 614 | ||
593 | return connector.GetItem(item); | 615 | return connector.GetItem(item); |
594 | } | 616 | } |
595 | 617 | ||
618 | public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs) | ||
619 | { | ||
620 | if (itemIDs == null) | ||
621 | return new InventoryItemBase[0]; | ||
622 | //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID); | ||
623 | |||
624 | string invURL = GetInventoryServiceURL(userID); | ||
625 | |||
626 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
627 | lock (m_Lock) | ||
628 | return m_LocalGridInventoryService.GetMultipleItems(userID, itemIDs); | ||
629 | |||
630 | IInventoryService connector = GetConnector(invURL); | ||
631 | |||
632 | return connector.GetMultipleItems(userID, itemIDs); | ||
633 | } | ||
634 | |||
596 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 635 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) |
597 | { | 636 | { |
598 | if (folder == null) | 637 | if (folder == null) |
@@ -603,7 +642,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
603 | string invURL = GetInventoryServiceURL(folder.Owner); | 642 | string invURL = GetInventoryServiceURL(folder.Owner); |
604 | 643 | ||
605 | if (invURL == null) // not there, forward to local inventory connector to resolve | 644 | if (invURL == null) // not there, forward to local inventory connector to resolve |
606 | return m_LocalGridInventoryService.GetFolder(folder); | 645 | lock (m_Lock) |
646 | return m_LocalGridInventoryService.GetFolder(folder); | ||
607 | 647 | ||
608 | IInventoryService connector = GetConnector(invURL); | 648 | IInventoryService connector = GetConnector(invURL); |
609 | 649 | ||
@@ -627,7 +667,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
627 | string invURL = GetInventoryServiceURL(userID); | 667 | string invURL = GetInventoryServiceURL(userID); |
628 | 668 | ||
629 | if (invURL == null) // not there, forward to local inventory connector to resolve | 669 | if (invURL == null) // not there, forward to local inventory connector to resolve |
630 | return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID); | 670 | lock (m_Lock) |
671 | return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID); | ||
631 | 672 | ||
632 | IInventoryService connector = GetConnector(invURL); | 673 | IInventoryService connector = GetConnector(invURL); |
633 | 674 | ||