From b3f783ae056fd2e8921336a1d459d91c7df97ce3 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 11 Apr 2008 20:37:26 +0000 Subject: [PATCH] * Reduce publicly exposed fields on InventoryCollection, which was causing duplicate sets of inventory data to be sent over the grid * Won't actually fix anything, since we were handling the problem anyway * Also add more doc, fix up debugging messages, etc --- OpenSim/Framework/InventoryCollection.cs | 45 +------------- .../Servers/RestObjectPosterResponse.cs | 11 +++- .../InventoryServer/GridInventoryService.cs | 59 +++++++++---------- .../OGS1/OGS1InventoryService.cs | 10 +++- 4 files changed, 48 insertions(+), 77 deletions(-) diff --git a/OpenSim/Framework/InventoryCollection.cs b/OpenSim/Framework/InventoryCollection.cs index e76e1a99ed..abccf495f3 100644 --- a/OpenSim/Framework/InventoryCollection.cs +++ b/OpenSim/Framework/InventoryCollection.cs @@ -37,47 +37,8 @@ namespace OpenSim.Framework /// public class InventoryCollection { - public List _folders; - public List _allItems; - public LLUUID _userID; - - public List Folders { - get { - return _folders; - } - set { - _folders = value; - } - } - - public List AllItems { - get { - return _allItems; - } - set { - _allItems = value; - } - } - - public LLUUID UserID { - get { - return _userID; - } - set { - _userID = value; - } - } - - public InventoryCollection() - { - _folders = new List(); - _allItems = new List(); - } - - public InventoryCollection(List folders, List allItems) - { - _folders = folders; - _allItems = allItems; - } + public List Folders; + public List Items; + public LLUUID UserID; } } diff --git a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs index 1d99a801be..1410afdc72 100644 --- a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs +++ b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs @@ -41,6 +41,9 @@ namespace OpenSim.Framework.Servers /// public class RestObjectPosterResponse { +// private static readonly log4net.ILog m_log +// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public ReturnResponse ResponseCallback; public void BeginPostObject(string requestUrl, TRequest obj) @@ -83,7 +86,13 @@ namespace OpenSim.Framework.Servers { TResponse deserial; XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); - deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream()); + Stream stream = resp.GetResponseStream(); + + // This is currently a bad debug stanza since it gobbles us the response... +// StreamReader reader = new StreamReader(stream); +// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); + + deserial = (TResponse) deserializer.Deserialize(stream); if (deserial != null && ResponseCallback != null) { diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index 72d43d4a4c..8a45badc20 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -37,9 +37,13 @@ using OpenSim.Framework.Console; namespace OpenSim.Grid.InventoryServer { + /// + /// Used on a grid server to satisfy external inventory requests + /// public class GridInventoryService : InventoryServiceBase { - private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private static readonly log4net.ILog m_log + = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback) { @@ -110,7 +114,7 @@ namespace OpenSim.Grid.InventoryServer LLUUID userID = new LLUUID(rawUserID); - m_log.InfoFormat("[AGENT INVENTORY]: Processing request for inventory of {0}", userID); + m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID); InventoryCollection invCollection = new InventoryCollection(); @@ -118,7 +122,7 @@ namespace OpenSim.Grid.InventoryServer if (null == allFolders) { - m_log.WarnFormat("[AGENT INVENTORY]: No inventory found for user {0}", rawUserID); + m_log.WarnFormat("[GRID AGENT INVENTORY]: No inventory found for user {0}", rawUserID); return invCollection; } @@ -135,23 +139,23 @@ namespace OpenSim.Grid.InventoryServer } } - invCollection.AllItems = allItems; - invCollection.Folders = allFolders; invCollection.UserID = userID; + invCollection.Folders = allFolders; + invCollection.Items = allItems; -// foreach (InventoryFolderBase folder in folders) +// foreach (InventoryFolderBase folder in invCollection.Folders) // { -// m_log.DebugFormat( -// "[AGENT INVENTORY]: Sending back folder {0}, {1}", -// folder.name, folder.folderID); +// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); // } // -// foreach (InventoryItemBase item in allItems) +// foreach (InventoryItemBase item in invCollection.Items) // { -// m_log.DebugFormat( -// "[AGENT INVENTORY]: Sending back item {0}, {1}, folder {2}", -// item.inventoryName, item.inventoryID, item.parentFolderID); +// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); // } + + m_log.InfoFormat( + "[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items", + invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); return invCollection; } @@ -176,8 +180,7 @@ namespace OpenSim.Grid.InventoryServer { LLUUID userID = new LLUUID(rawUserID); - m_log.Info( - "[AGENT INVENTORY]: Creating new set of inventory folders for " + userID.ToString()); + m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID); CreateNewUserInventory(userID); return true; @@ -202,10 +205,7 @@ namespace OpenSim.Grid.InventoryServer public bool AddInventoryFolder(InventoryFolderBase folder) { // Right now, this actions act more like an update/insert combination than a simple create. - m_log.Info( - "[AGENT INVENTORY]: " + - "Updating in " + folder.ParentID.ToString() - + ", folder " + folder.Name); + m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating folder {0} {1} in folder {2}", folder.Name, folder.ID, folder.ParentID); AddNewInventoryFolder(folder.Owner, folder); return true; @@ -213,10 +213,7 @@ namespace OpenSim.Grid.InventoryServer public bool MoveInventoryFolder(InventoryFolderBase folder) { - m_log.Info( - "[AGENT INVENTORY]: " + - "Moving folder " + folder.ID - + " to " + folder.ParentID.ToString()); + m_log.InfoFormat("[GRID AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); MoveExistingInventoryFolder(folder); return true; @@ -225,10 +222,7 @@ namespace OpenSim.Grid.InventoryServer public bool AddInventoryItem(InventoryItemBase item) { // Right now, this actions act more like an update/insert combination than a simple create. - m_log.Info( - "[AGENT INVENTORY]: " + - "Updating in " + item.Folder.ToString() - + ", item " + item.Name); + m_log.InfoFormat("[GRID AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); AddNewInventoryItem(item.Owner, item); return true; @@ -236,15 +230,16 @@ namespace OpenSim.Grid.InventoryServer public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) { - // extra spaces to align with other inventory messages - m_log.Info( - "[AGENT INVENTORY]: " + - "Deleting in " + item.Folder.ToString() - + ", item " + item.Name); + m_log.InfoFormat("[GRID AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); DeleteItem(item); } + /// + /// FIXME: Get DeleteInventoryItem to return a bool + /// + /// + /// public bool DeleteInvItem(InventoryItemBase item) { DeleteInventoryItem(item.Owner, item); diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 41ca4fb6dc..fbe905c3f6 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.OGS1 { m_log.InfoFormat("[OGS1 INVENTORY SERVICE]: " + "Received inventory response for user {0} containing {1} folders and {2} items", - userID, response.Folders.Count, response.AllItems.Count); + userID, response.Folders.Count, response.Items.Count); InventoryFolderImpl rootFolder = null; InventoryRequest request = m_RequestingInventory[userID]; @@ -108,6 +108,8 @@ namespace OpenSim.Region.Communications.OGS1 { rootFolder = new InventoryFolderImpl(folder); folders.Add(rootFolder); + + break; } } @@ -121,11 +123,15 @@ namespace OpenSim.Region.Communications.OGS1 } } - foreach (InventoryItemBase item in response.AllItems) + foreach (InventoryItemBase item in response.Items) { items.Add(item); } } + else + { + m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID); + } request.Callback(userID, folders, items);