aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache
diff options
context:
space:
mode:
authordiva2009-06-10 13:18:32 +0000
committerdiva2009-06-10 13:18:32 +0000
commit0f367bd7bbc5d22d4834e1eb0f1671381485143e (patch)
treeeeb4290f1146601f8fd97dc164e0a7f247a2fafb /OpenSim/Framework/Communications/Cache
parentFrom: Alan Webb <alan_webb@us.ibm.com> (diff)
downloadopensim-SC_OLD-0f367bd7bbc5d22d4834e1eb0f1671381485143e.zip
opensim-SC_OLD-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.gz
opensim-SC_OLD-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.bz2
opensim-SC_OLD-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.xz
Heart surgery no.2: the inventory service hooks.
Several improvements in the connectors themselves. Several improvements in configurations. Needed to add a hack in IUserService and UserManagerBase, to be removed when that service is refactored.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs99
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs10
2 files changed, 24 insertions, 85 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 5181bdaea..10aff42 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Services.Interfaces;
33 34
34namespace OpenSim.Framework.Communications.Cache 35namespace OpenSim.Framework.Communications.Cache
35{ 36{
@@ -62,7 +63,7 @@ namespace OpenSim.Framework.Communications.Cache
62 /// <summary> 63 /// <summary>
63 /// The comms manager holds references to services (user, grid, inventory, etc.) 64 /// The comms manager holds references to services (user, grid, inventory, etc.)
64 /// </summary> 65 /// </summary>
65 private readonly CommunicationsManager m_commsManager; 66 private readonly IInventoryService m_InventoryService;
66 67
67 public UserProfileData UserProfile { get { return m_userProfile; } } 68 public UserProfileData UserProfile { get { return m_userProfile; } }
68 private UserProfileData m_userProfile; 69 private UserProfileData m_userProfile;
@@ -96,10 +97,10 @@ namespace OpenSim.Framework.Communications.Cache
96 /// </summary> 97 /// </summary>
97 /// <param name="commsManager"></param> 98 /// <param name="commsManager"></param>
98 /// <param name="userProfile"></param> 99 /// <param name="userProfile"></param>
99 public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile) 100 public CachedUserInfo(IInventoryService invService, UserProfileData userProfile)
100 { 101 {
101 m_commsManager = commsManager;
102 m_userProfile = userProfile; 102 m_userProfile = userProfile;
103 m_InventoryService = invService;
103 } 104 }
104 105
105 /// <summary> 106 /// <summary>
@@ -213,15 +214,7 @@ namespace OpenSim.Framework.Communications.Cache
213 /// asynchronously otherwise. 214 /// asynchronously otherwise.
214 public void FetchInventory() 215 public void FetchInventory()
215 { 216 {
216 if (m_commsManager.SecureInventoryService != null) 217 m_InventoryService.GetUserInventory(UserProfile.ID, InventoryReceive);
217 {
218 m_commsManager.SecureInventoryService.RequestInventoryForUser(
219 UserProfile.ID, SessionID, InventoryReceive);
220 }
221 else
222 {
223 m_commsManager.InventoryService.RequestInventoryForUser(UserProfile.ID, InventoryReceive);
224 }
225 } 218 }
226 219
227 /// <summary> 220 /// <summary>
@@ -383,14 +376,8 @@ namespace OpenSim.Framework.Communications.Cache
383 createdBaseFolder.Type = createdFolder.Type; 376 createdBaseFolder.Type = createdFolder.Type;
384 createdBaseFolder.Version = createdFolder.Version; 377 createdBaseFolder.Version = createdFolder.Version;
385 378
386 if (m_commsManager.SecureInventoryService != null) 379 m_InventoryService.AddFolder(createdBaseFolder);
387 { 380
388 m_commsManager.SecureInventoryService.AddFolder(createdBaseFolder, m_session_id);
389 }
390 else
391 {
392 m_commsManager.InventoryService.AddFolder(createdBaseFolder);
393 }
394 return true; 381 return true;
395 } 382 }
396 else 383 else
@@ -449,14 +436,7 @@ namespace OpenSim.Framework.Communications.Cache
449 baseFolder.Type = (short)type; 436 baseFolder.Type = (short)type;
450 baseFolder.Version = RootFolder.Version; 437 baseFolder.Version = RootFolder.Version;
451 438
452 if (m_commsManager.SecureInventoryService != null) 439 m_InventoryService.UpdateFolder(baseFolder);
453 {
454 m_commsManager.SecureInventoryService.UpdateFolder(baseFolder, m_session_id);
455 }
456 else
457 {
458 m_commsManager.InventoryService.UpdateFolder(baseFolder);
459 }
460 440
461 folder.Name = name; 441 folder.Name = name;
462 folder.Type = (short)type; 442 folder.Type = (short)type;
@@ -498,14 +478,7 @@ namespace OpenSim.Framework.Communications.Cache
498 baseFolder.ID = folderID; 478 baseFolder.ID = folderID;
499 baseFolder.ParentID = parentID; 479 baseFolder.ParentID = parentID;
500 480
501 if (m_commsManager.SecureInventoryService != null) 481 m_InventoryService.MoveFolder(baseFolder);
502 {
503 m_commsManager.SecureInventoryService.MoveFolder(baseFolder, m_session_id);
504 }
505 else
506 {
507 m_commsManager.InventoryService.MoveFolder(baseFolder);
508 }
509 482
510 InventoryFolderImpl folder = RootFolder.FindFolder(folderID); 483 InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
511 InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID); 484 InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID);
@@ -568,14 +541,7 @@ namespace OpenSim.Framework.Communications.Cache
568 purgedBaseFolder.Type = purgedFolder.Type; 541 purgedBaseFolder.Type = purgedFolder.Type;
569 purgedBaseFolder.Version = purgedFolder.Version; 542 purgedBaseFolder.Version = purgedFolder.Version;
570 543
571 if (m_commsManager.SecureInventoryService != null) 544 m_InventoryService.PurgeFolder(purgedBaseFolder);
572 {
573 m_commsManager.SecureInventoryService.PurgeFolder(purgedBaseFolder, m_session_id);
574 }
575 else
576 {
577 m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder);
578 }
579 545
580 purgedFolder.Purge(); 546 purgedFolder.Purge();
581 547
@@ -615,14 +581,7 @@ namespace OpenSim.Framework.Communications.Cache
615 } 581 }
616 ItemReceive(item, null); 582 ItemReceive(item, null);
617 583
618 if (m_commsManager.SecureInventoryService != null) 584 m_InventoryService.AddItem(item);
619 {
620 m_commsManager.SecureInventoryService.AddItem(item, m_session_id);
621 }
622 else
623 {
624 m_commsManager.InventoryService.AddItem(item);
625 }
626 } 585 }
627 else 586 else
628 { 587 {
@@ -642,14 +601,7 @@ namespace OpenSim.Framework.Communications.Cache
642 { 601 {
643 if (m_hasReceivedInventory) 602 if (m_hasReceivedInventory)
644 { 603 {
645 if (m_commsManager.SecureInventoryService != null) 604 m_InventoryService.UpdateItem(item);
646 {
647 m_commsManager.SecureInventoryService.UpdateItem(item, m_session_id);
648 }
649 else
650 {
651 m_commsManager.InventoryService.UpdateItem(item);
652 }
653 } 605 }
654 else 606 else
655 { 607 {
@@ -688,14 +640,7 @@ namespace OpenSim.Framework.Communications.Cache
688 640
689 if (RootFolder.DeleteItem(item.ID)) 641 if (RootFolder.DeleteItem(item.ID))
690 { 642 {
691 if (m_commsManager.SecureInventoryService != null) 643 return m_InventoryService.DeleteItem(item);
692 {
693 return m_commsManager.SecureInventoryService.DeleteItem(item, m_session_id);
694 }
695 else
696 {
697 return m_commsManager.InventoryService.DeleteItem(item);
698 }
699 } 644 }
700 } 645 }
701 else 646 else
@@ -789,14 +734,7 @@ namespace OpenSim.Framework.Communications.Cache
789 734
790 InventoryItemBase itemInfo = null; 735 InventoryItemBase itemInfo = null;
791 736
792 if (m_commsManager.SecureInventoryService != null) 737 itemInfo = m_InventoryService.QueryItem(item);
793 {
794 itemInfo = m_commsManager.SecureInventoryService.QueryItem(item, m_session_id);
795 }
796 else
797 {
798 itemInfo = m_commsManager.InventoryService.QueryItem(item);
799 }
800 738
801 if (itemInfo != null) 739 if (itemInfo != null)
802 { 740 {
@@ -833,14 +771,7 @@ namespace OpenSim.Framework.Communications.Cache
833 771
834 InventoryFolderBase folderInfo = null; 772 InventoryFolderBase folderInfo = null;
835 773
836 if (m_commsManager.SecureInventoryService != null) 774 folderInfo = m_InventoryService.QueryFolder(folder);
837 {
838 folderInfo = m_commsManager.SecureInventoryService.QueryFolder(folder, m_session_id);
839 }
840 else
841 {
842 folderInfo = m_commsManager.InventoryService.QueryFolder(folder);
843 }
844 775
845 if (folderInfo != null) 776 if (folderInfo != null)
846 { 777 {
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index b7f209c..c9f5236 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -29,6 +29,7 @@ using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using log4net; 30using log4net;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Services.Interfaces;
32 33
33namespace OpenSim.Framework.Communications.Cache 34namespace OpenSim.Framework.Communications.Cache
34{ 35{
@@ -66,6 +67,8 @@ namespace OpenSim.Framework.Communications.Cache
66 /// </summary> 67 /// </summary>
67 public readonly InventoryFolderImpl LibraryRoot; 68 public readonly InventoryFolderImpl LibraryRoot;
68 69
70 private IInventoryService m_InventoryService;
71
69 /// <summary> 72 /// <summary>
70 /// Constructor 73 /// Constructor
71 /// </summary> 74 /// </summary>
@@ -77,6 +80,11 @@ namespace OpenSim.Framework.Communications.Cache
77 LibraryRoot = libraryRootFolder; 80 LibraryRoot = libraryRootFolder;
78 } 81 }
79 82
83 public void SetInventoryService(IInventoryService invService)
84 {
85 m_InventoryService = invService;
86 }
87
80 /// <summary> 88 /// <summary>
81 /// A new user has moved into a region in this instance so retrieve their profile from the user service. 89 /// A new user has moved into a region in this instance so retrieve their profile from the user service.
82 /// </summary> 90 /// </summary>
@@ -200,7 +208,7 @@ namespace OpenSim.Framework.Communications.Cache
200 /// <param name="userProfile"></param> 208 /// <param name="userProfile"></param>
201 protected CachedUserInfo AddToCaches(UserProfileData userProfile) 209 protected CachedUserInfo AddToCaches(UserProfileData userProfile)
202 { 210 {
203 CachedUserInfo createdUserInfo = new CachedUserInfo(m_commsManager, userProfile); 211 CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile);
204 212
205 lock (m_userProfilesById) 213 lock (m_userProfilesById)
206 { 214 {