From 9af05d0bc3253376cecb7cf6586c53e8067bb2a4 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 23 Jul 2008 22:18:09 +0000 Subject: [PATCH] * refactor: break out inter grid inventory services further * more to follow --- .../Communications/CommunicationsManager.cs | 43 +++++++++++-------- .../IInterGridInventoryServices.cs | 7 +-- .../Communications/IInventoryServices.cs | 5 +++ .../Communications/ISecureInventoryService.cs | 18 ++------ .../Communications/InventoryServiceBase.cs | 2 +- .../Local/CommunicationsLocal.cs | 3 +- .../Communications/Local/LocalLoginService.cs | 8 ++-- .../Communications/Local/LocalUserServices.cs | 8 ++-- .../OGS1/OGS1InventoryService.cs | 2 +- .../OGS1/OGS1SecureInvenotryService.cs | 2 +- 10 files changed, 49 insertions(+), 49 deletions(-) diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 80dfa2c8ef..62728726ba 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -36,68 +36,77 @@ using OpenSim.Framework.Servers; namespace OpenSim.Framework.Communications { + /// + /// This class manages references to OpenSim non-region services (asset, inventory, user, etc.) + /// public class CommunicationsManager { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected IUserService m_userService; + protected Dictionary m_nameRequestCache = new Dictionary(); public IUserService UserService { get { return m_userService; } } - - protected IGridServices m_gridService; + protected IUserService m_userService; public IGridServices GridService { get { return m_gridService; } } - - - protected IInterRegionCommunications m_interRegion; - + protected IGridServices m_gridService; + public IInterRegionCommunications InterRegion { get { return m_interRegion; } } - - protected UserProfileCacheService m_userProfileCacheService; + protected IInterRegionCommunications m_interRegion; public UserProfileCacheService UserProfileCacheService { get { return m_userProfileCacheService; } } + protected UserProfileCacheService m_userProfileCacheService; // protected AgentAssetTransactionsManager m_transactionsManager; // public AgentAssetTransactionsManager TransactionsManager // { // get { return m_transactionsManager; } - // } - - protected IAvatarService m_avatarService; + // } public IAvatarService AvatarService { get { return m_avatarService; } } - - protected AssetCache m_assetCache; + protected IAvatarService m_avatarService; public AssetCache AssetCache { get { return m_assetCache; } } - - protected NetworkServersInfo m_networkServersInfo; + protected AssetCache m_assetCache; + + public IInterGridInventoryServices InterGridInventoryService + { + get { return m_interGridInventoryService; } + } + protected IInterGridInventoryServices m_interGridInventoryService; public NetworkServersInfo NetworkServersInfo { get { return m_networkServersInfo; } } + protected NetworkServersInfo m_networkServersInfo; + /// + /// Constructor + /// + /// + /// + /// + /// public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool dumpAssetsToFile) { diff --git a/OpenSim/Framework/Communications/IInterGridInventoryServices.cs b/OpenSim/Framework/Communications/IInterGridInventoryServices.cs index 1ef1452d4c..e820c5ea0f 100644 --- a/OpenSim/Framework/Communications/IInterGridInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInterGridInventoryServices.cs @@ -34,12 +34,7 @@ namespace OpenSim.Framework.Communications /// Inventory operations used between grid services. /// public interface IInterGridInventoryServices - { - string Host - { - get; - } - + { /// /// Create a new inventory for the given user. /// diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 18e1a2df18..bb16a49d54 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs @@ -42,6 +42,11 @@ namespace OpenSim.Framework.Communications /// public interface IInventoryServices : IInterGridInventoryServices { + string Host + { + get; + } + /// /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the /// inventory has been received diff --git a/OpenSim/Framework/Communications/ISecureInventoryService.cs b/OpenSim/Framework/Communications/ISecureInventoryService.cs index 0e7861a0ce..1da3115fab 100644 --- a/OpenSim/Framework/Communications/ISecureInventoryService.cs +++ b/OpenSim/Framework/Communications/ISecureInventoryService.cs @@ -31,7 +31,6 @@ using OpenSim.Framework.Communications.Cache; namespace OpenSim.Framework.Communications { - /// /// Defines all the operations one can perform on a user's inventory. /// @@ -41,6 +40,7 @@ namespace OpenSim.Framework.Communications { get; } + /// /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the /// inventory has been received @@ -105,21 +105,11 @@ namespace OpenSim.Framework.Communications /// true if the inventory was successfully created, false otherwise bool CreateNewUserInventory(LLUUID user); - bool HasInventoryForUser(LLUUID userID); - /// - /// Retrieve the root inventory folder for the given user. + /// Does the given user have an inventory structure? /// /// - /// null if no root folder was found - InventoryFolderBase RequestRootFolder(LLUUID userID); - - /// - /// Returns a list of all the folders in a given user's inventory. - /// - /// - /// A flat list of the user's inventory folder tree, - /// null if there is no inventory for this user - List GetInventorySkeleton(LLUUID userId); + /// + bool HasInventoryForUser(LLUUID userID); } } diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index d26a3bb828..fd2e6b1afd 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -38,7 +38,7 @@ namespace OpenSim.Framework.Communications /// /// Abstract base class used by local and grid implementations of an inventory service. /// - public abstract class InventoryServiceBase : IInventoryServices + public abstract class InventoryServiceBase : IInventoryServices, IInterGridInventoryServices { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 5fd552465b..3bc3f9a866 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -44,8 +44,9 @@ namespace OpenSim.Region.Communications.Local IGridServices gridService, bool dumpAssetsToFile) : base(serversInfo, httpServer, assetCache, dumpAssetsToFile) { - AddInventoryService( inventoryService); + AddInventoryService(inventoryService); m_defaultInventoryHost = inventoryService.Host; + m_interGridInventoryService = inventoryService; m_userService = userService; m_avatarService = (IAvatarService)userService; m_gridService = gridService; diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 30a639a299..98672c2395 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.Communications.Local profile = m_userManager.GetUserProfile(firstname, lastname); if (profile != null) { - m_Parent.InventoryService.CreateNewUserInventory(profile.ID); + m_Parent.InterGridInventoryService.CreateNewUserInventory(profile.ID); } return profile; @@ -260,13 +260,13 @@ namespace OpenSim.Region.Communications.Local // See LoginService protected override InventoryData GetInventorySkeleton(LLUUID userID, string serverUrl) { - List folders = m_Parent.InventoryService.GetInventorySkeleton(userID); + List folders = m_Parent.InterGridInventoryService.GetInventorySkeleton(userID); // If we have user auth but no inventory folders for some reason, create a new set of folders. if (null == folders || 0 == folders.Count) { - m_Parent.InventoryService.CreateNewUserInventory(userID); - folders = m_Parent.InventoryService.GetInventorySkeleton(userID); + m_Parent.InterGridInventoryService.CreateNewUserInventory(userID); + folders = m_Parent.InterGridInventoryService.GetInventorySkeleton(userID); } LLUUID rootID = LLUUID.Zero; diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 798dd24263..76791f1dd6 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -37,7 +37,7 @@ namespace OpenSim.Region.Communications.Local // private readonly NetworkServersInfo m_serversInfo; private readonly uint m_defaultHomeX; private readonly uint m_defaultHomeY; - private IInventoryServices m_inventoryService; + private IInterGridInventoryServices m_interGridInventoryService; /// /// @@ -48,14 +48,14 @@ namespace OpenSim.Region.Communications.Local /// /// Can be null if stats collection is not required. public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY, - IInventoryServices inventoryService) + IInterGridInventoryServices interGridInventoryService) { // m_serversInfo = serversInfo; m_defaultHomeX = defaultHomeLocX; m_defaultHomeY = defaultHomeLocY; - m_inventoryService = inventoryService; + m_interGridInventoryService = interGridInventoryService; } public override UserProfileData SetupMasterUser(string firstName, string lastName) @@ -82,7 +82,7 @@ namespace OpenSim.Region.Communications.Local } else { - m_inventoryService.CreateNewUserInventory(profile.ID); + m_interGridInventoryService.CreateNewUserInventory(profile.ID); } return profile; diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 05ecfccbb0..b86d9eabd5 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -39,7 +39,7 @@ using OpenSim.Framework.Statistics; namespace OpenSim.Region.Communications.OGS1 { - public class OGS1InventoryService : IInventoryServices + public class OGS1InventoryService : IInventoryServices, IInterGridInventoryServices { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/Communications/OGS1/OGS1SecureInvenotryService.cs b/OpenSim/Region/Communications/OGS1/OGS1SecureInvenotryService.cs index 61c4e06816..fbfc680d2d 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1SecureInvenotryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1SecureInvenotryService.cs @@ -39,7 +39,7 @@ using OpenSim.Framework.Statistics; namespace OpenSim.Region.Communications.OGS1 { - public class OGS1SecureInventoryService : ISecureInventoryService + public class OGS1SecureInventoryService : ISecureInventoryService, IInterGridInventoryServices { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);