From 6d061d9f398adfa193f25c43604b517ad0d756a2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jan 2010 22:00:19 +0000 Subject: [PATCH] Complete the XInventoryConnector. Flesh out the skeleton for the XInventoryInConnector --- .../Inventory/XInventoryInConnector.cs | 225 +++++++++++++++++- .../Inventory/XInventoryConnector.cs | 50 +++- 2 files changed, 268 insertions(+), 7 deletions(-) diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 8c6eca7411..b48e30e342 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -92,7 +92,7 @@ namespace OpenSim.Server.Handlers.Asset sr.Close(); body = body.Trim(); - //m_log.DebugFormat("[XXX]: query String: {0}", body); + m_log.DebugFormat("[XXX]: query String: {0}", body); try { @@ -107,8 +107,44 @@ namespace OpenSim.Server.Handlers.Asset switch (method) { - case "TEST": - return HandleTest(request); + case "CREATEUSERINVENTORY": + return HandleCreateUserInventory(request); + case "GETINVENTORYSKELETON": + return HandleGetInventorySkeleton(request); + case "GETROOTFOLDER": + return HandleGetRootFolder(request); + case "GETFOLDERFORTYPE": + return HandleGetFolderForType(request); + case "GETFOLDERCONTENT": + return HandleGetFolderContent(request); + case "GETFOLDERITEMS": + return HandleGetFolderItems(request); + case "ADDFOLDER": + return HandleAddFolder(request); + case "UPDATEFOLDER": + return HandleUpdateFolder(request); + case "MOVEFOLDER": + return HandleMoveFolder(request); + case "DELETEFOLDERS": + return HandleDeleteFolders(request); + case "PURGEFOLDER": + return HandlePurgeFolder(request); + case "ADDITEM": + return HandleAddItem(request); + case "UPDATEITEM": + return HandleUpdateItem(request); + case "MOVEITEMS": + return HandleMoveItems(request); + case "DELETEITEMS": + return HandleDeleteItems(request); + case "GETITEM": + return HandleGetItem(request); + case "GETFOLDER": + return HandleGetFolder(request); + case "GETACTIVEGESTURES": + return HandleGetActiveGestures(request); + case "GETASSETPERMISSIONS": + return HandleGetAssetPermissions(request); } m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); } @@ -153,15 +189,194 @@ namespace OpenSim.Server.Handlers.Asset return ms.ToArray(); } - byte[] HandleTest(Dictionary request) + byte[] HandleCreateUserInventory(Dictionary request) { Dictionary result = new Dictionary(); string xmlString = ServerUtils.BuildXmlResponse(result); - //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); return encoding.GetBytes(xmlString); } + byte[] HandleGetInventorySkeleton(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetRootFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetFolderForType(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetFolderContent(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetFolderItems(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleAddFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleUpdateFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleMoveFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleDeleteFolders(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandlePurgeFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleAddItem(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleUpdateItem(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleMoveItems(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleDeleteItems(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetItem(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetFolder(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetActiveGestures(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] HandleGetAssetPermissions(Dictionary request) + { + Dictionary result = new Dictionary(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } } } diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index aac1a83eae..40acd6d20f 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -149,12 +149,58 @@ namespace OpenSim.Services.Connectors public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) { - return null; + Dictionary ret = MakeRequest("GETFOLDERCONTENT", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "FOLDER", folderID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + + InventoryCollection inventory = new InventoryCollection(); + inventory.Folders = new List(); + inventory.Items = new List(); + inventory.UserID = principalID; + + Dictionary folders = + (Dictionary)ret["FOLDERS"]; + Dictionary items = + (Dictionary)ret["ITEMS"]; + + foreach (Object o in folders.Values) + inventory.Folders.Add(BuildFolder((Dictionary)o)); + foreach (Object o in items.Values) + inventory.Items.Add(BuildItem((Dictionary)o)); + + return inventory; } public List GetFolderItems(UUID principalID, UUID folderID) { - return null; + Dictionary ret = MakeRequest("GETFOLDERCONTENT", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "FOLDER", folderID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + + List items = new List(); + + foreach (Object o in ret.Values) + items.Add(BuildItem((Dictionary)o)); + + return items; } public bool AddFolder(InventoryFolderBase folder)