From 8143c597fc5f62ec0d931d2d5b887730e06aec04 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Sep 2007 13:25:45 +0000 Subject: * Tleiades grid mode inventory (#444) - thanx Tleiades! * updated to rev 1413 on libsecondlife.dll and libsecondlife.dll.config (#423) --- .../Communications/Local/CommunicationsLocal.cs | 2 +- .../Communications/Local/LocalInventoryService.cs | 3 +- .../Communications/Local/LocalLoginService.cs | 51 +--------------- .../Communications/Local/LocalUserServices.cs | 5 +- .../Communications/OGS1/CommunicationsOGS1.cs | 2 +- .../Region/Communications/OGS1/OGS1GridServices.cs | 20 ++++++- .../Communications/OGS1/OGS1InventoryService.cs | 69 ++++++++++++++++++---- 7 files changed, 85 insertions(+), 67 deletions(-) (limited to 'OpenSim/Region/Communications') diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index a00b35f..7e08297 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.Communications.Local } else { - this.m_inventoryService.CreateNewUserInventory(userProf.UUID); + this.m_inventoryService.CreateNewUserInventory(LLUUID.Zero, userProf.UUID); Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); return userProf.UUID; } diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index 53f6ffa..5bd3277 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs @@ -3,6 +3,7 @@ using libsecondlife; using OpenSim.Framework.Communications; using OpenSim.Framework.Data; using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; +using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; namespace OpenSim.Region.Communications.Local { @@ -49,7 +50,7 @@ namespace OpenSim.Region.Communications.Local } } - public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) + public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) { this.AddFolder(folder); } diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index ab8e397..95fdf5a 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -7,7 +7,6 @@ using OpenSim.Framework.Data; using OpenSim.Framework.Types; using OpenSim.Framework.UserManagement; using OpenSim.Framework.Utilities; -using OpenSim.Framework.Inventory; namespace OpenSim.Region.Communications.Local { @@ -25,7 +24,7 @@ namespace OpenSim.Region.Communications.Local public event LoginToRegionEvent OnLoginToRegion; public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) - : base(userManager, welcomeMess) + : base(userManager, parent.InventoryService, welcomeMess) { m_Parent = parent; this.serversInfo = serversInfo; @@ -53,7 +52,7 @@ namespace OpenSim.Region.Communications.Local profile = this.m_userManager.GetUserProfile(firstname, lastname); if (profile != null) { - m_Parent.InventoryService.CreateNewUserInventory(profile.UUID); + m_Parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID); } return profile; @@ -123,51 +122,5 @@ namespace OpenSim.Region.Communications.Local } } - - protected override InventoryData CreateInventoryData(LLUUID userID) - { - List folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID); - if (folders.Count > 0) - { - LLUUID rootID = LLUUID.Zero; - ArrayList AgentInventoryArray = new ArrayList(); - Hashtable TempHash; - foreach (InventoryFolderBase InvFolder in folders) - { - if (InvFolder.parentID == LLUUID.Zero) - { - rootID = InvFolder.folderID; - } - TempHash = new Hashtable(); - TempHash["name"] = InvFolder.name; - TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); - TempHash["version"] = (Int32)InvFolder.version; - TempHash["type_default"] = (Int32)InvFolder.type; - TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); - AgentInventoryArray.Add(TempHash); - } - return new InventoryData(AgentInventoryArray, rootID); - } - else - { - AgentInventory userInventory = new AgentInventory(); - userInventory.CreateRootFolder(userID, false); - - ArrayList AgentInventoryArray = new ArrayList(); - Hashtable TempHash; - foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) - { - TempHash = new Hashtable(); - TempHash["name"] = InvFolder.FolderName; - TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); - TempHash["version"] = (Int32)InvFolder.Version; - TempHash["type_default"] = (Int32)InvFolder.DefaultType; - TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); - AgentInventoryArray.Add(TempHash); - } - - return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); - } - } } } diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 3bc4301..61b8633 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -1,4 +1,5 @@ using System; +using libsecondlife; using OpenSim.Framework.Communications; using OpenSim.Framework.Data; using OpenSim.Framework.Types; @@ -48,10 +49,10 @@ namespace OpenSim.Region.Communications.Local } else { - m_parent.InventoryService.CreateNewUserInventory(profile.UUID); + m_parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID); } return profile; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 96f1933..1aa6498 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -14,8 +14,8 @@ namespace OpenSim.Region.Communications.OGS1 m_gridService = gridInterComms; m_interRegion = gridInterComms; - m_inventoryService = new OGS1InventoryService(); m_userService = new OGS1UserServices(this); + m_inventoryService = new OGS1InventoryService(serversInfo, m_userService); } } } diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 1b4b54c..0b78c83 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -5,6 +5,7 @@ using System.Net; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; +using System.Runtime.Serialization.Formatters; using libsecondlife; using Nwc.XmlRpc; using OpenSim.Framework; @@ -302,8 +303,23 @@ namespace OpenSim.Region.Communications.OGS1 /// private void StartRemoting() { - TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort); - ChannelServices.RegisterChannel(ch, true); + // we only need to register the tcp channel once, and we don't know which other modules use remoting + if (ChannelServices.GetChannel("tcp") == null) + { + // Creating a custom formatter for a TcpChannel sink chain. + BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider(); + serverProvider.TypeFilterLevel = TypeFilterLevel.Full; + + BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider(); + + IDictionary props = new Hashtable(); + props["port"] = this.serversInfo.RemotingListenerPort; + props["typeFilterLevel"] = TypeFilterLevel.Full; + + TcpChannel ch = new TcpChannel(props, clientProvider, serverProvider); + + ChannelServices.RegisterChannel(ch, true); + } WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(wellType); diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 45188c1..2ec4d10 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -1,8 +1,15 @@ +using System; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Channels; +using System.Runtime.Remoting.Channels.Tcp; +using System.Runtime.Serialization.Formatters; +using System.Collections; using System.Collections.Generic; + using libsecondlife; using OpenSim.Framework.Communications; using OpenSim.Framework.Data; -using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; +using OpenSim.Framework.Types; namespace OpenSim.Region.Communications.OGS1 @@ -10,43 +17,83 @@ namespace OpenSim.Region.Communications.OGS1 public class OGS1InventoryService : IInventoryServices { - public OGS1InventoryService() + IUserServices _userServices; + IInventoryServices _inventoryServices; + + public OGS1InventoryService(NetworkServersInfo networkConfig, IUserServices userServices) : + this(networkConfig.InventoryServerName, networkConfig.InventoryServerPort, userServices) + { + } + + public OGS1InventoryService(string serverName, int serverPort, IUserServices userServices) { + _userServices = userServices; + + // we only need to register the tcp channel once, and we don't know which other modules use remoting + if (ChannelServices.GetChannel("tcp") == null) + { + // Creating a custom formatter for a TcpChannel sink chain. + BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider(); + serverProvider.TypeFilterLevel = TypeFilterLevel.Full; + + BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider(); + + IDictionary props = new Hashtable(); + props["typeFilterLevel"] = TypeFilterLevel.Full; + + // Pass the properties for the port setting and the server provider in the server chain argument. (Client remains null here.) + TcpChannel chan = new TcpChannel(props, clientProvider, serverProvider); + + ChannelServices.RegisterChannel(chan, true); + } + + + string remotingUrl = string.Format("tcp://{0}:{1}/Inventory", serverName, serverPort); + _inventoryServices = (IInventoryServices)Activator.GetObject(typeof(IInventoryServices), remotingUrl); } #region IInventoryServices Members public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) { - + _inventoryServices.RequestInventoryForUser(userID, folderCallBack, itemCallBack); } - public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) + public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) { - + _inventoryServices.AddNewInventoryFolder(userID, folder); } public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) { - + _inventoryServices.AddNewInventoryItem(userID, item); } public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) { - + _inventoryServices.DeleteInventoryItem(userID, item); + } + + public List RequestFirstLevelFolders(LLUUID folderID) + { + return _inventoryServices.RequestFirstLevelFolders(folderID); } - public void CreateNewUserInventory(LLUUID user) + public List RequestFolderItems(LLUUID folderID) { - + return _inventoryServices.RequestFolderItems(folderID); } - public List RequestFirstLevelFolders(LLUUID userID) + public void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder) { - return new List(); + _inventoryServices.GetRootFoldersForUser(user, out libraryFolder, out personalFolder); } + public void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user) + { + throw new Exception("method not implemented"); + } #endregion } } -- cgit v1.1