* 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
0.6.0-stable
Justin Clarke Casey 2008-04-11 20:37:26 +00:00
parent 8f345d36d8
commit b3f783ae05
4 changed files with 48 additions and 77 deletions

View File

@ -37,47 +37,8 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
public class InventoryCollection public class InventoryCollection
{ {
public List<InventoryFolderBase> _folders; public List<InventoryFolderBase> Folders;
public List<InventoryItemBase> _allItems; public List<InventoryItemBase> Items;
public LLUUID _userID; public LLUUID UserID;
public List<InventoryFolderBase> Folders {
get {
return _folders;
}
set {
_folders = value;
}
}
public List<InventoryItemBase> AllItems {
get {
return _allItems;
}
set {
_allItems = value;
}
}
public LLUUID UserID {
get {
return _userID;
}
set {
_userID = value;
}
}
public InventoryCollection()
{
_folders = new List<InventoryFolderBase>();
_allItems = new List<InventoryItemBase>();
}
public InventoryCollection(List<InventoryFolderBase> folders, List<InventoryItemBase> allItems)
{
_folders = folders;
_allItems = allItems;
}
} }
} }

View File

@ -41,6 +41,9 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public class RestObjectPosterResponse<TResponse> public class RestObjectPosterResponse<TResponse>
{ {
// private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public ReturnResponse<TResponse> ResponseCallback; public ReturnResponse<TResponse> ResponseCallback;
public void BeginPostObject<TRequest>(string requestUrl, TRequest obj) public void BeginPostObject<TRequest>(string requestUrl, TRequest obj)
@ -83,7 +86,13 @@ namespace OpenSim.Framework.Servers
{ {
TResponse deserial; TResponse deserial;
XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); 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) if (deserial != null && ResponseCallback != null)
{ {

View File

@ -37,9 +37,13 @@ using OpenSim.Framework.Console;
namespace OpenSim.Grid.InventoryServer namespace OpenSim.Grid.InventoryServer
{ {
/// <summary>
/// Used on a grid server to satisfy external inventory requests
/// </summary>
public class GridInventoryService : InventoryServiceBase 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) public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback)
{ {
@ -110,7 +114,7 @@ namespace OpenSim.Grid.InventoryServer
LLUUID userID = new LLUUID(rawUserID); 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(); InventoryCollection invCollection = new InventoryCollection();
@ -118,7 +122,7 @@ namespace OpenSim.Grid.InventoryServer
if (null == allFolders) 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; return invCollection;
} }
@ -135,23 +139,23 @@ namespace OpenSim.Grid.InventoryServer
} }
} }
invCollection.AllItems = allItems;
invCollection.Folders = allFolders;
invCollection.UserID = userID; invCollection.UserID = userID;
invCollection.Folders = allFolders;
invCollection.Items = allItems;
// foreach (InventoryFolderBase folder in folders) // foreach (InventoryFolderBase folder in invCollection.Folders)
// { // {
// m_log.DebugFormat( // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
// "[AGENT INVENTORY]: Sending back folder {0}, {1}",
// folder.name, folder.folderID);
// } // }
// //
// foreach (InventoryItemBase item in allItems) // foreach (InventoryItemBase item in invCollection.Items)
// { // {
// m_log.DebugFormat( // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
// "[AGENT INVENTORY]: Sending back item {0}, {1}, folder {2}",
// item.inventoryName, item.inventoryID, item.parentFolderID);
// } // }
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; return invCollection;
} }
@ -176,8 +180,7 @@ namespace OpenSim.Grid.InventoryServer
{ {
LLUUID userID = new LLUUID(rawUserID); LLUUID userID = new LLUUID(rawUserID);
m_log.Info( m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID);
"[AGENT INVENTORY]: Creating new set of inventory folders for " + userID.ToString());
CreateNewUserInventory(userID); CreateNewUserInventory(userID);
return true; return true;
@ -202,10 +205,7 @@ namespace OpenSim.Grid.InventoryServer
public bool AddInventoryFolder(InventoryFolderBase folder) public bool AddInventoryFolder(InventoryFolderBase folder)
{ {
// Right now, this actions act more like an update/insert combination than a simple create. // Right now, this actions act more like an update/insert combination than a simple create.
m_log.Info( m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating folder {0} {1} in folder {2}", folder.Name, folder.ID, folder.ParentID);
"[AGENT INVENTORY]: " +
"Updating in " + folder.ParentID.ToString()
+ ", folder " + folder.Name);
AddNewInventoryFolder(folder.Owner, folder); AddNewInventoryFolder(folder.Owner, folder);
return true; return true;
@ -213,10 +213,7 @@ namespace OpenSim.Grid.InventoryServer
public bool MoveInventoryFolder(InventoryFolderBase folder) public bool MoveInventoryFolder(InventoryFolderBase folder)
{ {
m_log.Info( m_log.InfoFormat("[GRID AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
"[AGENT INVENTORY]: " +
"Moving folder " + folder.ID
+ " to " + folder.ParentID.ToString());
MoveExistingInventoryFolder(folder); MoveExistingInventoryFolder(folder);
return true; return true;
@ -225,10 +222,7 @@ namespace OpenSim.Grid.InventoryServer
public bool AddInventoryItem(InventoryItemBase item) public bool AddInventoryItem(InventoryItemBase item)
{ {
// Right now, this actions act more like an update/insert combination than a simple create. // Right now, this actions act more like an update/insert combination than a simple create.
m_log.Info( m_log.InfoFormat("[GRID AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
"[AGENT INVENTORY]: " +
"Updating in " + item.Folder.ToString()
+ ", item " + item.Name);
AddNewInventoryItem(item.Owner, item); AddNewInventoryItem(item.Owner, item);
return true; return true;
@ -236,15 +230,16 @@ namespace OpenSim.Grid.InventoryServer
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
// extra spaces to align with other inventory messages m_log.InfoFormat("[GRID AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
m_log.Info(
"[AGENT INVENTORY]: " +
"Deleting in " + item.Folder.ToString()
+ ", item " + item.Name);
DeleteItem(item); DeleteItem(item);
} }
/// <summary>
/// FIXME: Get DeleteInventoryItem to return a bool
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public bool DeleteInvItem(InventoryItemBase item) public bool DeleteInvItem(InventoryItemBase item)
{ {
DeleteInventoryItem(item.Owner, item); DeleteInventoryItem(item.Owner, item);

View File

@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.OGS1
{ {
m_log.InfoFormat("[OGS1 INVENTORY SERVICE]: " + m_log.InfoFormat("[OGS1 INVENTORY SERVICE]: " +
"Received inventory response for user {0} containing {1} folders and {2} items", "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; InventoryFolderImpl rootFolder = null;
InventoryRequest request = m_RequestingInventory[userID]; InventoryRequest request = m_RequestingInventory[userID];
@ -108,6 +108,8 @@ namespace OpenSim.Region.Communications.OGS1
{ {
rootFolder = new InventoryFolderImpl(folder); rootFolder = new InventoryFolderImpl(folder);
folders.Add(rootFolder); 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); 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); request.Callback(userID, folders, items);