diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 3127bd620d..524f3148cf 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -87,6 +87,24 @@ namespace OpenSim.Framework.Communications.Cache private IDictionary> pendingCategorizationFolders = new Dictionary>(); + private string m_inventoryHost + { + get + { + if (m_userProfile != null) + { + if (m_userProfile.UserInventoryURI != String.Empty) + { + Uri uri = new Uri(m_userProfile.UserInventoryURI); + return uri.Host; + } + } + + return ""; + } + + } + /// /// Constructor /// @@ -325,9 +343,15 @@ namespace OpenSim.Framework.Communications.Cache createdBaseFolder.Type = createdFolder.Type; createdBaseFolder.Version = createdFolder.Version; - m_commsManager.InventoryService.AddFolder(createdBaseFolder); + IInventoryServices invService = GetInventoryService(); + if (invService != null) + { + //m_commsManager.InventoryService + invService.AddFolder(createdBaseFolder); + return true; + } - return true; + return false; } else { @@ -379,14 +403,19 @@ namespace OpenSim.Framework.Communications.Cache baseFolder.Type = (short) type; baseFolder.Version = RootFolder.Version; - m_commsManager.InventoryService.UpdateFolder(baseFolder); + IInventoryServices invService = GetInventoryService(); + if (invService != null) + { + //m_commsManager.InventoryService. + invService.UpdateFolder(baseFolder); - InventoryFolderImpl folder=RootFolder.FindFolder(folderID); - if(folder != null) - { - folder.Name = name; - folder.ParentID = parentID; - } + InventoryFolderImpl folder = RootFolder.FindFolder(folderID); + if (folder != null) + { + folder.Name = name; + folder.ParentID = parentID; + } + } } else { @@ -421,13 +450,24 @@ namespace OpenSim.Framework.Communications.Cache baseFolder.ID = folderID; baseFolder.ParentID = parentID; - m_commsManager.InventoryService.MoveFolder(baseFolder); + IInventoryServices invService = GetInventoryService(); + if (invService != null) + { + // m_commsManager.InventoryService + invService.MoveFolder(baseFolder); - InventoryFolderImpl folder=RootFolder.FindFolder(folderID); - if(folder != null) - folder.ParentID = parentID; + InventoryFolderImpl folder = RootFolder.FindFolder(folderID); + if (folder != null) + { + folder.ParentID = parentID; + } - return true; + return true; + } + else + { + return false; + } } else { @@ -468,11 +508,16 @@ namespace OpenSim.Framework.Communications.Cache purgedBaseFolder.Type = purgedFolder.Type; purgedBaseFolder.Version = purgedFolder.Version; - m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder); + IInventoryServices invService = GetInventoryService(); + if (invService != null) + { + //m_commsManager.InventoryService + invService.PurgeFolder(purgedBaseFolder); - purgedFolder.Purge(); + purgedFolder.Purge(); - return true; + return true; + } } } else @@ -505,7 +550,13 @@ namespace OpenSim.Framework.Communications.Cache item.Folder=RootFolder.ID; } ItemReceive(item); - m_commsManager.InventoryService.AddItem(item); + + IInventoryServices invService = GetInventoryService(); + if (invService != null) + { + //m_commsManager.InventoryService + invService.AddItem(item); + } } else { @@ -525,7 +576,12 @@ namespace OpenSim.Framework.Communications.Cache { if (HasInventory) { - m_commsManager.InventoryService.UpdateItem(item); + IInventoryServices invService = GetInventoryService(); + if (invService != null) + { + //m_commsManager.InventoryService + invService.UpdateItem(item); + } } else { @@ -564,7 +620,14 @@ namespace OpenSim.Framework.Communications.Cache if (RootFolder.DeleteItem(item.ID)) { - return m_commsManager.InventoryService.DeleteItem(item); + IInventoryServices invService = GetInventoryService(); + if (invService != null) + { + //return m_commsManager.InventoryService + return invService.DeleteItem(item); + } + + return false; } } else @@ -641,6 +704,13 @@ namespace OpenSim.Framework.Communications.Cache } return null; } + + public IInventoryServices GetInventoryService() + { + IInventoryServices invService; + m_commsManager.TryGetInventoryService(m_inventoryHost, out invService); + return invService; + } } /// diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index fe614066a4..37451ab333 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -119,7 +119,12 @@ namespace OpenSim.Framework.Communications.Cache CachedUserInfo userInfo = GetUserDetails(userID); if (userInfo != null) { - m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive); + //m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive); + IInventoryServices invService = userInfo.GetInventoryService(); + if (invService != null) + { + invService.RequestInventoryForUser(userID, userInfo.InventoryReceive); + } } else { diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 5de0c71291..0410f0ea4a 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -55,12 +55,6 @@ namespace OpenSim.Framework.Communications get { return m_gridService; } } - protected IInventoryServices m_inventoryService; - - public IInventoryServices InventoryService - { - get { return m_inventoryService; } - } protected IInterRegionCommunications m_interRegion; @@ -106,6 +100,70 @@ namespace OpenSim.Framework.Communications // m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile); } + #region Inventory + protected string m_defaultInventoryHost = "default"; + + protected List m_inventoryServices = new List(); + // protected IInventoryServices m_inventoryService; + + public IInventoryServices InventoryService + { + get + { + if (m_inventoryServices.Count > 0) + { + // return m_inventoryServices[0]; + IInventoryServices invService; + if (TryGetInventoryService(m_defaultInventoryHost, out invService)) + { + return invService; + } + + } + + return null; + } + } + + public bool TryGetInventoryService(string host, out IInventoryServices inventoryService) + { + if ((host == string.Empty) | (host == "default")) + { + host = m_defaultInventoryHost; + } + + + lock (m_inventoryServices) + { + foreach (IInventoryServices service in m_inventoryServices) + { + if (service.Host == host) + { + inventoryService = service; + return true; + } + } + } + + inventoryService = null; + return false; + } + + public virtual void AddInventoryService(string hostUrl) + { + + } + + public virtual void AddInventoryService(IInventoryServices service) + { + lock (m_inventoryServices) + { + m_inventoryServices.Add(service); + } + } + + #endregion + public void doCreate(string[] cmmdParams) { switch (cmmdParams[0]) @@ -167,7 +225,7 @@ namespace OpenSim.Framework.Communications } else { - m_inventoryService.CreateNewUserInventory(userProf.ID); + InventoryService.CreateNewUserInventory(userProf.ID); m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName); return userProf.ID; } diff --git a/OpenSim/Framework/Communications/IAvatarService.cs b/OpenSim/Framework/Communications/IAvatarService.cs new file mode 100644 index 0000000000..fdac53fdff --- /dev/null +++ b/OpenSim/Framework/Communications/IAvatarService.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Framework.Communications +{ + public interface IAvatarService + { + /// Get's the User Appearance + AvatarAppearance GetUserAppearance(LLUUID user); + + void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); + + void AddAttachment(LLUUID user, LLUUID attach); + + void RemoveAttachment(LLUUID user, LLUUID attach); + + List GetAttachments(LLUUID user); + } +} diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 8dc09bc8eb..3929a4e855 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs @@ -42,6 +42,10 @@ namespace OpenSim.Framework.Communications /// public interface IInventoryServices { + 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/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs index a7f19e757d..f8ef358416 100644 --- a/OpenSim/Framework/Communications/IUserService.cs +++ b/OpenSim/Framework/Communications/IUserService.cs @@ -111,10 +111,6 @@ namespace OpenSim.Framework.Communications /// The agent that we're retreiving the friends Data. List GetUserFriendList(LLUUID friendlistowner); - /// - /// Get's the User Appearance - AvatarAppearance GetUserAppearance(LLUUID user); - /// /// Updates the current region the User is in /// @@ -122,6 +118,10 @@ namespace OpenSim.Framework.Communications /// User Region the Avatar is IN void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle); + /// + /// Get's the User Appearance + AvatarAppearance GetUserAppearance(LLUUID user); + void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); void AddAttachment(LLUUID user, LLUUID attach); diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 89ccf9360e..d26a3bb828 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -81,6 +81,11 @@ namespace OpenSim.Framework.Communications #region IInventoryServices methods + public string Host + { + get { return "default"; } + } + // See IInventoryServices public List GetInventorySkeleton(LLUUID userId) { diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index aecf2dfbe2..06b4de7083 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -173,7 +173,7 @@ namespace OpenSim { if (File.Exists("OpenSim.xml")) { - //chech for a xml config file + //check for a xml config file Application.iniFilePath = "OpenSim.xml"; m_config.Source = new XmlConfigSource(); m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath)); diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index fb5b17baa6..2065006b93 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -44,7 +44,8 @@ namespace OpenSim.Region.Communications.Local IGridServices gridService, bool dumpAssetsToFile) : base(serversInfo, httpServer, assetCache, dumpAssetsToFile) { - m_inventoryService = inventoryService; + AddInventoryService( inventoryService); + m_defaultInventoryHost = inventoryService.Host; m_userService = userService; m_gridService = gridService; m_interRegion = interRegionService; diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index d622b7e3bd..b85654dc85 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -41,8 +41,17 @@ namespace OpenSim.Region.Communications.OGS1 m_gridService = gridInterComms; m_interRegion = gridInterComms; - m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL); + OGS1InventoryService invService = new OGS1InventoryService(serversInfo.InventoryURL); + AddInventoryService(invService); + m_defaultInventoryHost = invService.Host; + m_userService = new OGS1UserServices(this); } + + public override void AddInventoryService(string hostUrl) + { + OGS1InventoryService invService = new OGS1InventoryService(hostUrl); + AddInventoryService(invService); + } } } diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index dfc741aaf6..4e4bfe836b 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -45,16 +45,23 @@ namespace OpenSim.Region.Communications.OGS1 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string _inventoryServerUrl; + private Uri m_Uri; private Dictionary m_RequestingInventory = new Dictionary(); public OGS1InventoryService(string inventoryServerUrl) { _inventoryServerUrl = inventoryServerUrl; + m_Uri = new Uri(_inventoryServerUrl); } #region IInventoryServices Members + public string Host + { + get { return m_Uri.Host; } + } + /// /// /// diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index cdd138b453..da93890986 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -696,5 +696,6 @@ namespace OpenSim.Region.Environment.Scenes { return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query); } + } } diff --git a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs index 9c70a0427f..43b492aa66 100644 --- a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs @@ -66,6 +66,7 @@ namespace OpenSim.Region.Modules.AvatarFactory appearance = CreateDefault(avatarId); m_log.InfoFormat("[APPEARANCE] appearance not found for {0}, creating default", avatarId.ToString()); return false; + } private AvatarAppearance CreateDefault(LLUUID avatarId)