From 5df851761aa796cba70a3b6d8b36d119502c1de2 Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 1 Dec 2007 18:49:17 +0000 Subject: Initial working Grid Inventory server. Only been tested on a very small grid, so likely to have problems on a larger grid with more people? To use , both the user server and Inventory server need to be running this latest revision. (older regions should be able to still be used, just the user won't have inventory on them). Also and HERE IS THE BIG BREAK ISSUE, currently, so that the initial inventory details for a user are added to the inventory db , you need to recreate the accounts using the user server "create user" feature. It should be quite easy to manual populate the inventory database instead but I someone else will need to look into that) Also I've only tested using SQLite as the database provider, there is a Mysql inventory provider but I don't know if it works (SQLite is set as default, so you will need to change it in the inventory server config.xml) --- OpenSim/Grid/UserServer/Main.cs | 19 ++++++++++- OpenSim/Grid/UserServer/UserLoginService.cs | 50 +++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) (limited to 'OpenSim/Grid/UserServer') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 779a72b..b00bb76 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -27,7 +27,9 @@ */ using System; +using System.Collections.Generic; using System.IO; +using libsecondlife; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; @@ -44,6 +46,7 @@ namespace OpenSim.Grid.UserServer public UserLoginService m_loginService; private LogBase m_console; + private LLUUID m_lastCreatedUser = LLUUID.Random(); [STAThread] public static void Main(string[] args) @@ -123,7 +126,9 @@ namespace OpenSim.Grid.UserServer tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); - m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); + LLUUID userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); + RestObjectPoster.BeginPostObject(m_userManager._config.InventoryUrl + "CreateInventory/", userID); + m_lastCreatedUser = userID; break; } } @@ -145,9 +150,21 @@ namespace OpenSim.Grid.UserServer m_console.Close(); Environment.Exit(0); break; + + case "test-inventory": + // RestObjectPosterResponse> requester = new RestObjectPosterResponse>(); + // requester.ReturnResponseVal = TestResponse; + // requester.BeginPostObject(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); + List folders = SyncRestObjectPoster.BeginPostObject>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); + break; } } + public void TestResponse(List resp) + { + System.Console.WriteLine("response got"); + } + /*private void ConfigDB(IGenericConfig configData) { try diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 0af5790..d3164ad 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -28,12 +28,16 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Net; using Nwc.XmlRpc; +using libsecondlife; using OpenSim.Framework; using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; using OpenSim.Framework.Data; using OpenSim.Framework.UserManagement; +using InventoryFolder = OpenSim.Framework.InventoryFolder; namespace OpenSim.Grid.UserServer { @@ -189,5 +193,51 @@ namespace OpenSim.Grid.UserServer } } + + protected override InventoryData CreateInventoryData(LLUUID userID) + { + List folders = SyncRestObjectPoster.BeginPostObject>(m_config.InventoryUrl + "RootFolders/", 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 (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); + } + } } } \ No newline at end of file -- cgit v1.1