aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs99
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs10
-rw-r--r--OpenSim/Framework/Communications/IUserService.cs6
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs6
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs26
5 files changed, 61 insertions, 86 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 {
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
index c076ac4..725225d 100644
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ b/OpenSim/Framework/Communications/IUserService.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Services.Interfaces;
31 32
32namespace OpenSim.Framework.Communications 33namespace OpenSim.Framework.Communications
33{ 34{
@@ -135,5 +136,10 @@ namespace OpenSim.Framework.Communications
135 // This probably shouldn't be here, it belongs to IAuthentication 136 // This probably shouldn't be here, it belongs to IAuthentication
136 // But since Scenes only have IUserService references, I'm placing it here for now. 137 // But since Scenes only have IUserService references, I'm placing it here for now.
137 bool VerifySession(UUID userID, UUID sessionID); 138 bool VerifySession(UUID userID, UUID sessionID);
139
140
141 // Temporary Hack until we move everything to the new service model
142 void SetInventoryService(IInventoryService invService);
143
138 } 144 }
139} 145}
diff --git a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs
index f30d28b..ac0dc6d 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs
@@ -33,6 +33,7 @@ using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Services.Interfaces;
36using OpenSim.Tests.Common.Mock; 37using OpenSim.Tests.Common.Mock;
37 38
38namespace OpenSim.Framework.Communications.Tests 39namespace OpenSim.Framework.Communications.Tests
@@ -143,6 +144,11 @@ namespace OpenSim.Framework.Communications.Tests
143 { 144 {
144 return true; 145 return true;
145 } 146 }
147
148 public void SetInventoryService(IInventoryService inv)
149 {
150 throw new NotImplementedException();
151 }
146 } 152 }
147 } 153 }
148} 154}
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index c3aaa4b..898239d 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -37,6 +37,7 @@ using OpenMetaverse.StructuredData;
37using OpenSim.Data; 37using OpenSim.Data;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Statistics; 39using OpenSim.Framework.Statistics;
40using OpenSim.Services.Interfaces;
40 41
41namespace OpenSim.Framework.Communications 42namespace OpenSim.Framework.Communications
42{ 43{
@@ -54,6 +55,7 @@ namespace OpenSim.Framework.Communications
54 private List<IUserDataPlugin> m_plugins = new List<IUserDataPlugin>(); 55 private List<IUserDataPlugin> m_plugins = new List<IUserDataPlugin>();
55 56
56 protected CommunicationsManager m_commsManager; 57 protected CommunicationsManager m_commsManager;
58 protected IInventoryService m_InventoryService;
57 59
58 /// <summary> 60 /// <summary>
59 /// Constructor 61 /// Constructor
@@ -64,6 +66,11 @@ namespace OpenSim.Framework.Communications
64 m_commsManager = commsManager; 66 m_commsManager = commsManager;
65 } 67 }
66 68
69 public virtual void SetInventoryService(IInventoryService invService)
70 {
71 m_InventoryService = invService;
72 }
73
67 /// <summary> 74 /// <summary>
68 /// Add a new user data plugin - plugins will be requested in the order they were added. 75 /// Add a new user data plugin - plugins will be requested in the order they were added.
69 /// </summary> 76 /// </summary>
@@ -676,7 +683,24 @@ namespace OpenSim.Framework.Communications
676 } 683 }
677 else 684 else
678 { 685 {
679 m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID); 686 //
687 // WARNING: This is a horrible hack
688 // The purpose here is to avoid touching the user server at this point.
689 // There are dragons there that I can't deal with right now.
690 // diva 06/09/09
691 //
692 if (m_InventoryService != null)
693 {
694 // local service (standalone)
695 m_log.Debug("[USERSTORAGE]: using IInventoryService to create user's inventory");
696 m_InventoryService.CreateUserInventory(userProf.ID);
697 }
698 else
699 {
700 // used by the user server
701 m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory");
702 m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
703 }
680 704
681 return userProf.ID; 705 return userProf.ID;
682 } 706 }