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/InventoryServer/Main.cs | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'OpenSim/Grid/InventoryServer/Main.cs') diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 1bc396b..8d232c2 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -47,6 +47,7 @@ namespace OpenSim.Grid.InventoryServer LogBase m_console; InventoryManager m_inventoryManager; InventoryConfig m_config; + GridInventoryService m_inventoryService; public const string LogName = "INVENTORY"; @@ -69,13 +70,35 @@ namespace OpenSim.Grid.InventoryServer { MainLog.Instance.Notice("Initialising inventory manager..."); m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); - - m_inventoryManager = new InventoryManager(); - m_inventoryManager.AddDatabasePlugin(m_config.DatabaseProvider); + + m_inventoryService = new GridInventoryService(); + // m_inventoryManager = new InventoryManager(); + m_inventoryService.AddPlugin(m_config.DatabaseProvider); + MainLog.Instance.Notice(LogName, "Starting HTTP server ..."); BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); + httpServer.AddStreamHandler( + new RestDeserialisehandler<LLUUID, InventoryCollection>("POST", "/GetInventory/", + m_inventoryService.GetUserInventory)); + httpServer.AddStreamHandler( + new RestDeserialisehandler<LLUUID, bool>("POST", "/CreateInventory/", + m_inventoryService.CreateUsersInventory)); + httpServer.AddStreamHandler( + new RestDeserialisehandler<InventoryFolderBase, bool>("POST", "/NewFolder/", + m_inventoryService.AddInventoryFolder)); + + httpServer.AddStreamHandler( + new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/NewItem/", + m_inventoryService.AddInventoryItem)); + httpServer.AddStreamHandler( + new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/DeleteItem/", + m_inventoryService.DeleteInvItem)); - httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); + httpServer.AddStreamHandler( + new RestDeserialisehandler<LLUUID, List<InventoryFolderBase>>("POST", "/RootFolders/", + m_inventoryService.RequestFirstLevelFolders)); + + // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); httpServer.Start(); MainLog.Instance.Notice(LogName, "Started HTTP server"); @@ -96,6 +119,9 @@ namespace OpenSim.Grid.InventoryServer switch (cmd) { case "quit": + case "add-user": + m_inventoryService.CreateUsersInventory(LLUUID.Random()); + break; case "shutdown": m_console.Close(); Environment.Exit(0); -- cgit v1.1